#include "orderwin.h"
#include "overview.h"
-#include "user.h"
-#include "host.h"
+//#include "user.h"
+//#include "host.h"
#include <QApplication>
#include <QBoxLayout>
QModelIndex idx=eventmodel->index(ilst[0].row(),0);
id=eventmodel->data(idx,Qt::UserRole).toInt();
if(id<0)return;
- MEvent ev(req,id);
- if(ev.isValid()){
+ MTGetEvent getev=MTGetEvent::query(id);
+ if(!getev.hasError()){
bool ok;
+ MOEvent ev=getev.getevent();
QString r=QInputDialog::getText(this,tr("Cancel Event"),tr("Please enter a reason to cancel event \"%1\" or abort:").arg(ev.title()),QLineEdit::Normal,"",&ok);
if(!ok)return;
- if(ev.cancelEvent(r))
+ MTCancelEvent cev=MTCancelEvent::queryWeb(id,r);
+ if(!cev.hasError())
QMessageBox::information(this,tr("Event Cancelled"),tr("The event \"%1\" has been cancelled. Please inform everybody who bought a ticket.").arg(ev.title()));
else
- QMessageBox::warning(this,tr("Warning"),tr("Unable to cancel event \"%1\".").arg(ev.title()));
+ QMessageBox::warning(this,tr("Warning"),tr("Unable to cancel event \"%1\": %2.").arg(ev.title()).arg(cev.errorString()));
}
}
{
cartship->clear();
cartship->addItem(tr("(No Shipping)"),-1);
- QList<MShipping>ship=req->getAllShipping();
+ MTGetAllShipping sh=MTGetAllShipping::query();
+ QList<MOShipping>ship=sh.getshipping();
for(int i=0;i<ship.size();i++)
- cartship->addItem(ship[i].description(),ship[i].id());
+ cartship->addItem(ship[i].description(),(int)ship[i].id());
}
void MOverview::updateUsers()
{
- QList<MUser>usl=req->getAllUsers();
+ MTGetAllUsers au=req->queryGetAllUsers();
+ if(au.hasError())return;
+ QList<MOUser>usl=au.getusers();
usermodel->clear();
usermodel->insertColumns(0,2);
usermodel->insertRows(0,usl.size());
usermodel->setHorizontalHeaderLabels(QStringList()<<tr("Login Name")<<tr("Description"));
for(int i=0;i<usl.size();i++){
- usermodel->setData(usermodel->index(i,0),usl[i].userId());
- usermodel->setData(usermodel->index(i,1),usl[i].description());
+ usermodel->setData(usermodel->index(i,0),usl[i].name().value());
+ usermodel->setData(usermodel->index(i,1),usl[i].description().value());
}
usertable->resizeColumnsToContents();
}
//get password
QString pwd=QInputDialog::getText(this,tr("Password"),tr("Please enter an initial password for the user:"),QLineEdit::Password);
//send request
- MUser(req,name).create(pwd);
+ req->queryCreateUser(name,pwd);
//update display
updateUsers();
}
QString rp=QInputDialog::getItem(this,tr("Delete User"),tr("Select which user will inherit this users database objects:"),rplc,0,false,&ok);
if(!ok)return;
//delete
- QString ret=MUser(req,name).deleteUser(rp);
- if(ret!="")
- QMessageBox::warning(this,tr("Error"),tr("Cannot delete user: %1").arg(ret));
+ MTDeleteUser ret=req->queryDeleteUser(name,rp);
+ if(ret.hasError())
+ QMessageBox::warning(this,tr("Error"),tr("Cannot delete user: %1").arg(ret.errorString()));
updateUsers();
}
bool ok;
descr=QInputDialog::getText(this,tr("Edit Description"),tr("Descriptionof user %1:").arg(name),QLineEdit::Normal,descr,&ok);
if(ok)
- MUser(req,name).setDescription(descr);
+ req->querySetUserDescription(name,descr);
//update
updateUsers();
}
<ToXml name="Short">orderid customerid seller amountpaid state amountdue</ToXml>
<ToXml name="Full">orderid customerid seller amountpaid state amountdue tickets/inOrder vouchers/inOrder</ToXml>
</Class>
+
+ <Class name="Shipping">
+ <Property name="id" type="int32" id="yes"/>
+ <Property name="cost" type="int32"/> <!--default cost of this shipping type-->
+ <Property name="canuseweb" type="bool"/> <!--is offered on web interface-->
+ <Property name="canallusers" type="bool"/> <!--all GUI users may select it-->
+ <Property name="description" type="string"/>
+ <Mapping table="shipping">
+ <Map column="shipid" property="id"/>
+ <Map column="cost"/>
+ <Map column="canuseweb"/>
+ <Map column="canallusers"/>
+ <Map column="description"/>
+ </Mapping>
+ <ToXml name="Full">id cost canuseweb canallusers description</ToXml>
+ </Class>
+
+ <Transaction name="GetAllShipping">
+ <Input/>
+ <Output>
+ <Var name="shipping" type="List:Shipping/Full"/>
+ </Output>
+ </Transaction>
</Wolf>
\ No newline at end of file
<Property name="name" type="astring"/>
<Property name="password" type="string"/>
<Property name="description" type="string"/>
+
+ <ToXml name="Full">name password description</ToXml>
+ <ToXml name="NoPwd">name description</ToXml>
</Class>
+
+ <Transaction name="GetAllUsers">
+ <Input/>
+ <Output>
+ <Var name="users" type="List:User/NoPwd"/>
+ </Output>
+ </Transaction>
+
+ <Transaction name="CreateUser">
+ <Input>
+ <Var name="username" type="astring"/>
+ <Var name="password" type="string"/>
+ </Input>
+ <Output/>
+ </Transaction>
+
+ <Transaction name="DeleteUser">
+ <Input>
+ <Var name="username" type="astring"/>
+ <Var name="mergewithuser" type="astring"/>
+ </Input>
+ </Transaction>
+
+ <Transaction name="SetUserDescription">
+ <Input>
+ <Var name="username" type="astring"/>
+ <Var name="description" type="string"/>
+ </Input>
+ </Transaction>
</Wolf>
\ No newline at end of file