From 9c835ef2d47b0c0efea1537e0a5c9075b9166f13 Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 27 Mar 2009 15:44:55 +0000 Subject: [PATCH] some more fixes and transactions, does still not compile git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@281 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/overview.cpp | 37 +++++++++++++++++++++---------------- wob/event.wolf | 8 ++++++++ wob/order.wolf | 23 +++++++++++++++++++++++ wob/user.wolf | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 16 deletions(-) diff --git a/src/overview.cpp b/src/overview.cpp index 2e4e4a0..25ec877 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -20,8 +20,8 @@ #include "orderwin.h" #include "overview.h" -#include "user.h" -#include "host.h" +//#include "user.h" +//#include "host.h" #include #include @@ -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); - QListship=req->getAllShipping(); + MTGetAllShipping sh=MTGetAllShipping::query(); + QListship=sh.getshipping(); for(int i=0;iaddItem(ship[i].description(),ship[i].id()); + cartship->addItem(ship[i].description(),(int)ship[i].id()); } void MOverview::updateUsers() { - QListusl=req->getAllUsers(); + MTGetAllUsers au=req->queryGetAllUsers(); + if(au.hasError())return; + QListusl=au.getusers(); usermodel->clear(); usermodel->insertColumns(0,2); usermodel->insertRows(0,usl.size()); usermodel->setHorizontalHeaderLabels(QStringList()<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(); } diff --git a/wob/event.wolf b/wob/event.wolf index 0cb4a3f..b513865 100644 --- a/wob/event.wolf +++ b/wob/event.wolf @@ -64,4 +64,12 @@ + + + + + + + + \ No newline at end of file diff --git a/wob/order.wolf b/wob/order.wolf index fbcc7b7..08702fb 100644 --- a/wob/order.wolf +++ b/wob/order.wolf @@ -144,4 +144,27 @@ orderid customerid seller amountpaid state amountdue orderid customerid seller amountpaid state amountdue tickets/inOrder vouchers/inOrder + + + + + + + + + + + + + + + id cost canuseweb canallusers description + + + + + + + + \ No newline at end of file diff --git a/wob/user.wolf b/wob/user.wolf index 2c25549..8638141 100644 --- a/wob/user.wolf +++ b/wob/user.wolf @@ -76,5 +76,37 @@ + + name password description + name description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 1.7.2.5