private void ShowPerson() { DataTable myData = StudentManagement.GetPersonDataTable(); dataGridView1.DataSource = myData; int iNumberofStudents = myData.Rows.Count; this.groupBox2.Text = "学生列表 共有学生" + iNumberofStudents.ToString() + "名"; this.dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); int headerW = this.dataGridView1.RowHeadersWidth; int columnsW = 0; DataGridViewColumnCollection columns = this.dataGridView1.Columns; for (int i = 0; i < columns.Count; i++) { columnsW += columns[i].Width; } if (columnsW + headerW < this.dataGridView1.Width) { int leftTotalWidht = this.dataGridView1.Width - columnsW - headerW; int eachColumnAddedWidth = leftTotalWidht / columns.Count; for (int i = 0; i < columns.Count; i++) { columns[i].Width += eachColumnAddedWidth; } } MiddleWareCore.set_mode(MiddleWareMode.学生卡绑定, this); }
void test_实时互动1() { //接收到一个标签数据 MiddleWareCore.set_mode(MiddleWareMode.实时互动); string cmd1 = "[select,master_node,equip000001,stu000001,01,A]"; MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd1)); IntelligentEvent evt1 = MiddleWareCore.get_a_event(); if (evt1.epcID == "stu000001" && evt1.localDeviceID == "master_node" && evt1.remoteDeviceID == "equip000001" && evt1.questionID == "01" && evt1.questionValue == "A" && evt1.event_unit_list[0] == IntelligentEventUnit.new_epc) { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } //找到该学生的信息,包括学生姓名、位置、选择 //查找学生信息 Person person = MemoryTable.getPersonByEpc(evt1.epcID); if (person.id_num == "CE4D9397871") { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } }
DocumentFile docLink = null;//暂存点击到的位置的链接 public frmEquipmentConfig() { InitializeComponent(); //this.numCountofGroup.Value = (decimal)this.ctl.getClassroomConfig(0); this.numCountofGroup.Value = (decimal)this.configCtl.GetGroupCount(); //this.numCountofRow.Value = (decimal)this.ctl.getClassroomConfig(1); //this.numCountofColumn.Value = (decimal)this.ctl.getClassroomConfig(2); if (MemoryTable.isInitialized == false) { MemoryTable.initializeTabes(); } this.dtRoomConfig = MemoryTable.dtRoomConfig; //dtRoomConfig = this.configCtl.getAllRoomConfigInfo(); //dtRoomConfig.Columns.Add("totalColumn", typeof(int)); //dtRoomConfig.Columns["totalColumn"].Expression = "Sum(ICOLUMN)"; //dtRoomConfig.Columns.Add("maxGroup", typeof(int)); //dtRoomConfig.Columns["maxGroup"].Expression = "Max(IGROUP)"; this.Shown += new EventHandler(frmEquipmentConfig_Shown); this.FormClosing += new FormClosingEventHandler(frmEquipmentConfig_FormClosing); this.FormClosed += new FormClosedEventHandler(frmEquipmentConfig_FormClosed); MiddleWareCore.set_mode(MiddleWareMode.设备绑定); MiddleWareCore.event_receiver = this; }
void Form1_FormClosing(object sender, FormClosingEventArgs e) { //保存考勤信息 if (this.SaveCheckInfo()) { } MiddleWareCore.set_mode(MiddleWareMode.无); }
private void pbTest_Click(object sender, EventArgs e) { //Program.frmTest.Show(); frmRTTest frm = new frmRTTest(); MiddleWareCore.set_mode(MiddleWareMode.课堂测验); frm.ShowDialog(); }
// 291,147 #endregion #region 初始化 public frmSelect() { InitializeComponent(); this.form_initial_width = this.Width; this.right_groups_initial_left = this.groupBox_command.Left; this.right_groups_initial_width = this.groupBox_command.Width; this.form_initial_heigth = this.Height; this.shown_width = this.right_groups_initial_width + 15; this.shown_heigth = this.groupBox_command.Height + this.groupPie.Height + 30; //this.btn1.BackColor = this.clrNotKnown; //this.btn2.BackColor = this.clrA; //this.btn3.BackColor = this.clrB; //this.btn4.BackColor = this.clrC; //this.btn5.BackColor = this.clrD; //this.initialInfoTable(); //InitializePanelControl(); //InitialClassRoom(); //this.groupBoxChair.Visible = fals; bSeatVisible = true; this.groupBoxChair.Visible = false; //this.btnHideSeat.Text = "显示座位(&S)"; this.Width = this.shown_width; this.Height = this.shown_heigth; this.Left = this.Left + this.form_initial_width - this.shown_width; this.groupPie.Left = 5; this.groupBox_command.Left = 5; //this.groupPie.Left = 5; //this.btnMin.Left = this.Width - 100 - 5; //this.btnClearState.Left = this.btnMin.Left - 100; //this.btnQuit.Left = this.Width - 10 - this.btnQuit.Width; Screen[] screens = System.Windows.Forms.Screen.AllScreens; for (int i = 0; i < screens.Length; i++) { Screen sc = screens[i]; if (sc.Primary == true) { Rectangle rect = sc.WorkingArea; //this.Left = (int)(rect.Width * 0.7); this.Top = (int)(rect.Height * 0.1); } } this.initialInfoTable(); InitializePanelControl(); InitialClassRoom(); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); this.FormClosed += new FormClosedEventHandler(frmSelect_FormClosed); this.VisibleChanged += new EventHandler(frmSelect_VisibleChanged); MiddleWareCore.event_receiver = this; MiddleWareCore.set_mode(MiddleWareMode.即时互动); }
private void button1_Click(object sender, EventArgs e) { frmCheckInitctl.insert_record(this.lblCheckGuid.Text, this.dtpStart.Text, this.dtpEnd.Text, this.txtInfo.Text, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); frmCheck check = new frmCheck(this.lblCheckGuid.Text, this.dtpStart.Text, this.dtpEnd.Text); check.ShowDialog(); MiddleWareCore.set_mode(intelligentMiddleWare.MiddleWareMode.考勤); this.Close(); }
void Form1_VisibleChanged(object sender, EventArgs e) { this.Top = Program.frmFloat.Height + Program.frmFloat.Top; this.Left = Program.frmFloat.Left; if (this.Visible == true) { this.clearSelectStatus(); MiddleWareCore.set_mode(MiddleWareMode.无, this); } }
public void prepare_handler() { this.initialInfoTable(); MiddleWareCore.set_mode(MiddleWareMode.课堂测验, this); Program.frmFloat.setLegend(this.textList, this.styleList); Program.frmClassRoom.setCallBackInvoker(this);//点击座位时的回调 Program.frmClassRoom.resetClassRoomState(); setPieToInitializeState(); this.Show(); }
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(); } } }
//设置当前题目的答题状态,包括作为和饼图 void reset_test_status() { DataRow[] rows = this.dtQuestion_answer_record.Select(string.Format("question_id = '{0}'", current_question_id)); int total_student_count = this.studentInfoTable.Rows.Count; int iAnswered = rows.Length; int iUnknown = total_student_count - iAnswered; string strUnknown = iUnknown.ToString(); string strAnswered = iAnswered.ToString(); m_panelDrawing.Values = new decimal[] { iUnknown, iAnswered }; m_panelDrawing.Texts = new string[] { iUnknown.ToString(), iAnswered.ToString() }; MiddleWareCore.set_mode(MiddleWareMode.课堂测验); //for (int j = 0; j < this.studentInfoTable.Rows.Count; j++) //{ // DataRow dr = this.studentInfoTable.Rows[j]; // string student_id = dr["STUDENTID"].ToString(); // DataRow[] rowsForDuplicate = this.mapConfigsTable.Select("studenID = '" + student_id + "'"); // if (rowsForDuplicate.Length > 0)//说明已经有过对应 // { // int groupIndex2 = int.Parse(rowsForDuplicate[0]["IGROUP"].ToString()); // Carbinet _carbinet2 = this.groups[groupIndex2]; // _carbinet2.setDocBGImage((string)rowsForDuplicate[0]["EQUIPEMNTID"], imgNormal); // _carbinet2.setDocText((string)rowsForDuplicate[0]["EQUIPEMNTID"], ""); // rowsForDuplicate[0]["studenID"] = ""; // } //} //for (int i = 0; i < rows.Length; i++) //{ // string student_id = rows[i]["student_id"].ToString(); // rows = this.studentInfoTable.Select("STUDENTID = '" + student_id + "'"); // rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); // if (rows.Length > 0 && rowsMap.Length > 0) // { // string answer = question_value; // int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); // studentName = (string)rows[0]["NAME"]; // Carbinet _carbinet = this.groups[groupIndex]; // _carbinet.setDocText(remoteDeviceID, studentName); // //这里要处理一下同一个学生用不一个设备发送答案的情况 // // 根据就是每一次客户端发送信息时,服务端都要把发送过来的标签和设备重新绑定一次 // // 如果之前绑定过并且和现在的不同,则说明该标签之前用别的设备发送过信息 // rowsMap[0]["studenID"] = epcID;//这里把设备和标签绑定到一起 // _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); // } //} }
public void prepare_handler() { MiddleWareCore.set_mode(MiddleWareMode.考勤, this); Program.frmFloat.setLegend(this.textList, this.styleList); initialInfoTable(); setPieToInitializeState(); Program.frmClassRoom.resetClassRoomState(); Program.frmClassRoom.setCallBackInvoker(this);//点击座位时的回调 this.formToNotify.show_tip("正在考勤"); }
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; this.txtEpc.Text = epcID; }; this.Invoke(dele, evt); } }
void handle_event() { IntelligentEvent evt = MiddleWareCore.get_a_event(); if (evt != null) { deleControlInvoke dele = delegate(object o) { IntelligentEvent p = (IntelligentEvent)o; string remoteDeviceID = p.remoteDeviceID; this.txtEquipmentID.Text = remoteDeviceID; }; this.Invoke(dele, evt); } }
private void ShowPerson() { DataTable myData = rfidCheck_CheckOn.GetPersonDataSet(); //if (null == myDataSet) //{ // return; //} //dataGridView1.DataSource = myDataSet.Tables[0]; dataGridView1.DataSource = myData; int iNumberofStudents = myData.Rows.Count; this.groupBox2.Text = "学生列表 共有学生" + iNumberofStudents.ToString() + "名"; this.dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); int headerW = this.dataGridView1.RowHeadersWidth; int columnsW = 0; DataGridViewColumnCollection columns = this.dataGridView1.Columns; for (int i = 0; i < columns.Count; i++) { columnsW += columns[i].Width; } if (columnsW + headerW < this.dataGridView1.Width) { int leftTotalWidht = this.dataGridView1.Width - columnsW - headerW; int eachColumnAddedWidth = leftTotalWidht / columns.Count; for (int i = 0; i < columns.Count; i++) { columns[i].Width += eachColumnAddedWidth; } } /* * * dataGridView1.Columns[0].HeaderText = "学号"; * dataGridView1.Columns[1].HeaderText = "姓名"; * dataGridView1.Columns[2].HeaderText = "电话"; * dataGridView1.Columns[3].HeaderText = "邮箱"; */ MiddleWareCore.set_mode(MiddleWareMode.学生卡绑定); MiddleWareCore.event_receiver = this; }
void test_实时互动5() { //接收到一个标签数据 MiddleWareCore.set_mode(MiddleWareMode.实时互动); string cmd1 = "[select,master_node,subnode1,,01,A]"; MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd1)); IntelligentEvent evt1 = MiddleWareCore.get_a_event(); if (evt1 == null || evt1.name == IntelligentEvent.event_empty) { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } }
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(); } } } }
void test_实时互动2() { //接收到同一个标签在另一个设备上 MiddleWareCore.set_mode(MiddleWareMode.实时互动); string cmd2_1 = "[select,master_node,subnode1,rfid01,01,A]"; string cmd2_2 = "[select,master_node,subnode2,rfid01,01,A]"; MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd2_2)); MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd2_1)); IntelligentEvent evt2 = MiddleWareCore.get_a_event(); if (evt2.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0) { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } }
void test_实时互动3() { //标签重复 MiddleWareCore.set_mode(MiddleWareMode.实时互动); string cmd3_1 = "[select,master_node,subnode2,rfid01,01,A]"; string cmd3_2 = "[select,master_node,subnode2,rfid01,01,A]"; MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd3_1)); MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd3_2)); IntelligentEvent evt3 = MiddleWareCore.get_a_event(); if (evt3.event_unit_list.IndexOf(IntelligentEventUnit.repeat_epc) >= 0) { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } }
public frmEquipmentConfig() { InitializeComponent(); this.numCountofGroup.Value = MemoryTable.dtRoomConfig.Rows.Count; setCmbSelectItems((int)this.numCountofGroup.Value); setDefaultCountOfColumnAndRow(); Program.frmClassRoom.resetClassRoomState(); //this.refreshChairEquipmentID(); this.Shown += new EventHandler(frmEquipmentConfig_Shown); this.FormClosing += new FormClosingEventHandler(frmEquipmentConfig_FormClosing); this.numCountofGroup.ValueChanged += new System.EventHandler(this.numCountofGroup_ValueChanged); this.cmbSelectedRow.SelectedIndexChanged += new System.EventHandler(this.cmbSelectedRow_SelectedIndexChanged); this.numCountofRow.ValueChanged += new System.EventHandler(this.numCountofRow_ValueChanged); this.numCountofColumn.ValueChanged += new System.EventHandler(this.numCountofColumn_ValueChanged); MiddleWareCore.set_mode(MiddleWareMode.设备绑定); MiddleWareCore.event_receiver = this; }
//设置当前题目的答题状态 private void reset_test_status(string question_id) { DataRow[] rows = this.dtQuestion_answer_record.Select(string.Format("question_id = '{0}'", question_id)); int total_student_count = MemoryTable.studentInfoTable.Rows.Count; int iAnswered = rows.Length; int iUnknown = total_student_count - iAnswered; NotifyFormToRefreshPie(this.getValueList(iUnknown, iAnswered), true); MiddleWareCore.set_mode(MiddleWareMode.课堂测验); Program.frmClassRoom.resetClassRoomState(); //设置教室座位 根据问题查找学生ID,然后根据ID查找位置 for (int i = 0; i < rows.Length; i++) { string studentID = (string)rows[i]["student_id"]; equipmentPosition ep = MemoryTable.getEquipmentInfoByEpc(studentID); Person psn = MemoryTable.getPersonByEpc(studentID); Program.frmClassRoom.changeChairState(ep.group, ep.formatedPosition(), DocumentFileState.Green); Program.frmClassRoom.changeChairState(ep.group, ep.formatedPosition(), psn.name); } }
private void test_考勤1() { MiddleWareCore.set_mode(MiddleWareMode.考勤); string cmd1 = "[select,master_node,subnode1,rfid01,01,A]"; MiddleWareCore.Set_new_data(ProtocolHelper.getProtocolHelper(cmd1)); IntelligentEvent evt1 = MiddleWareCore.get_a_event(); if (evt1.epcID == "rfid01" && evt1.localDeviceID == "master_node" && evt1.remoteDeviceID == "subnode1" && evt1.questionID == "01" && evt1.questionValue == "A" && evt1.event_unit_list[0] == IntelligentEventUnit.new_epc) { Debug.WriteLine("True"); } else { Debug.WriteLine("False"); } }
public frmCheck() { InitializeComponent(); PieChart1.ItemStyle.SurfaceAlphaTransparency = 0.92F; PieChart1.FocusedItemStyle.SurfaceAlphaTransparency = 0.92F; PieChart1.FocusedItemStyle.SurfaceBrightnessFactor = 0.3F; PieChart1.Inclination = 1.047F; PieChart1.AutoSizePie = true; PieChart1.Thickness = 31; PieChart1.Rotation = 0.1396263F; PieChart1.ShowEdges = false; //PieChart1.Radius = 90F; Screen[] screens = System.Windows.Forms.Screen.AllScreens; for (int i = 0; i < screens.Length; i++) { Screen sc = screens[i]; if (sc.Primary == true) { Rectangle rect = sc.WorkingArea; //this.Left = (int)(rect.Width * 0.7); this.Left = (int)(rect.Width - this.Width - 50); this.Top = (int)(rect.Height * 0.1); } } this.initialInfoTable(); InitializePanelControl(); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); this.FormClosed += new FormClosedEventHandler(Form1_FormClosed); this.VisibleChanged += new EventHandler(Form1_VisibleChanged); MiddleWareCore.set_mode(MiddleWareMode.考勤, this); }
public frmCheck() { InitializeComponent(); this.initialInfoTable(); InitializePanelControl(); InitialClassRoom(); this.Shown += new EventHandler(Form1_Shown); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); this.FormClosed += new FormClosedEventHandler(Form1_FormClosed); this.VisibleChanged += new EventHandler(Form1_VisibleChanged); MiddleWareCore.event_receiver = this; MiddleWareCore.set_mode(MiddleWareMode.考勤); //thread_listening = new Thread(new ThreadStart(begin_wait_event)); //thread_listening.Start(); //backgroundWorker1.DoWork += new DoWorkEventHandler(BackgroundThreadWork); //backgroundWorker1.WorkerSupportsCancellation = true; //this.backgroundWorker1.WorkerReportsProgress = true; //this.backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged); //backgroundWorker1.RunWorkerAsync(null); }
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 check_time = p.time_stamp; string studentName = string.Empty; string question_value = p.questionValue; DataRow[] rows = null; DataRow[] rowsMap = null; DataRow[] rowsUnknown = null; int totalCount = this.studentInfoTable.Rows.Count; //如果只是重复发送,不需要做什么 if (p.event_unit_list.IndexOf(IntelligentEventUnit.repeat_epc) >= 0) { //如果重复发送之外,还改变了设备的ID if (p.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0) { rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); if (rows.Length > 0 && rowsMap.Length > 0) { string answer = question_value; int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); studentName = (string)rows[0]["NAME"]; Carbinet _carbinet = this.groups[groupIndex]; _carbinet.setDocText(remoteDeviceID, studentName); //这里要处理一下同一个学生用不一个设备发送答案的情况 // 根据就是每一次客户端发送信息时,服务端都要把发送过来的标签和设备重新绑定一次 // 如果之前绑定过并且和现在的不同,则说明该标签之前用别的设备发送过信息 DataRow[] rowsForDuplicate = this.mapConfigsTable.Select("studenID = '" + epcID + "'"); if (rowsForDuplicate.Length > 0)//说明已经有过对应,将原来设置的回答状态和学生姓名从座位上去掉 { //if (((string)rowsForDuplicate[0]["EQUIPEMNTID"]) != remoteDeviceID)//根据设备和根据学号找的记录不一样,肯定有重复 { int groupIndex2 = int.Parse(rowsForDuplicate[0]["IGROUP"].ToString()); Carbinet _carbinet2 = this.groups[groupIndex2]; _carbinet2.setDocBGImage((string)rowsForDuplicate[0]["EQUIPEMNTID"], imgNormal); _carbinet2.setDocText((string)rowsForDuplicate[0]["EQUIPEMNTID"], ""); rowsForDuplicate[0]["studenID"] = ""; } } rowsMap[0]["studenID"] = epcID; //这里把设备和标签绑定到一起 _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); _carbinet.setDocText(remoteDeviceID, question_value); //在座位上显示答案 } } //如果重复发送之外,还改变了问题的答案 if (p.event_unit_list.IndexOf(IntelligentEventUnit.change_answer) >= 0) { rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); if (rows.Length > 0) { rows[0]["answer"] = question_value; } //更新答题记录 rows = this.dtQuestion_answer_record.Select(string.Format("student_id = '{0}' and question_id = {1}", epcID, current_question_id)); if (rows.Length > 0) { rows[0]["answer"] = question_value; } else { dtQuestion_answer_record.Rows.Add(new object[3] { epcID, current_question_id, question_value }); } } } else if (p.event_unit_list.IndexOf(IntelligentEventUnit.new_epc) >= 0) { //处理该事件需要更新数据和显示页面 rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); if (rows.Length > 0 && rowsMap.Length > 0) { string answer = question_value; int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); studentName = (string)rows[0]["NAME"]; Carbinet _carbinet = this.groups[groupIndex]; //_carbinet.setDocText(remoteDeviceID, studentName);//在座位上显示学生名字 _carbinet.setDocText(remoteDeviceID, question_value); //在座位上显示答案 rowsMap[0]["studenID"] = epcID; //这里把设备和标签绑定到一起 _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); rows[0]["answer"] = question_value; /* * if (answer == "A") * { * rows[0]["answer"] = "A"; * // _carbinet.setDocBGColor(data.equipmentID, this.clrA); * //_carbinet.setDocBGImage(data.equipmentID, imgA); * } * if (answer == "B") * { * //_carbinet.setDocBGImage(data.equipmentID, imgB); * rows[0]["answer"] = "B"; * } * if (answer == "C") * { * rows[0]["answer"] = "C"; * //_carbinet.setDocBGImage(data.equipmentID, imgC); * //_carbinet.setDocBGColor(data.equipmentID, this.clrC); * } * if (answer == "D") * { * rows[0]["answer"] = "D"; * //_carbinet.setDocBGImage(data.equipmentID, imgD); * //_carbinet.setDocBGColor(data.equipmentID, this.clrD); * } * //*/ //设置饼图 rowsUnknown = this.studentInfoTable.Select("answer = ''"); int iUnknown = rowsUnknown.Length; int iAnswered = totalCount - iUnknown; string strUnknown = iUnknown.ToString(); string strAnswered = iAnswered.ToString(); m_panelDrawing.Values = new decimal[] { iUnknown, iAnswered }; m_panelDrawing.Texts = new string[] { iUnknown.ToString(), iAnswered.ToString() }; } //更新答题记录 rows = this.dtQuestion_answer_record.Select(string.Format("student_id = '{0}' and question_id = '{1}'", epcID, current_question_id)); if (rows.Length > 0) { rows[0]["answer"] = question_value; } else { dtQuestion_answer_record.Rows.Add(new object[3] { epcID, current_question_id, question_value }); } } //switch (p.name) //{ // case IntelligentEvent.class_question_repeat_answer: // //考勤数据和显示页面都不需要更新, // break; // case IntelligentEvent.class_question_new_answer: // //处理该事件需要更新数据和显示页面 // rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); // rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); // if (rows.Length > 0 && rowsMap.Length > 0) // { // string answer = question_value; // int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); // studentName = (string)rows[0]["NAME"]; // Carbinet _carbinet = this.groups[groupIndex]; // _carbinet.setDocText(remoteDeviceID, studentName); // rowsMap[0]["studenID"] = epcID;//这里把设备和标签绑定到一起 // _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); // ///* // if (answer == "A") // { // rows[0]["answer"] = "A"; // // _carbinet.setDocBGColor(data.equipmentID, this.clrA); // //_carbinet.setDocBGImage(data.equipmentID, imgA); // } // if (answer == "B") // { // //_carbinet.setDocBGImage(data.equipmentID, imgB); // rows[0]["answer"] = "B"; // } // if (answer == "C") // { // rows[0]["answer"] = "C"; // //_carbinet.setDocBGImage(data.equipmentID, imgC); // //_carbinet.setDocBGColor(data.equipmentID, this.clrC); // } // if (answer == "D") // { // rows[0]["answer"] = "D"; // //_carbinet.setDocBGImage(data.equipmentID, imgD); // //_carbinet.setDocBGColor(data.equipmentID, this.clrD); // } // //*/ // //设置饼图 // rowsUnknown = this.studentInfoTable.Select("answer = ''"); // int iUnknown = rowsUnknown.Length; // int iAnswered = totalCount - iUnknown; // string strUnknown = iUnknown.ToString(); // string strAnswered = iAnswered.ToString(); // m_panelDrawing.Values = new decimal[] { iUnknown, iAnswered }; // m_panelDrawing.Texts = new string[] { iUnknown.ToString(), iAnswered.ToString() }; // } // //更新答题记录 // rows = this.dtQuestion_answer_record.Select(string.Format("student_id = '{0}' and question_id = '{1}'", epcID, current_question_id)); // if (rows.Length > 0) // { // rows[0]["answer"] = question_value; // } // else // { // dtQuestion_answer_record.Rows.Add(new object[3] { epcID, current_question_id, question_value }); // } // break; // case IntelligentEvent.class_question_repeat_answer_on_another_device: // //数据不需要更新,但是显示页面需要更新 // rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); // rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); // if (rows.Length > 0 && rowsMap.Length > 0) // { // string answer = question_value; // int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); // studentName = (string)rows[0]["NAME"]; // Carbinet _carbinet = this.groups[groupIndex]; // _carbinet.setDocText(remoteDeviceID, studentName); // //这里要处理一下同一个学生用不一个设备发送答案的情况 // // 根据就是每一次客户端发送信息时,服务端都要把发送过来的标签和设备重新绑定一次 // // 如果之前绑定过并且和现在的不同,则说明该标签之前用别的设备发送过信息 // DataRow[] rowsForDuplicate = this.mapConfigsTable.Select("studenID = '" + epcID + "'"); // if (rowsForDuplicate.Length > 0)//说明已经有过对应 // { // //if (((string)rowsForDuplicate[0]["EQUIPEMNTID"]) != remoteDeviceID)//根据设备和根据学号找的记录不一样,肯定有重复 // { // int groupIndex2 = int.Parse(rowsForDuplicate[0]["IGROUP"].ToString()); // Carbinet _carbinet2 = this.groups[groupIndex2]; // _carbinet2.setDocBGImage((string)rowsForDuplicate[0]["EQUIPEMNTID"], imgNormal); // _carbinet2.setDocText((string)rowsForDuplicate[0]["EQUIPEMNTID"], ""); // rowsForDuplicate[0]["studenID"] = ""; // } // } // rowsMap[0]["studenID"] = epcID;//这里把设备和标签绑定到一起 // _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); // } // break; // case IntelligentEvent.class_question_change_answer: // rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); // if (rows.Length > 0) // { // string answer = question_value; // ///* // if (answer == "A") // { // rows[0]["answer"] = "A"; // } // if (answer == "B") // { // rows[0]["answer"] = "B"; // } // if (answer == "C") // { // rows[0]["answer"] = "C"; // } // if (answer == "D") // { // rows[0]["answer"] = "D"; // } // } // //更新答题记录 // rows = this.dtQuestion_answer_record.Select(string.Format("student_id = '{0}' and question_id = {1}", epcID, current_question_id)); // if (rows.Length > 0) // { // rows[0]["answer"] = question_value; // } // else // { // dtQuestion_answer_record.Rows.Add(new object[3] { epcID, current_question_id, question_value }); // } // break; // case IntelligentEvent.class_question_change_answer_on_another_device: // rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); // rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); // if (rows.Length > 0 && rowsMap.Length > 0) // { // string answer = question_value; // int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); // studentName = (string)rows[0]["NAME"]; // Carbinet _carbinet = this.groups[groupIndex]; // _carbinet.setDocText(remoteDeviceID, studentName); // //这里要处理一下同一个学生用不一个设备发送答案的情况 // // 根据就是每一次客户端发送信息时,服务端都要把发送过来的标签和设备重新绑定一次 // // 如果之前绑定过并且和现在的不同,则说明该标签之前用别的设备发送过信息 // DataRow[] rowsForDuplicate = this.mapConfigsTable.Select("studenID = '" + epcID + "'"); // if (rowsForDuplicate.Length > 0)//说明已经有过对应 // { // int groupIndex2 = int.Parse(rowsForDuplicate[0]["IGROUP"].ToString()); // Carbinet _carbinet2 = this.groups[groupIndex2]; // _carbinet2.setDocBGImage((string)rowsForDuplicate[0]["EQUIPEMNTID"], imgNormal); // _carbinet2.setDocText((string)rowsForDuplicate[0]["EQUIPEMNTID"], ""); // rowsForDuplicate[0]["studenID"] = ""; // } // rowsMap[0]["studenID"] = epcID;//这里把设备和标签绑定到一起 // _carbinet.setDocBGImage(remoteDeviceID, imgAnswered); // if (answer == "A") // { // rows[0]["answer"] = "A"; // } // if (answer == "B") // { // rows[0]["answer"] = "B"; // } // if (answer == "C") // { // rows[0]["answer"] = "C"; // } // if (answer == "D") // { // rows[0]["answer"] = "D"; // } // } // //更新答题记录 // rows = this.dtQuestion_answer_record.Select(string.Format("student_id = '{0}' and question_id = {1}", epcID, current_question_id)); // if (rows.Length > 0) // { // rows[0]["answer"] = question_value; // } // else // { // dtQuestion_answer_record.Rows.Add(new object[3] { epcID, current_question_id, question_value }); // } // break; //} }; this.Invoke(dele, evt); } }
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 check_time = p.time_stamp; string studentName = string.Empty; DataRow[] rows = null; bool bRefresh_ui = false; if (p.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0)//重复考勤 { //考勤数据不需要更新,但是显示页面需要更新 rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); if (rows.Length > 0) { rows[0]["status"] = "1"; rows[0]["checkTime"] = check_time; studentName = (string)rows[0]["NAME"]; } rows = this.mapConfigsTable.Select("studenID = '" + epcID + "'"); if (rows.Length > 0) { //此时需要将之前设为考勤状态的位置变回未考勤状态 int groupIndex = int.Parse(rows[0]["IGROUP"].ToString()); Carbinet _carbinet = this.groups[groupIndex]; _carbinet.setDocBGImage((string)rows[0]["EQUIPEMNTID"], (Image)global::Carbinet.Properties.Resources.grey); _carbinet.setDocText((string)rows[0]["EQUIPEMNTID"], ""); rows[0]["studenID"] = ""; } bRefresh_ui = true; } if (p.event_unit_list.IndexOf(IntelligentEventUnit.new_epc) >= 0)//第一次考勤 { //处理该事件需要更新学生考勤数据和显示页面 //更新考勤信息 //rows = this.checkTable.Select("equipmentID = '" + data.equipmentID + "'"); //根据接收到的信息,首先将学生出勤状态置为 1,之后将控件的显示状态改为绿色 if (string.Compare(this.dtStart, check_time) <= 0) { rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); if (rows.Length > 0) { rows[0]["status"] = "1"; rows[0]["checkTime"] = check_time; studentName = (string)rows[0]["NAME"]; } bRefresh_ui = true; } } if (bRefresh_ui == true) { rows = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); if (rows.Length > 0) { rows[0]["studenID"] = epcID; int groupIndex = int.Parse(rows[0]["IGROUP"].ToString()); //界面展示 Carbinet _carbinet = this.groups[groupIndex]; //_carbinet.setDocBGColor(data.equipmentID, Color.Green); _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.orange); _carbinet.setDocText(remoteDeviceID, studentName); // 查找考勤与未考勤的学生的数量,显示在饼图上 rows = this.studentInfoTable.Select("status = '1'"); int checkedCount = rows.Length; int uncheckedCount = this.studentInfoTable.Rows.Count - checkedCount; Debug.WriteLine( string.Format("Form1.updateStatus -> checked = {0} unchecked = {1}" , checkedCount, uncheckedCount)); //m_panelDrawing.Values = new decimal[] { uncheckedCount, checkedCount }; string strchecked = "", strUnchecked = ""; if (checkedCount > 0) { strchecked = (checkedCount / (checkedCount + uncheckedCount)).ToString() + "%"; } if (uncheckedCount > 0) { strUnchecked = (uncheckedCount / (checkedCount + uncheckedCount)).ToString() + "%"; } } } }; this.Invoke(dele, evt); } }
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 check_time = p.time_stamp; string studentName = string.Empty; string question_value = p.questionValue; DataRow[] rows = null; DataRow[] rowsMap = null; int totalCount = this.studentInfoTable.Rows.Count; rows = this.studentInfoTable.Select("STUDENTID = '" + epcID + "'"); rowsMap = this.mapConfigsTable.Select("EQUIPEMNTID = '" + remoteDeviceID + "'"); if (rows.Length > 0 && rowsMap.Length > 0)//有该用户资料和设备资料 { string answer = question_value; int groupIndex = int.Parse(rowsMap[0]["IGROUP"].ToString()); studentName = (string)rows[0]["NAME"]; Carbinet _carbinet = this.groups[groupIndex]; //if (p.event_unit_list.IndexOf(IntelligentEventUnit.new_epc) >= 0) //{ // _carbinet.setDocText(remoteDeviceID, studentName); //} //else //{ if (p.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0) { //这里要处理一下同一个学生用不一个设备发送答案的情况 DataRow[] rowsForDuplicate = this.mapConfigsTable.Select("studenID = '" + epcID + "'"); int groupIndex2 = int.Parse(rowsForDuplicate[0]["IGROUP"].ToString()); Carbinet _carbinet2 = this.groups[groupIndex2]; _carbinet2.setDocBGImage((string)rowsForDuplicate[0]["EQUIPEMNTID"], (Image)global::Carbinet.Properties.Resources.grey); _carbinet2.setDocText((string)rowsForDuplicate[0]["EQUIPEMNTID"], ""); rowsForDuplicate[0]["studenID"] = ""; } //} _carbinet.setDocText(remoteDeviceID, studentName); rowsMap[0]["studenID"] = epcID; if (answer == "A") { rows[0]["answer"] = "A"; // _carbinet.setDocBGColor(data.equipmentID, this.clrA); _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.grey); } if (answer == "B") { _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.blue); rows[0]["answer"] = "B"; } if (answer == "C") { rows[0]["answer"] = "C"; _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.yellow); //_carbinet.setDocBGColor(data.equipmentID, this.clrC); } if (answer == "D") { rows[0]["answer"] = "D"; _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.orange); //_carbinet.setDocBGColor(data.equipmentID, this.clrD); } if (answer == "E") { rows[0]["answer"] = "E"; _carbinet.setDocBGImage(remoteDeviceID, (Image)global::Carbinet.Properties.Resources.purple); } DataRow[] rowsA = this.studentInfoTable.Select("answer = 'A'"); DataRow[] rowsB = this.studentInfoTable.Select("answer = 'B'"); DataRow[] rowsC = this.studentInfoTable.Select("answer = 'C'"); DataRow[] rowsD = this.studentInfoTable.Select("answer = 'D'"); DataRow[] rowsE = this.studentInfoTable.Select("answer = 'E'"); int iA = rowsA.Length; int iB = rowsB.Length; int iC = rowsC.Length; int iD = rowsD.Length; int iE = rowsE.Length; //int iUnknown = totalCount - iA - iB - iC - iD - iE; m_panelDrawing.Values = new decimal[] { iA, iB, iC, iD, iE }; string strA = "", strB = "", strC = "", strD = "", strUnknown = "", strE = ""; //if (iUnknown > 0) //{ // strUnknown = (iUnknown * 100 / totalCount).ToString() + "%"; //} if (iA > 0) { strA = (iA * 100 / totalCount).ToString() + "%"; } if (iB > 0) { strB = (iB * 100 / totalCount).ToString() + "%"; } if (iC > 0) { strC = (iC * 100 / totalCount).ToString() + "%"; } if (iD > 0) { strD = (iD * 100 / totalCount).ToString() + "%"; } if (iE > 0) { strD = (iE * 100 / totalCount).ToString() + "%"; } m_panelDrawing.Texts = new string[] { strA, strB, strC, strD, strE }; } }; this.Invoke(dele, evt); } }
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); } }