private void toolStripButtonDownLoadControllerInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); if (MyMessageBox.MessageBoxOkCancel("ÏÂÔØ¿ØÖÆÆ÷ÐÅÏ¢ÖÁÉ豸?") == System.Windows.Forms.DialogResult.Cancel) { return; } int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); int doorUnitCounts = (modelControllerInfo.DoorUnitEnable1 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable2 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable3 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable4 == true ? 1 : 0); int expansionBoardCounts = (modelControllerInfo.ExpansionBoardEnable1 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable2 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable3 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable4 == true ? 1 : 0); string data = "ControllerID=" + modelControllerInfo.ControllerID + "," + "ControllerType=" + modelControllerInfo.ControllerType + "," + "ControllerName='" + modelControllerInfo.ControllerName + "'," + "ControllerLocation='" + modelControllerInfo.ControllerLocation + "'," + "EncryptionType=" + modelControllerInfo.CommunicateType + "," + "ControllerVersion='" + modelControllerInfo.ControllerVersion + "'," + "ControllerMAC='" + modelControllerInfo.ControllerMAC + "'," + "ControllerIP='" + modelControllerInfo.ControllerIP + "'," + "ControllerSubnetMask='" + modelControllerInfo.ControllerSubnetMask + "'," + "ControllerGateway='" + modelControllerInfo.ControllerGateway + "'," + "ControllerPort=" + modelControllerInfo.ControllerPort + "," + "ControllerDNS='" + modelControllerInfo.ControllerDNS + "'," + "ControllerBUDNS='" + modelControllerInfo.ControllerBUDNS + "'," + "ControllerAddr485=" + modelControllerInfo.ControllerAddr485 + "," + "ControllerBaudrate=" + modelControllerInfo.ControllerBaudrate + "," + "ControllerDataBits=" + modelControllerInfo.ControllerDataBits + "," + //"ControllerStopBits="+modelControllerInfo.ControllerStopBits+","+ "ControllerStopBits=" + 1 + "," + "ControllerParityCheck='" + modelControllerInfo.ControllerParityCheck + "'," + "ControllerFlowControl='" + modelControllerInfo.ControllerFlowControl + "'," + "ControllerSAM=" + modelControllerInfo.ControllerSAM + "," + "ControllerSAMType=" + modelControllerInfo.ControllerSAMType + "," + "DoorUnitCounts=" + doorUnitCounts + "," + "ExpansionBoardCounts=" + expansionBoardCounts; Dll.DllC0402.setDeviceData(modelControllerInfo.ControllerIP, "", data, ""); /* * µ÷ÓÃAPIº¯Êý */ }
/* * public void updateGridViewWithCheckBoxRow(object sender, DataGridViewCellEventArgs e) * { * if (kryptonDataGridView1.Rows.Count <= 0) * return; * AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); * int selectIndex = kryptonDataGridView1.CurrentRow.Index; * * string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); * * AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); * FormController formController = new FormController(modelControllerInfo, OpenMode.Update); * formController.ShowDialog(); * * this.refreshDataGridView(); * }*/ private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e) { if (kryptonDataGridView1.CurrentRow == null) { return; } AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); FormController formController = new FormController(modelControllerInfo, OpenMode.Update); formController.ShowDialog(); refreshDataGridView(); }
private void toolStripButtonDownLoadUserInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); if (MyMessageBox.MessageBoxOkCancel("下载用户信息至设备?") == System.Windows.Forms.DialogResult.Cancel) { return; } foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows) { if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index)) { string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(userID)); /* * * 调用API函数 */ } } }
private void toolStripButtonDownLoadUserInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); if (MyMessageBox.MessageBoxOkCancel("�����û���Ϣ���豸��") == System.Windows.Forms.DialogResult.Cancel) return; foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows) { if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index)) { string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(userID)); /* ����API���� */ } } }
private ReturnValue updateControllerInfo() { int controllerID; bool ret = int.TryParse(kryptonTextBoxControllerID.Text.Trim(), out controllerID); if (!ret) { MyMessageBox.MessageBoxOK("控制ID必须为有效数字"); return(ReturnValue.Fail); } modelControllerInfo = bllControllerInfo.GetModel(controllerID); if (modelControllerInfo == null) { return(ReturnValue.NotExist); } #region 控制器基本信息 modelControllerInfo.ControllerID = int.Parse(kryptonTextBoxControllerID.Text.Trim()); modelControllerInfo.ControllerName = kryptonTextBoxControllerName.Text.Trim(); modelControllerInfo.ControllerType = kryptonComboBoxControllerType.SelectedIndex + 1; modelControllerInfo.ControllerLocation = kryptonTextBoxControllerLoaction.Text.Trim(); modelControllerInfo.ControllerVersion = kryptonTextBoxControllerVersion.Text.ToString(); #endregion 控制器信息 #region 通讯参数 if ((kryptonCheckBoxCommunicateTypeTCP.Checked) && (kryptonCheckBoxCommunicateType485.Checked)) { modelControllerInfo.CommunicateType = 0; } else if (kryptonCheckBoxCommunicateType485.Checked) { modelControllerInfo.CommunicateType = 2; } else { modelControllerInfo.CommunicateType = 1; } //TCP 通信参数 modelControllerInfo.ControllerIP = textBoxNewDeviceIP.Text.Trim(); modelControllerInfo.ControllerSubnetMask = textBoxMask.Text.Trim(); modelControllerInfo.ControllerGateway = textBoxGateway.Text.Trim(); modelControllerInfo.ControllerMAC = textBoxMAC.Text; modelControllerInfo.ControllerDNS = textBoxDNS.Text; modelControllerInfo.ControllerBUDNS = kryptonTextBoxBackUpDNS.Text; //RS485通信参数 #endregion #region 辅助单元 modelControllerInfo.AuxOutPutPointID = int.Parse(kryptonTextBoxAuxOutPutPoint.Text.ToString()); modelControllerInfo.InputStateType = kryptonComboBoxInputStateType0.SelectedIndex + 1; modelControllerInfo.FireSensingID = int.Parse(kryptonTextBoxFireSensing.Text.ToString()); modelControllerInfo.FireSensingEnable = true; modelControllerInfo.FireSensingMode = 1; modelControllerInfo.TamperSensingID = int.Parse(kryptonTextBoxTamperSensing.Text.ToString()); modelControllerInfo.TamperSensingEnable = true; modelControllerInfo.TamperSensingMode = 1; modelControllerInfo.LowVoltageID = int.Parse(kryptonTextBoxLowVoltage.Text.ToString()); modelControllerInfo.LowVoltageEnable = true; modelControllerInfo.LowVoltageMode = 1; modelControllerInfo.PowerOutageID = int.Parse(kryptonTextBoxPowerOutage.Text.ToString()); modelControllerInfo.PowerOutageEnable = true; modelControllerInfo.PowerOutageMode = 1; #endregion #region 门单元1 modelControllerInfo.DoorUnitEnable1 = kryptonCheckBoxDoorUnitEnable1.Checked; #endregion #region 门单元2 modelControllerInfo.DoorUnitEnable2 = kryptonCheckBoxDoorUnitEnable2.Checked; #endregion #region 门单元3 modelControllerInfo.DoorUnitEnable3 = kryptonCheckBoxDoorUnitEnable3.Checked; #endregion #region 门单元4 modelControllerInfo.DoorUnitEnable4 = kryptonCheckBoxDoorUnitEnable4.Checked; #endregion #region 集成IO #endregion #region 扩展IO1 #endregion #region 扩展IO2 #endregion #region 扩展IO3 #endregion #region 扩展IO4 #endregion bllControllerInfo.Update(modelControllerInfo); return(ReturnValue.Success); }
private void toolStripButtonDeleteControllerInfo_Click(object sender, EventArgs e) { if (kryptonDataGridView1.CurrentRow == null) { return; } if (MyMessageBox.MessageBoxOkCancel("¿ØÖÆÆ÷ÐÅϢɾ³ýºó²»Äָܻ´,ÊÇ·ñɾ³ý?") == System.Windows.Forms.DialogResult.Cancel) { return; } int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerIDStr = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); int controllerIDInt; if (int.TryParse(controllerIDStr, out controllerIDInt)) { #region ɾ³ý¿ØÖÆÆ÷ÐÅÏ¢ modelControllerInfo = bllControllerInfo.GetModel(controllerIDInt); if (modelControllerInfo == null) { return; } deleteControllerInfo(controllerIDInt); #endregion #region ɾ³ýÀ©Õ¹°å #region ɾ³ýÀ©Õ¹°å1 if (modelControllerInfo.ExpansionBoardID1.HasValue & modelControllerInfo.ExpansionBoardID1 != 0) { deleteExpansionBoardPointInfo(modelControllerInfo.ExpansionBoardID1.Value); deleteExpansionBoardInfo(modelControllerInfo.ExpansionBoardID1.Value); } #endregion #region ɾ³ýÀ©Õ¹°å2 if (modelControllerInfo.ExpansionBoardID2.HasValue & modelControllerInfo.ExpansionBoardID2 != 0) { deleteExpansionBoardPointInfo(modelControllerInfo.ExpansionBoardID2.Value); deleteExpansionBoardInfo(modelControllerInfo.ExpansionBoardID2.Value); } #endregion #region ɾ³ýÀ©Õ¹°å3 if (modelControllerInfo.ExpansionBoardID3.HasValue & modelControllerInfo.ExpansionBoardID3 != 0) { deleteExpansionBoardPointInfo(modelControllerInfo.ExpansionBoardID3.Value); deleteExpansionBoardInfo(modelControllerInfo.ExpansionBoardID3.Value); } #endregion #region ɾ³ýÀ©Õ¹4 if (modelControllerInfo.ExpansionBoardID4.HasValue & modelControllerInfo.ExpansionBoardID4 != 0) { deleteExpansionBoardPointInfo(modelControllerInfo.ExpansionBoardID4.Value); deleteExpansionBoardInfo(modelControllerInfo.ExpansionBoardID4.Value); } #endregion #endregion #region ɾ³ýÃŵ¥Ôª1 //ɾ³ýÃŵ¥Ôª if (modelControllerInfo.DoorUnitID1.HasValue & modelControllerInfo.DoorUnitID1.Value != 0) { modelDoorUnitInfo = bllDoorUnitInfo.GetModel(modelControllerInfo.DoorUnitID1.Value); if (modelDoorUnitInfo == null) { return; } deleteDooorUnit(modelDoorUnitInfo.DoorUnitID); //ɾ³ý¶Á¿¨Æ÷ÐÅÏ¢ if (modelDoorUnitInfo.ReadID1.HasValue & modelDoorUnitInfo.ReadID1.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID1.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } if (modelDoorUnitInfo.ReadID2.HasValue & modelDoorUnitInfo.ReadID2.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID2.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } } #endregion #region ɾ³ýÃŵ¥Ôª2 //ɾ³ýÃŵ¥Ôª if (modelControllerInfo.DoorUnitID2.HasValue & modelControllerInfo.DoorUnitID2.Value != 0) { modelDoorUnitInfo = bllDoorUnitInfo.GetModel(modelControllerInfo.DoorUnitID2.Value); if (modelDoorUnitInfo == null) { return; } deleteDooorUnit(modelDoorUnitInfo.DoorUnitID); //ɾ³ý¶Á¿¨Æ÷ÐÅÏ¢ if (modelDoorUnitInfo.ReadID1.HasValue & modelDoorUnitInfo.ReadID1.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID1.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } if (modelDoorUnitInfo.ReadID2.HasValue & modelDoorUnitInfo.ReadID2.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID2.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } } #endregion #region ɾ³ýÃŵ¥Ôª3 //ɾ³ýÃŵ¥Ôª if (modelControllerInfo.DoorUnitID3.HasValue & modelControllerInfo.DoorUnitID3.Value != 0) { modelDoorUnitInfo = bllDoorUnitInfo.GetModel(modelControllerInfo.DoorUnitID3.Value); if (modelDoorUnitInfo == null) { return; } deleteDooorUnit(modelDoorUnitInfo.DoorUnitID); //ɾ³ý¶Á¿¨Æ÷ÐÅÏ¢ if (modelDoorUnitInfo.ReadID1.HasValue & modelDoorUnitInfo.ReadID1.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID1.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } if (modelDoorUnitInfo.ReadID2.HasValue & modelDoorUnitInfo.ReadID2.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID2.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } } #endregion #region ɾ³ýÃŵ¥Ôª4 //ɾ³ýÃŵ¥Ôª if (modelControllerInfo.DoorUnitID4.HasValue & modelControllerInfo.DoorUnitID4.Value != 0) { modelDoorUnitInfo = bllDoorUnitInfo.GetModel(modelControllerInfo.DoorUnitID4.Value); if (modelDoorUnitInfo == null) { return; } deleteDooorUnit(modelDoorUnitInfo.DoorUnitID); //ɾ³ý¶Á¿¨Æ÷ÐÅÏ¢ if (modelDoorUnitInfo.ReadID1.HasValue & modelDoorUnitInfo.ReadID1.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID1.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } if (modelDoorUnitInfo.ReadID2.HasValue & modelDoorUnitInfo.ReadID2.Value != 0) { modelReaderInfo = bllReaderInfo.GetModel(modelDoorUnitInfo.ReadID2.Value); if (modelReaderInfo == null) { return; } deleteReaderHoliday(modelReaderInfo.ReaderID); deleteReaderInfo(modelReaderInfo.ReaderID); //ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽ if (modelReaderInfo.ReadTimeAccessID.HasValue & modelReaderInfo.ReadTimeAccessID.Value != 0) { modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderInfo.ReadTimeAccessID.Value); if (modelReaderTimeAccess == null) { return; } deleteReaderTimeAccess(modelReaderTimeAccess.ReaderTimeAccessID); deleteReaderTimeZone(modelReaderTimeAccess.Mon.Value); deleteReaderTimeZone(modelReaderTimeAccess.Tue.Value); deleteReaderTimeZone(modelReaderTimeAccess.Wed.Value); deleteReaderTimeZone(modelReaderTimeAccess.Thu.Value); deleteReaderTimeZone(modelReaderTimeAccess.Fri.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sat.Value); deleteReaderTimeZone(modelReaderTimeAccess.Sun.Value); } } } #endregion } refreshDataGridView(); }
/* public void updateGridViewWithCheckBoxRow(object sender, DataGridViewCellEventArgs e) { if (kryptonDataGridView1.Rows.Count <= 0) return; AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); FormController formController = new FormController(modelControllerInfo, OpenMode.Update); formController.ShowDialog(); this.refreshDataGridView(); }*/ private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e) { if (kryptonDataGridView1.CurrentRow == null) return; AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); FormController formController = new FormController(modelControllerInfo,OpenMode.Update); formController.ShowDialog(); refreshDataGridView(); }
private void toolStripButtonDownLoadControllerInfo_Click(object sender, EventArgs e) { AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo(); if (MyMessageBox.MessageBoxOkCancel("���ؿ�������Ϣ���豸?") == System.Windows.Forms.DialogResult.Cancel) return; int selectIndex = kryptonDataGridView1.CurrentRow.Index; string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim(); AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID)); int doorUnitCounts = (modelControllerInfo.DoorUnitEnable1 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable2 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable3 == true ? 1 : 0) + (modelControllerInfo.DoorUnitEnable4 == true ? 1 : 0); int expansionBoardCounts = (modelControllerInfo.ExpansionBoardEnable1 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable2 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable3 == true ? 1 : 0) + (modelControllerInfo.ExpansionBoardEnable4 == true ? 1 : 0); string data = "ControllerID=" + modelControllerInfo.ControllerID+","+ "ControllerType="+modelControllerInfo.ControllerType+","+ "ControllerName='"+modelControllerInfo.ControllerName+"',"+ "ControllerLocation='"+modelControllerInfo.ControllerLocation+"',"+ "EncryptionType="+modelControllerInfo.CommunicateType+","+ "ControllerVersion='"+modelControllerInfo.ControllerVersion+"',"+ "ControllerMAC='"+modelControllerInfo.ControllerMAC+"',"+ "ControllerIP='"+modelControllerInfo.ControllerIP+"',"+ "ControllerSubnetMask='"+modelControllerInfo.ControllerSubnetMask+"',"+ "ControllerGateway='"+modelControllerInfo.ControllerGateway+"',"+ "ControllerPort="+modelControllerInfo.ControllerPort+","+ "ControllerDNS='"+modelControllerInfo.ControllerDNS+"',"+ "ControllerBUDNS='"+modelControllerInfo.ControllerBUDNS+"',"+ "ControllerAddr485="+modelControllerInfo.ControllerAddr485+","+ "ControllerBaudrate="+modelControllerInfo.ControllerBaudrate+","+ "ControllerDataBits="+modelControllerInfo.ControllerDataBits+","+ //"ControllerStopBits="+modelControllerInfo.ControllerStopBits+","+ "ControllerStopBits=" + 1 + "," + "ControllerParityCheck='"+modelControllerInfo.ControllerParityCheck+"',"+ "ControllerFlowControl='"+modelControllerInfo.ControllerFlowControl+"',"+ "ControllerSAM="+modelControllerInfo.ControllerSAM+","+ "ControllerSAMType="+modelControllerInfo.ControllerSAMType+","+ "DoorUnitCounts=" + doorUnitCounts+ "," + "ExpansionBoardCounts=" + expansionBoardCounts; Dll.DllC0402.setDeviceData(modelControllerInfo.ControllerIP, "", data, ""); /* * ����API���� */ }