void ActionClientUpdata::DoAction(int &key) { Control *pUpdata; Control *pNotic; if (ClientForm::pTable1->pNode == NULL) { pNotic = new Notic(pWin->GetHandle(),5,30,9,17,(char *)"请先选定一条记录",5); pNotic->show(); usleep(1000000); wclear(pNotic->GetHandle()); wrefresh(pNotic->GetHandle()); delete pNotic; return; } pUpdata = new ClientUserUpdata(19,61,2,4,1); pUpdata->show(); pUpdata->KeyListen(key); if (key == 1) { pNotic = new Notic(pUpdata->GetHandle(),5,26,8,18,(char *)"修改成功,请稍候",5); pNotic->show(); usleep(1000000); delete pNotic; } pWin->show(); ClientForm::pTable1->UpdataTable(); key = 10; delete pUpdata; }
void ActionClientRemove::DoAction(int &key) { Control *pRemove; Control *pNotic; if (ClientForm::pTable1->pNode == NULL || ClientForm::pTable1->sum == 0) { pNotic = new Notic(pWin->GetHandle(),5,30,9,17,(char *)"请先选定一条记录",5); pNotic->show(); usleep(1000000); wclear(pNotic->GetHandle()); wrefresh(pNotic->GetHandle()); delete pNotic; return; } pRemove = new ClientUserRemove(10,30,8,21,1); pRemove->show(); pRemove->KeyListen(key);// 是否确定删除记录的键盘监听,key返回值来判断确定与否 if (key == 1) { pNotic = new Notic(pRemove->GetHandle(),3,18,1,6,(char *)"删除成功,请稍候",5); pNotic->show(); usleep(1000000); delete pNotic; pWin->show(); ClientForm::pTable1->count = ClientForm::pTable1->count-1; ClientForm::pTable1->sum = ClientForm::pTable1->sum-1;//总记录数减少一条 if(ClientForm::pTable1->count == 0) { ClientForm::pTable1->count=1; } ClientForm::pTable1->UpdataTable();// 更新表中的记录 } else { pWin->show(); ClientForm::pTable1->show(); ClientForm::pTable1->pNode->SelectFocus(); } key = 10; delete pRemove; }
void ActionClientAdd::DoAction(int &key) { Control *pAdd; Control *pNotic; pAdd = new ClientUserAdd(19,61,2,4,1); pAdd->show(); pAdd->KeyListen(key); if (key == 1) { pNotic = new Notic(pAdd->GetHandle(),5,26,7,18,(char *)"增加成功,请稍候",5); pNotic->show(); usleep(1000000); delete pNotic; if (ClientForm::pTable1->sum != 0) { ClientForm::pTable1->sum = ClientForm::pTable1->sum + 1; } } pWin->show(); ClientForm::pTable1->UpdataTable(); key = 10; delete pAdd; }