/*************ClientP: Delete Acc******************/ void MainWindow::on_btnDC_clicked() { QMessageBox message(QMessageBox::Warning,"Are you sure?","Once it did, it can not be undo!",QMessageBox::Yes|QMessageBox::No,NULL); if (message.exec()==QMessageBox::Yes) { showme("yes!"); Msg msg=sendAndGet(userName_,userPassword_,"dc","","","","","",""); bool flag=msg.opResult; if(!flag){ showme("Error in delete User"); } ui->stackedWidget->setCurrentIndex(0); ui->widgetWelcome->show(); ui->widgetLog->hide(); QDesktopWidget* desktopWidget = QApplication::desktop(); int winWidth=desktopWidget->screenGeometry().width(); int winHeight=desktopWidget->screenGeometry().height(); QRect winRect((winWidth-400)/2,(winHeight-300)/2,400,300); this->setGeometry(winRect); this->setFixedSize(400,300); userName_=""; userPassword_=""; } else { showme("no!"); } }
/*************ClientP: query: selcect filter******************/ void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1) { string selector=arg1.toStdString(); ui->widgetTitleInput->hide(); ui->widgetTimeInput->hide(); list<Meeting> m; if(selector=="All"){ showme("all"); Msg msg=sendAndGet(userName_,"","la","","","","","",""); m=msg.meetingList; printMeetings(m,ui->tBTitle,ui->tBSponsor,ui->tBParticipator,ui->tBStartTime,ui->tBEndTime); }else if(selector=="As Sponsor"){ showme("sp"); Msg msg=sendAndGet(userName_,"","las","","","","","",""); m=msg.meetingList; printMeetings(m,ui->tBTitle,ui->tBSponsor,ui->tBParticipator,ui->tBStartTime,ui->tBEndTime); }else if(selector=="As Participator"){ showme("pa"); Msg msg=sendAndGet(userName_,"","lap","","","","","",""); m=msg.meetingList; printMeetings(m,ui->tBTitle,ui->tBSponsor,ui->tBParticipator,ui->tBStartTime,ui->tBEndTime); }else if(selector=="Title"){ ui->widgetTitleInput->show(); }else if(selector=="Time Interval"){ ui->widgetTimeInput->show(); } }
int main(){ std::cout << a <<"\n"; showme(); return 0; }
/*************ClientP: query: query by time interval******************/ void MainWindow::on_btnGo_clicked() { string sTime = ui->timeInputFrom->dateTime().toString("yyyy-MM-dd/hh:mm").toStdString(); string eTime = ui->timeInputTo->dateTime().toString("yyyy-MM-dd/hh:mm").toStdString(); showme(sTime); showme(eTime); Date sDate, eDate; sDate = Date::stringToDate(sTime); eDate = Date::stringToDate(eTime); if (sDate >eDate) { cout << "[error] wrong time interval!" << endl; } list<Meeting> m; Msg msg=sendAndGet(userName_,"","qt","","",sTime,eTime,"",""); m=msg.meetingList; printMeetings(m,ui->tBTitle,ui->tBSponsor,ui->tBParticipator,ui->tBStartTime,ui->tBEndTime); }
/*************ClientP: query: query by title******************/ void MainWindow::on_btnGo_2_clicked() { string title =ui->lineEditTitle->text().toStdString(); showme(title); list<Meeting> m; Msg msg=sendAndGet(userName_,"","qm","",title,"","","",""); m=msg.meetingList; printMeetings(m,ui->tBTitle,ui->tBSponsor,ui->tBParticipator,ui->tBStartTime,ui->tBEndTime); }