//对应菜单项删除考生事件处理 public void Menu_del(int devnum, string zkzhm) { CStudent stu = model.devmanager.GetStudent(devnum, zkzhm); if (stu != null) { DisplayStrings.DeleteString(stu.DisplayString(devnum)); } model.devmanager.DeleteStudent(devnum, zkzhm); mainform.UpdateStudentlist(devnum, (CStuDevlist)model.devmanager.DevList[devnum]); CStudent stu2and3; for (int i = 1; i < 3; i++) { stu2and3 = model.devmanager.GetStudent(devnum, i); if (stu2and3 != null) { DisplayStrings.AddString(stu2and3.DisplayString(devnum), "排队"); } else { break; } } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); //删除对应的远端设备列表中的排队考生 CNetData tmpdata = new CNetData(); tmpdata.cmdCommand = Command.DeleteStudent; tmpdata.intDevnum = devnum; tmpdata.strZjbh = zkzhm; Server.SendData(devnum, tmpdata); }
private void Server_Event_Devlogout(int devnum) { CStuDevlist tmpDevList = (CStuDevlist)(model.devmanager.DevList[devnum]); if (tmpDevList == null) { return; } for (int i = 0; i < ((CStuDevlist)(model.devmanager.DevList[devnum])).Stumum; i++) { CStudent stu = model.devmanager.GetStudent(devnum, i); if (stu != null) { DisplayStrings.DeleteString(stu.DisplayString(devnum)); } } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); mainform.ReUpdateStuColor(devnum); mainform.ChangeDevStatus(devnum, DevStatus.未连接); }
//对应菜单项清除所有考生事件处理 public void Menu_clear(int devnum) { for (int i = 0; i < ((CStuDevlist)(model.devmanager.DevList[devnum])).Stumum; i++) { CStudent stu = model.devmanager.GetStudent(devnum, i); if (stu != null) { DisplayStrings.DeleteString(stu.DisplayString(devnum)); } } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); model.devmanager.ClearStudent(devnum); mainform.UpdateStudentlist(devnum, (CStuDevlist)model.devmanager.DevList[devnum]); //清除对应的远端设备列表中的排队考生 CNetData tmpdata = new CNetData(); tmpdata.cmdCommand = Command.ClearStudent; tmpdata.intDevnum = devnum; Server.SendData(devnum, tmpdata); }
private void Server_Event_Devnetdata(CNetData data) { CNetData tmpdata = new CNetData(); switch (data.cmdCommand) { case Command.GetStudent: CStudent stu = model.devmanager.GetStudent(data.intDevnum); if (stu != null) { tmpdata.Clear(); tmpdata.cmdCommand = Command.Zkzhm; tmpdata.strZjbh = stu.zkzmbh; Server.SendData(data.intDevnum, tmpdata); mainform.ChangeDevStatus(data.intDevnum, DevStatus.身份验证); mainform.UpdateStuColor(data.intDevnum); if (DisplayStrings.GetValue(stu.DisplayString(data.intDevnum)) == null) { DisplayStrings.AddString(stu.DisplayString(data.intDevnum), "考试"); } else { DisplayStrings.UpdateString(stu.DisplayString(data.intDevnum), "考试"); } CVoice.Play(stu.DisplayString(data.intDevnum) + "考试。"); CStudent stu2 = model.devmanager.GetStudent(data.intDevnum, 1); if (stu2 != null) { DisplayStrings.AddString(stu2.DisplayString(data.intDevnum), "排队"); //CVoice.Play(stu2.DisplayString(data.intDevnum) + "排队。"); } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); } break; case Command.Ksks: if (mainform.GetDeviceStatus(data.intDevnum) != DevStatus.正在考试) { mainform.ChangeDevStatus(data.intDevnum, DevStatus.正在考试); //把设备列表中第一个考生显示颜色改为红色,表示正在考试 mainform.UpdateStuColor(data.intDevnum); CStudent stu1 = model.devmanager.GetStudent(data.intDevnum, 0); if (stu1 != null) { DisplayStrings.DeleteString(stu1.DisplayString(data.intDevnum)); } CStudent stu2and3; for (int i = 1; i < 3; i++) { stu2and3 = model.devmanager.GetStudent(data.intDevnum, i); if (stu2and3 != null) { DisplayStrings.AddString(stu2and3.DisplayString(data.intDevnum), "排队"); } else { break; } } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); } break; case Command.Kswc: mainform.ChangeDevStatus(data.intDevnum, DevStatus.设备就绪); mainform.ReUpdateStuColor(data.intDevnum); //把设备列表中第一个考生删除掉 mainform.DeleteFirstStudent(data.intDevnum); tmpdata.Clear(); tmpdata.cmdCommand = Command.DeleteStudent; tmpdata.intDevnum = data.intDevnum; tmpdata.strZjbh = data.strZjbh; Server.SendData(data.intDevnum, tmpdata); break; case Command.Jjks: System.Windows.Forms.MessageBox.Show("考生" + ((CStudent)(model.devmanager.GetStudent(data.intDevnum))).zkzmbh + "被" + data.intDevnum.ToString() + "号考库拒绝!"); mainform.ReUpdateStuColor(data.intDevnum); CStudent stu3 = model.devmanager.GetStudent(data.intDevnum, 0); if (stu3 != null) { DisplayStrings.UpdateString(stu3.DisplayString(data.intDevnum), "排队"); } //displaycomm.ShowText(DisplayStrings.GetAllStrings()); mainform.ChangeDevStatus(data.intDevnum, DevStatus.设备就绪); ////把设备列表中第一个考生删除掉 //mainform.DeleteFirstStudent(data.intDevnum); ////删除对应的远端设备列表中的排队考生 //tmpdata.Clear(); //tmpdata.cmdCommand = Command.DeleteStudent; //tmpdata.intDevnum = data.intDevnum; //tmpdata.strZjbh = data.strZjbh; //Server.SendData(data.intDevnum, tmpdata); break; case Command.Updatelist: //同步更新远程设备排队考生列表 UpdateRemoteListview(data.intDevnum); break; } }