private void toolStripButtonDeleteCompanyInfo_Click(object sender, EventArgs e) { if (kryptonDataGridViewCompany.CurrentRow == null) { return; } AccessDataBase.BLL.CompanyInfo bllCompanyInfo = new AccessDataBase.BLL.CompanyInfo(); int selectIndex = kryptonDataGridViewCompany.CurrentRow.Index; string companyID = kryptonDataGridViewCompany["CompanyID", selectIndex].Value.ToString().Trim(); if (MyMessageBox.MessageBoxOkCancel("Óû§ÐÅϢɾ³ýºó²»Äָܻ´,ÊÇ·ñɾ³ý?") == System.Windows.Forms.DialogResult.Cancel) { return; } if (bllCompanyInfo.Delete(int.Parse(companyID))) { MyMessageBox.MessageBoxOK("ɾ³ý³É¹¦"); } else { MyMessageBox.MessageBoxOkCancel("ɾ³ýʧ°Ü"); } this.refreshDataGridView(); }
private void kryptonButtonOK_Click(object sender, EventArgs e) { if (VerifyUserName() == false) { kryptonTextBoxName.Focus(); return; } if (VerifyPassword() == false) { kryptonTextBoxPassword.Focus(); return; } modelManager.ManagerName = kryptonTextBoxName.Text.Trim(); modelManager.ManagerPassWord = kryptonTextBoxPassword.Text.Trim(); if (openMode == OpenMode.Add) { if (bllManager.GetModelList("ManagerName='" + modelManager.ManagerName + "'") != null) { MyMessageBox.MessageBoxOK("用户已经存在"); } else { bllManager.Add(modelManager); this.Close(); } } else if (openMode == OpenMode.Update) { bllManager.Update(modelManager); this.Close(); } }
private void buttonSearch_Click(object sender, EventArgs e) { string Address = "255.255.255.255"; StringBuilder Buffer = new StringBuilder(1024); int count = DllC0402.searchDevice(Address, Buffer); listBoxSearch.Items.Clear(); if (count > 0) { string spli = "\r\n"; string buffer = Buffer.ToString(); string[] temp = buffer.Split(spli.ToCharArray()); foreach (string str in temp) { if (str.Contains("IP_FOUND_ACK,")) { listBoxSearch.Items.Add(str); } } } else { MyMessageBox.MessageBoxOK("textDeviceIsNotOnline"); } }
/**************************主页********************/ public static string getStartUpHomePage() { string languageType = Win32.ReadValue(iniFile, "StartUp", "HomePage"); if (languageType == null) { MyMessageBox.MessageBoxOK("config.ini 文件格式错误"); } return(languageType); }
/**************************数据库登录密码********************/ public static string getPassword() { string password = Win32.ReadValue(iniFile, "DataBase", "Password"); if (password == null) { MyMessageBox.MessageBoxOK("config.ini 文件格式错误"); } return(password); }
/*************************数据库登录用户名*********************/ public static string getUserID() { string userID = Win32.ReadValue(iniFile, "DataBase", "UserID"); if (userID == null) { MyMessageBox.MessageBoxOK("config.ini 文件格式错误"); } return(userID); }
private void button_TestSetDeviceData_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); //int ret = DllC0402.setJsonDeviceData(ipaddress, "UserInfo", "{UserID:1,UserName:'******',Photograph:0xFFFFF,UserGroupID1:1,UserGroupID2:1,UserGroupID3:1,UserGroupID4:1,FingerPosition0:1,FingerPrint0:0xFFFFF,FingerPosition1:1,FingerPrint1:0xFFFFFF,SecurityAccessLevel:1,PrimaryCardID:'00000000',SecondCardID:'00000000'}", ""); int ret = DllC0402.setJsonDeviceData(ipaddress, "UserInfo", "{ExpansionBoardPointID:1,PointName:input1,PointType:1,PointID:1,PointState:Null,ExpansionBoardID:1}", ""); if (ret >= 0) { MyMessageBox.MessageBoxOK("success"); } }
private void buttonSetData_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); string str = "UserID=1,UserName='******',Photograph=NULL,UserGroupID1=1,UserGroupID2=1,UserGroupID3=1,UserGroupID4=1,FingerPosition0=1,FingerPrint0=NULL,FingerPosition1=1,FingerPrint1=NULL,SecurityAccessLevel=1,PrimaryCardID='00000000',SecondCardID='00000000'"; //textBoxString.Text.Trim(); int ret = DllC0402.setDeviceData(ipaddress, "UserInfo", str, null); //.setJsonDeviceData(ipaddress, "UserInfo", "{ExpansionBoardPointID:1,PointName:input1,PointType:1,PointID:1,PointState:Null,ExpansionBoardID:1}", ""); if (ret >= 0) { MyMessageBox.MessageBoxOK("success"); } }
/**********************数据库名************************/ public static string getDataBaseName() { string dataBaseName = Win32.ReadValue(iniFile, "DataBase", "DataBaseName"); if (dataBaseName == null) { MyMessageBox.MessageBoxOK("config.ini 文件格式错误"); } return(dataBaseName); }
/********************数据源***************************/ public static string getDataSource() { string IP = Win32.ReadValue(iniFile, "DataBase", "IP"); if (IP == null) { MyMessageBox.MessageBoxOK("config.ini 文件格式错误"); } return(IP); }
private void kryptonButtonOK_Click(object sender, EventArgs e) { #region 验证旧密码 if (VerifyOldPassword() == false) { WidgetThread.WidgetThread.shakeLable(labelFailInfo); kryptonTextBoxOldPassword.Focus(); return; } #endregion #region 验证新密码1 if (VerifyNewPassword1() == false) { WidgetThread.WidgetThread.shakeLable(labelFailInfo); kryptonTextBoxNewPassword1.Focus(); return; } #endregion #region 验证新密码2 if (VerifyNewPassword2() == false) { WidgetThread.WidgetThread.shakeLable(labelFailInfo); kryptonTextBoxNewPassword2.Focus(); return; } #endregion #region 对比密码1 和密码2 if (!kryptonTextBoxNewPassword1.Text.Trim().Equals(kryptonTextBoxNewPassword2.Text.Trim())) { labelFailInfo.Text = "密码1 和密码2 不相同"; WidgetThread.WidgetThread.shakeLable(labelFailInfo); kryptonTextBoxNewPassword2.Focus(); return; } #endregion modelManager.ManagerName = Admin.name; modelManager.ManagerPassWord = kryptonTextBoxNewPassword2.Text.Trim(); if (bllManager.Update(modelManager)) { MyMessageBox.MessageBoxOK("更新密码成功"); this.Close(); } else { MyMessageBox.MessageBoxOK("更新密码失败"); } }
private void addReaderInfo(ref AccessDataBase.Model.ReaderInfo modelReaderInfo) { if (bllReaderInfo.Exists(modelReaderInfo.ReaderID)) { MyMessageBox.MessageBoxOK("读卡器ID已经存在"); return; } modelReaderTimeAccess.ReaderTimeAccessID = bllReaderTimeAccess.GetMaxId(); addReaderTimeAccess(ref modelReaderTimeAccess); modelReaderInfo.ReadTimeAccessID = modelReaderTimeAccess.ReaderTimeAccessID; bllReaderInfo.Add(modelReaderInfo); }
private void kryptonButtonOK_Click(object sender, EventArgs e) { int cardType = 0; string dateMatch; modelCardInfo.CardID = kryptonTextBoxCardID.Text.Trim(); modelCardInfo.CardVersion = kryptonTextBoxCardVersion.Text.Trim(); if (int.TryParse(kryptonComboBoxCardType.Text.Trim(), out cardType)) { modelCardInfo.CardType = cardType; } modelCardInfo.CardLevel = kryptonComboBoxCardLevel.Text.Trim(); modelCardInfo.CardPassword = kryptonTextBoxCardPassword.Text.Trim(); dateMatch = kryptonDateTimePickerCardIssueDateTime.Value.ToShortDateString(); if (RegexMatch.IsDate(dateMatch)) { modelCardInfo.CardIssueDateTime = dateMatch; } dateMatch = kryptonDateTimePickerCardValidDateTime.Value.ToShortDateString(); if (RegexMatch.IsDate(dateMatch)) { modelCardInfo.CardValidDateTime = dateMatch; } if (openMode == OpenMode.Add) { if (bllCardInfo.Add(modelCardInfo) == false) { MyMessageBox.MessageBoxOK("Ìí¼Ó¿¨Æ¬Ê§°Ü"); } else { this.Close(); } } else if (openMode == OpenMode.Update) { if (bllCardInfo.Update(modelCardInfo) == false) { MyMessageBox.MessageBoxOK("Ð޸Ŀ¨Æ¬Ê§°Ü"); } else { this.Close(); } } }
private void buttonDelBlackCardInfo_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); int ret = 0;// DllC0402.controlDevice(ipaddress, 0, RemoteControl.DelCardInfo, null); if (ret == 0) { MyMessageBox.MessageBoxOK("textDeleteCardInfoSucess"); } else { MyMessageBox.MessageBoxOK("textDeviceIsNotOnline"); } }
private void button1_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); String Temp = "UserID=" + 7; StringBuilder Data = new StringBuilder(Temp); //int ret = DllC0402.setDeviceData(ipaddress, "ControllerInfo","ControllerID=241,ControllerType=1,ControllerName='Controller1',ControllerLocation='XXXXX',EncryptionType=0,ControllerVersion='Vxx.xx.xx-x',ControllerMAC='AA:BB:CC:DD:EE:FF',ControllerIP='192.168.1.241',ControllerSubnetMask='255.255.255.0',ControllerGateway='192.168.1.1',ControllerPort=1200,ControllerDNS='8.8.8.8',ControllerBUDNS='114.114.114.114',ControllerAddr485=0,ControllerBaudrate=115200,ControllerDataBits=8,ControllerStopBits=1,ControllerParityCheck='None',ControllerFlowControl='None',ControllerSAM=0,ControllerSAMType=0,DoorUnitCounts=2,ExpansionBoardCounts=0", ""); int ret = DllC0402.deleteDeviceData(ipaddress, "UserInfo", Data, ""); if (ret >= 0) { MyMessageBox.MessageBoxOK("success"); } }
private void button2_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); String Temp = "UserID=" + 7; StringBuilder Data = new StringBuilder(Temp); //int ret = DllC0402.setDeviceData(ipaddress, "ControllerInfo","ControllerID=241,ControllerType=1,ControllerName='Controller1',ControllerLocation='XXXXX',EncryptionType=0,ControllerVersion='Vxx.xx.xx-x',ControllerMAC='AA:BB:CC:DD:EE:FF',ControllerIP='192.168.1.241',ControllerSubnetMask='255.255.255.0',ControllerGateway='192.168.1.1',ControllerPort=1200,ControllerDNS='8.8.8.8',ControllerBUDNS='114.114.114.114',ControllerAddr485=0,ControllerBaudrate=115200,ControllerDataBits=8,ControllerStopBits=1,ControllerParityCheck='None',ControllerFlowControl='None',ControllerSAM=0,ControllerSAMType=0,DoorUnitCounts=2,ExpansionBoardCounts=0", ""); int ret = DllC0402.updateDeviceData(ipaddress, "UserInfo", "UserID=7", "UserName='******',Photograph=NULL,UserGroupID1=1,UserGroupID2=1,UserGroupID3=1,UserGroupID4=1,FingerPosition0=1,FingerPrint0=NULL,FingerPosition1=1,FingerPrint1=NULL,SecurityAccessLevel=1,PrimaryCardID='00000000',SecondCardID='00000000'", ""); if (ret >= 0) { MyMessageBox.MessageBoxOK("success"); } }
public void toolStripButtonDeleteUserInfo_Click(object sender, EventArgs e) { if (dataGridViewWithCheckBox1.CurrentRow == null) { return; } int selectIndex = dataGridViewWithCheckBox1.CurrentRow.Index; string managerName = dataGridViewWithCheckBox1["ManagerName", selectIndex].Value.ToString().Trim(); modeManagerInfo = bllManagerInfo.GetModelList("ManagerName = '" + managerName + "'")[0]; if (bllManagerInfo.Delete(modeManagerInfo.ManagerID, modeManagerInfo.ManagerName) == false) { MyMessageBox.MessageBoxOK("ɾ³ýÓû§Ê§°Ü£¿"); } }
private void buttonUpdateProgram_Click(object sender, EventArgs e) { if (MyMessageBox.MessageBoxOkCancel("textAreYouSureToUpdateProgram") == DialogResult.OK) { string deviceIP = kryptonComboBoxControllerIp.Text.Trim(); string filePath = textBoxFilePath.Text.Trim(); string downLoadCmd = DllC0402.Server; if ((filePath == "") || (filePath == null)) { MyMessageBox.MessageBoxOK("textFilePathIsNull"); return; } DownLoadThread downLoadThread = new DownLoadThread(deviceIP, filePath, downLoadCmd, progressBar2); downLoadThread.DownLoadThreadRun(); } }
private void kryptonButtonCompanyOK_Click(object sender, EventArgs e) { modelCompanyInfo.CompanyID = int.Parse(kryptonTextBoxCompanyID.Text); if (!String.IsNullOrEmpty(kryptonTextBoxCompanyName.Text.Trim())) { modelCompanyInfo.CompanyName = kryptonTextBoxCompanyName.Text.Trim(); } else { MyMessageBox.MessageBoxOK("公司名不能为空"); } modelCompanyInfo.CompanyDes = kryptonTextBoxCompanyDes.Text.Trim(); modelCompanyInfo.CompanyAddress = kryptonTextBoxCompanyAddr.Text.Trim(); modelCompanyInfo.CompanyTel1 = kryptonTextBoxTelPhone1.Text.Trim(); modelCompanyInfo.CompanyTel2 = kryptonTextBoxTelPhone2.Text.Trim(); if (openMode == OpenMode.Add) { if (bllCompanyInfo.Exists(modelCompanyInfo.CompanyID) == true) { MyMessageBox.MessageBoxOK("公司信息以经存在"); } else if (bllCompanyInfo.Add(modelCompanyInfo)) { MyMessageBox.MessageBoxOK("添加公司信息成功"); } else { MyMessageBox.MessageBoxOK("添加公司信息失败"); } } else if (openMode == OpenMode.Update) { if (bllCompanyInfo.Update(modelCompanyInfo)) { MyMessageBox.MessageBoxOK("修改公司信息成功"); } else { MyMessageBox.MessageBoxOK("修改公司信息失败"); } } this.Close(); }
private ReturnValue deleteControllerInfo(int controllerID) { bool ret = bllControllerInfo.Exists(controllerID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + controllerID + "µÄ¿ØÖÆÆ÷²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllControllerInfo.Delete(controllerID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ý¿ØÖÆÆ÷ÐÅϢʧ°Ü£¬¿ØÖÆÆ÷IDΪ£º" + controllerID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteExpansionBoardPointInfo(int expansionBoardInfoID) { bool ret = bllExpansionBoardInfo.Exists(expansionBoardInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + expansionBoardInfoID + "µÄÀ©Õ¹°å²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllExpansionBoardPointInof.DeleteList("select ExpansionBoardPointID from ExpansionBoardPointInfo where ExpansionBoardID=" + expansionBoardInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ýÀ©Õ¹°å¶Ë¿ÚÐÅϢʧ°Ü£¬À©Õ¹°åIDΪ£º" + expansionBoardInfoID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteExpansionBoardInfo(int expansionBoardInfoID) { bool ret = bllExpansionBoardInfo.Exists(expansionBoardInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + expansionBoardInfoID + "µÄÀ©Õ¹°å²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllExpansionBoardInfo.Delete(expansionBoardInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ýÀ©Õ¹°åÐÅϢʧ°Ü£¬À©Õ¹°åIDΪ£º" + expansionBoardInfoID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteDooorUnit(int doorUnitID) { bool ret = bllDoorUnitInfo.Exists(doorUnitID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + doorUnitID + "µÄÃŵ¥Ôª²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllDoorUnitInfo.Delete(doorUnitID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ýÃŵ¥ÔªÐÅϢʧ°Ü£¬Ãŵ¥ÔªIDΪ£º" + doorUnitID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteReaderHoliday(int readerID) { bool ret = bllReaderHoliday.Exists(readerID); if (ret == false) { return(ReturnValue.NotExist); } ret = bllReaderHoliday.DeleteList("select ReaderHolidayID from ReaderHoliday where ReaderID =" + readerID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ý¶Á¿¨Æ÷½Ú¼ÙÈÕÐÅϢʧ°Ü£¬¶Á¿¨Æ÷IDΪ£º" + readerID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteReaderInfo(int readerInfoID) { bool ret = bllReaderInfo.Exists(readerInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + readerInfoID + "µÄ¶Á¿¨Æ÷²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllReaderInfo.Delete(readerInfoID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ý¶Á¿¨Æ÷ÐÅϢʧ°Ü£¬¶Á¿¨Æ÷IDΪ£º" + readerInfoID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private void buttonSearchUserByUserName_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); StringBuilder Buffer = new StringBuilder(1024); int BufferSize = 1000; string FieldNames = "UserName='******'"; int ret = DllC0402.getDeviceData(ipaddress, Buffer, BufferSize, DllC0402.CARDINFOTABLENAME, FieldNames); if (ret >= 0) { toolStripStatusLabel2.Text = Buffer.ToString(); } else { MyMessageBox.MessageBoxOK("textDeviceIsNotOnline"); } }
private ReturnValue deleteReaderTimeAccess(int readerTimeAccessID) { bool ret = bllReaderTimeAccess.Exists(readerTimeAccessID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + readerTimeAccessID + " µÄ¶Á¿¨Æ÷Öܹ¤×÷ģʽ²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllReaderTimeAccess.Delete(readerTimeAccessID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ý¶Á¿¨Æ÷Öܹ¤×÷ģʽÐÅϢʧ°Ü£¬¶Á¿¨Æ÷Öܹ¤×÷ģʽIDΪ£º" + readerTimeAccessID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private ReturnValue deleteReaderTimeZone(int readerTimeZoneID) { bool ret = bllReaderTimeZone.Exists(readerTimeZoneID); if (ret == false) { MyMessageBox.MessageBoxOK("IDΪ£º" + readerTimeZoneID + "µÄ¶Á¿¨Æ÷¹¤×÷ʱÇø²»´æÔÚ"); return(ReturnValue.NotExist); } ret = bllReaderTimeZone.Delete(readerTimeZoneID); if (ret == false) { MyMessageBox.MessageBoxOK("ɾ³ý¶Á¿¨Æ÷ʱÇøÐÅϢʧ°Ü£¬Ê±ÇøÐÅÏ¢IDΪ£º" + readerTimeZoneID); return(ReturnValue.Fail); } return(ReturnValue.Success); }
private void buttonDelTriggerEvent_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); int ret = 0;// DllC0402.controlDevice(ipaddress, 0, RemoteControl.DelTriggerEvent, null); if (ret == 0) { MyMessageBox.MessageBoxOK("textDeleteTriggerEventSucess"); } else if (ret == -11) { MyMessageBox.MessageBoxOK("textParametersFormatError"); } else { MyMessageBox.MessageBoxOK("textDeviceIsNotOnline"); } }
private void buttonSynchronizeTime_Click(object sender, EventArgs e) { string ipaddress = kryptonComboBoxControllerIp.Text.Trim(); string deviceDate = "DeviceDate=" + DateTime.Now.Date.ToShortDateString() + ","; string deviceTime = "DeviceTime=" + DateTime.Now.ToLongTimeString(); string deviceDateTime = deviceDate + deviceTime; int ret = DllC0402.setDeviceParam(ipaddress, deviceDateTime); if (ret == 0) { MyMessageBox.MessageBoxOK("textDeviceSetParaSucess"); } else { MyMessageBox.MessageBoxOK("textDeviceIsNotOnline"); } }