Ejemplo n.º 1
0
        private void UpdateRemoteListview(int devnum)
        {
            CNetData tmpdata = new CNetData();

            //发送清除列表命令
            tmpdata.cmdCommand = Command.ClearStudent;
            tmpdata.intDevnum  = devnum;
            Server.SendData(devnum, tmpdata);
            tmpdata.Clear();
            System.Threading.Thread.Sleep(5);

            for (int i = 0; i < ((CStuDevlist)model.devmanager.DevList[devnum]).StudentList.Count; i++)
            {
                tmpdata.cmdCommand = Command.AddStudent;
                tmpdata.strZjbh    = ((CStudent)((CStuDevlist)model.devmanager.DevList[devnum]).StudentList[i]).zkzmbh;
                tmpdata.Xm         = ((CStudent)((CStuDevlist)model.devmanager.DevList[devnum]).StudentList[i]).xm;
                tmpdata.intDevnum  = devnum;
                Server.SendData(devnum, tmpdata);
                tmpdata.Clear();
                System.Threading.Thread.Sleep(20);
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }