some more fixes and transactions, does still not compile
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 27 Mar 2009 15:44:55 +0000 (15:44 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 27 Mar 2009 15:44:55 +0000 (15:44 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@281 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

src/overview.cpp
wob/event.wolf
wob/order.wolf
wob/user.wolf

index 2e4e4a0..25ec877 100644 (file)
@@ -20,8 +20,8 @@
 #include "orderwin.h"
 #include "overview.h"
 
-#include "user.h"
-#include "host.h"
+//#include "user.h"
+//#include "host.h"
 
 #include <QApplication>
 #include <QBoxLayout>
@@ -456,15 +456,17 @@ void MOverview::eventCancel()
        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()));
        }
 }
 
@@ -472,21 +474,24 @@ void MOverview::updateShipping()
 {
        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();
 }
@@ -508,7 +513,7 @@ void MOverview::newUser()
        //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();
 }
@@ -531,9 +536,9 @@ void MOverview::deleteUser()
        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();
 }
 
@@ -549,7 +554,7 @@ void MOverview::editUserDescription()
        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();
 }
index 0cb4a3f..b513865 100644 (file)
                        <Var name="events" type="List:Event/Full"/>
                </Output>
        </Transaction>
+       
+       <Transaction name="CancelEvent">
+               <Input>
+                       <Var name="eventid" type="int"/>
+                       <Var name="reason" type="string"/>
+               </Input>
+               <Output/>
+       </Transaction>
 </Wolf>
\ No newline at end of file
index fbcc7b7..08702fb 100644 (file)
                <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
index 2c25549..8638141 100644 (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