private void handle_event()
        {
            IntelligentEvent evt = MiddleWareCore.get_a_event();

            if (evt != null)
            {
                IntelligentEvent IEvent         = (IntelligentEvent)evt;
                string           epcID          = IEvent.epcID;
                string           remoteDeviceID = IEvent.remoteDeviceID;
                string           check_time     = IEvent.time_stamp;
                string           studentName    = string.Empty;
                string           question_value = IEvent.questionValue.ToUpper();;

                //终端发送的答案必须符合要求 A B C 或者 D

                if (question_value != "A" && question_value != "B" && question_value != "C" && question_value != "D")
                {
                    return;
                }

                //1 更改本地信息
                //2 更改饼图
                //3 更改座位状态

                int totalCount = MemoryTable.studentInfoTable.Rows.Count;

                Person            person = MemoryTable.getPersonByEpc(epcID);
                equipmentPosition ep     = MemoryTable.getEquipmentConfigMapInfoByDeviceID(remoteDeviceID);
                if (ep != null)
                {
                    if (IEvent.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0)
                    {
                        ////这里要处理一下同一个学生用不一个设备发送答案的情况
                        equipmentPosition ep_old = MemoryTable.getEquipmentInfoByEpc(epcID);
                        this.setChairState(ep_old, DocumentFileState.InitialState, "");
                        MemoryTable.clearEquipmentAndStudentCombining(epcID);
                    }

                    if (person != null)
                    {
                        studentName = person.name;
                        this.setChairState(ep, studentName);
                        MemoryTable.setEquipmentInfoCombineStudentID(ep, person.epc);
                        this.setPersonAnswer(person.id_num, question_value);
                    }


                    DocumentFileState dfs = this.getStateByAnswer(question_value);
                    this.setChairState(ep, dfs);

                    this.refreshPie();
                }
            }
        }
Exemplo n.º 2
0
        private void handle_event()
        {
            IntelligentEvent evt = MiddleWareCore.get_a_event();

            if (evt != null)
            {
                IntelligentEvent p              = (IntelligentEvent)evt;
                string           epcID          = p.epcID;
                string           remoteDeviceID = p.remoteDeviceID;
                string           studentName    = string.Empty;
                bool             bRefresh_ui    = false;

                Person            person = MemoryTable.getPersonByEpc(epcID);
                equipmentPosition ep     = MemoryTable.getEquipmentConfigMapInfoByDeviceID(remoteDeviceID);
                if (person != null && ep != null)
                {
                    if (p.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0)//重复考勤
                    {
                        ////这里要处理一下同一个学生用不一个设备发送答案的情况
                        equipmentPosition ep_old = MemoryTable.getEquipmentInfoByEpc(epcID);
                        this.setChairState(ep_old, DocumentFileState.InitialState, "");
                        MemoryTable.clearEquipmentAndStudentCombining(epcID);

                        bRefresh_ui = true;
                    }
                    if (p.event_unit_list.IndexOf(IntelligentEventUnit.new_epc) >= 0)//第一次考勤
                    {
                        //更新考勤信息
                        this.addStudentRecord(person.id_num, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        bRefresh_ui = true;
                    }
                    if (bRefresh_ui == true)
                    {
                        if (person != null)
                        {
                            studentName = person.name;
                            this.setChairState(ep, studentName);
                            MemoryTable.setEquipmentInfoCombineStudentID(ep, person.epc);
                        }
                        this.refreshPie();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void handle_event()
        {
            IntelligentEvent evt = MiddleWareCore.get_a_event();

            if (evt != null)
            {
                deleControlInvoke dele = delegate(object o)
                {
                    IntelligentEvent p              = (IntelligentEvent)o;
                    string           epcID          = p.epcID;
                    string           remoteDeviceID = p.remoteDeviceID;
                    string           question_value = p.questionValue;
                    int totalCount = MemoryTable.studentInfoTable.Rows.Count;

                    Person            person = MemoryTable.getPersonByEpc(epcID);
                    equipmentPosition ep     = MemoryTable.getEquipmentConfigMapInfoByDeviceID(remoteDeviceID);
                    //如果只是重复发送,不需要做什么
                    if (p.event_unit_list.IndexOf(IntelligentEventUnit.repeat_epc) >= 0)
                    {
                        //如果重复发送之外,还改变了设备的ID
                        if (p.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0)
                        {
                            if (person != null && ep != null)
                            {
                                int groupIndex = ep.group;

                                equipmentPosition ep_old = MemoryTable.getEquipmentInfoByEpc(epcID);
                                Program.frmClassRoom.changeChairState(ep_old.group, ep_old.formatedPosition(), DocumentFileState.InitialState);
                                Program.frmClassRoom.changeChairState(ep_old.group, ep_old.formatedPosition(), "");
                                MemoryTable.clearEquipmentAndStudentCombining(epcID);

                                Program.frmClassRoom.changeChairState(groupIndex, ep.formatedPosition(), person.name);
                                MemoryTable.setEquipmentInfoCombineStudentID(ep, person.epc);

                                Program.frmClassRoom.changeChairState(groupIndex, ep.formatedPosition(), DocumentFileState.Green);
                            }
                        }
                        //如果重复发送之外,还改变了问题的答案,按照设计,这里不需要更改饼图
                        if (p.event_unit_list.IndexOf(IntelligentEventUnit.change_answer) >= 0)
                        {
                            this.refreshAnswerRecord(person, question_value);
                        }
                    }
                    else
                    if (p.event_unit_list.IndexOf(IntelligentEventUnit.new_epc) >= 0)
                    {
                        //处理该事件需要更新数据和显示页面
                        if (person != null && ep != null)
                        {
                            MemoryTable.setEquipmentInfoCombineStudentID(ep, epcID);
                            Program.frmClassRoom.changeChairState(ep.group, ep.formatedPosition(), DocumentFileState.Green);
                            Program.frmClassRoom.changeChairState(ep.group, ep.formatedPosition(), person.name);
                        }

                        this.refreshAnswerRecord(person, question_value);
                        this.refreshPie();
                    }
                };

                this.Invoke(dele, evt);
            }
        }