private void btnLogin_Click(object sender, EventArgs e) { //messageBox title string loginIDError = ValidationRegex.ValidteEmpty(this.lblLoginId.Text, this.txtLoginId.Text); string passwordError = ValidationRegex.ValidteEmpty(this.lblLoginPass.Text, this.txtLoginPass.Text); if (loginIDError != "") { MsgHelper.WarningMsg(loginIDError, ValidationRegex.publicTitle); return; } else if (passwordError != "") { MsgHelper.WarningMsg(passwordError, ValidationRegex.publicTitle); return; } IUserInfoService uiService = BLLFactory.ServiceAccess.CreateUserInfoService(); UserInfo userInfo = new UserInfo(); userInfo.loginID = this.txtLoginId.Text; userInfo.password = this.txtLoginPass.Text; UserInfo us; try { us = uiService.userExist(userInfo); if (us != null) { userinfo = us; logger.Info(us.loginID + "ログイン成功。"); FrmMain.userinfo = us; this.Dispose(); FrmMain mainForm = new FrmMain(); mainForm.ShowDialog(); } else { logger.Info("ログイン失敗。" + ValidationRegex.I003); MsgHelper.WarningMsg(ValidationRegex.I003, ValidationRegex.publicTitle); } } catch (OdbcException ex) { // 例外処理 MsgHelper.WarningMsg(ValidationRegex.I004, ValidationRegex.publicTitle); } catch (Exception ex) { // 例外処理 MsgHelper.WarningMsg(ValidationRegex.I005, ValidationRegex.publicTitle); } }
private bool messageCheck() { bool flag = false; string nameMessage = ValidationRegex.ValidteEmpty(this.lblTrName.Text, this.txtTrName.Text); string ipMessage = ValidationRegex.ValidteEmpty(this.lblTrIp.Text, this.txtTrIp.Text); string accountMessage = ValidationRegex.ValidteEmpty(this.lblTrAccount.Text, this.txtTraccount.Text); string passMessage = ValidationRegex.ValidteEmpty(this.lblTrPass.Text, this.txtTrPass.Text); string stfileMessage = ValidationRegex.ValidteEmpty(this.lblTrStfile.Text, this.txtTrStfile.Text); Regex patt = new Regex("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}"); int bkId = 0; if (!String.IsNullOrWhiteSpace(this.id)) { bkId = Convert.ToInt32(this.id); } //check Backup Server Name IList <BackupServer> existLists = null; if (!String.IsNullOrWhiteSpace(this.txtTrName.Text)) { existLists = backupService.GetBackupServerListByNameButId(bkId, this.txtTrName.Text.Trim()); } if (nameMessage != "") { MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle); flag = true; } else if (existLists != null && existLists.Count > 0) { string msg = ValidationRegex.W008; msg = msg.Replace("{1}", this.lblTrName.Text); MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle); flag = true; } else if (ipMessage != "") { MsgHelper.WarningMsg(ipMessage, ValidationRegex.publicTitle); flag = true; } else if (!patt.IsMatch(this.txtTrIp.Text.Trim())) { string msg = ValidationRegex.W003.Replace("{1}", this.lblTrIp.Text); MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle); flag = true; } else if (accountMessage != "") { MsgHelper.WarningMsg(accountMessage, ValidationRegex.publicTitle); flag = true; } else if (passMessage != "") { MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle); flag = true; } else if (stfileMessage != "") { MsgHelper.WarningMsg(stfileMessage, ValidationRegex.publicTitle); flag = true; } else { //IP and startfolder unique checking IList <BackupServer> bkList = backupService.GetBackupServerListButId(bkId, this.txtTrIp.Text, this.txtTrStfile.Text); if (bkList.Count > 0) { MsgHelper.WarningMsg(ValidationRegex.W009, ValidationRegex.publicTitle); flag = true; } else { //check whether the ip and startfolder is deleted. IList <BackupServer> deletedbkList = backupService.GetDeletedBackupServerList(this.txtTrIp.Text, this.txtTrStfile.Text); if (deletedbkList.Count > 0) { flag = !MsgHelper.QuestionMsg(ValidationRegex.W010, ValidationRegex.publicTitle); } } } return(flag); }
private bool messageCheck() { bool flag = false; string nameMessage = ValidationRegex.ValidteEmpty(this.lblName.Text, this.txtMonitorName.Text); string ipMessage = ValidationRegex.ValidteEmpty(this.lblMonitorIp.Text, this.txtMonitorIp.Text); string accountMessage = ValidationRegex.ValidteEmpty(this.lblMonitorAccount.Text, this.txtMonitorAccount.Text); string passMessage = ValidationRegex.ValidteEmpty(this.lblMonitorPass.Text, this.txtMonitorPass.Text); string stfileMessage = ValidationRegex.ValidteEmpty(this.lblMonitorStfile.Text, this.txtMonitorStfile.Text); string localpathMessage = ValidationRegex.ValidteEmpty(this.lblLocalPath.Text, this.txtLocalPath.Text); // SSH エラーコピー対応 20140416 string macMessage = ValidationRegex.ValidteEmpty(this.lblMacPath.Text, this.txtMacPath.Text); //string monitorDrive = ValidationRegex.ValidteEmpty(this.lblMonitorDrive.Text, this.cobMonitorDrive.Text); Regex patt = new Regex("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}"); if (nameMessage != "") { MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle); flag = true; } else if (ipMessage != "") { MsgHelper.WarningMsg(ipMessage, ValidationRegex.publicTitle); flag = true; } else if (accountMessage != "") { MsgHelper.WarningMsg(accountMessage, ValidationRegex.publicTitle); flag = true; } else if (passMessage != "") { MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle); flag = true; } else if (stfileMessage != "") { MsgHelper.WarningMsg(stfileMessage, ValidationRegex.publicTitle); flag = true; } else if (localpathMessage != "") { MsgHelper.WarningMsg(localpathMessage, ValidationRegex.publicTitle); flag = true; } else if (macMessage != "") { MsgHelper.WarningMsg(macMessage, ValidationRegex.publicTitle); flag = true; } //else if (monitorDrive != "") //{ // MsgHelper.WarningMsg(monitorDrive, ValidationRegex.publicTitle); // flag = true; //} else if (!patt.IsMatch(this.txtMonitorIp.Text.Trim())) { string msg = ValidationRegex.W003.Replace("{1}", this.lblMonitorIp.Text); MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle); flag = true; } return(flag); }
private void btnSave_Click(object sender, EventArgs e) { string nameMessage = ValidationRegex.ValidteEmpty(this.lblName.Text, this.txtMonitorName.Text); string serverMessage = ValidationRegex.ValidteEmpty(this.lblServer.Text, this.cobMonitorServer.Text); if (nameMessage != "") { MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle); return; } else if (serverMessage != "") { MsgHelper.WarningMsg(serverMessage, ValidationRegex.publicTitle); return; } else { string id = this.txtMonitorId.Text; //save operation //BackupServerGroup backupServerGroup = new BackupServerGroup(); innerBackupServerGroup.backupServerGroupName = this.txtMonitorName.Text.Trim(); innerBackupServerGroup.monitorServerID = this.cobMonitorServer.SelectedValue.ToString(); innerBackupServerGroup.memo = this.txtMonitorMemo.Text.Trim(); innerBackupServerGroup.deleteFlg = 0; innerBackupServerGroup.creater = FrmMain.userinfo.loginID; innerBackupServerGroup.createDate = CommonUtil.DateTimeNowToString(); innerBackupServerGroup.updater = FrmMain.userinfo.loginID; innerBackupServerGroup.updateDate = CommonUtil.DateTimeNowToString(); //IBackupServerGroupService backupService = BLLFactory.ServiceAccess.CreateBackupServerGroupService(); //int flag = -1; if (id == "") { IList <BackupServerGroup> existLists = backupService.GetBackupServerGroupByName(this.txtMonitorName.Text.Trim()); if (existLists.Count > 0) { string msg = ValidationRegex.W008; msg = msg.Replace("{1}", this.lblName.Text); MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle); } else { if (MsgHelper.QuestionMsg(ValidationRegex.Q001, ValidationRegex.publicTitle)) { ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(saveOperation)); } if (innerFlag > -1) { MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle); gFlag = true; this.Dispose(); } } } else { innerBackupServerGroup.id = id; if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle)) { ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(updateOperation)); } if (innerFlag > -1) { MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle); gFlag = true; this.Dispose(); } } } }
private void btnAuthSave_Click(object sender, EventArgs e) { string loginIDMessage = ValidationRegex.ValidteEmpty(this.lblAuEditLoginId.Text, this.txtAuEditLoginId.Text); string passMessage = ValidationRegex.ValidteEmpty(this.lblAuEditLoginPass.Text, this.txtAuEditLoginPass.Text); string nameMessage = ValidationRegex.ValidteEmpty(this.lblAuEditName.Text, this.txtAuEditName.Text); string mailMessage = ValidationRegex.ValidteEmpty(this.lblAuEditMail.Text, this.txtAuEditMail.Text); if (loginIDMessage != "") { MsgHelper.WarningMsg(loginIDMessage, ValidationRegex.publicTitle); return; } else if (passMessage != "") { MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle); return; } else if (nameMessage != "") { MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle); return; } else if (mailMessage != "") { MsgHelper.WarningMsg(mailMessage, ValidationRegex.publicTitle); return; } else { string id = this.txtAuthEditId.Text; //save operation UserInfo userInfo = new UserInfo(); userInfo.loginID = this.txtAuEditLoginId.Text; userInfo.password = this.txtAuEditLoginPass.Text; userInfo.name = this.txtAuEditName.Text; userInfo.mail = this.txtAuEditMail.Text; if (this.rbAuthMailYes.Checked == true) { userInfo.mailFlg = 1; } else { userInfo.mailFlg = 0; } if (this.rbAuthFlgYes.Checked == true) { userInfo.authorityFlg = 1; } else { userInfo.authorityFlg = 0; } userInfo.deleteFlg = 0; userInfo.creater = FrmMain.userinfo.loginID; userInfo.createDate = CommonUtil.DateTimeNowToString(); userInfo.updater = FrmMain.userinfo.loginID; userInfo.updateDate = CommonUtil.DateTimeNowToString(); IUserInfoService userInfoService = BLLFactory.ServiceAccess.CreateUserInfoService(); int flag = -1; if (id == "") { if (MsgHelper.QuestionMsg(ValidationRegex.Q001, ValidationRegex.publicTitle)) { flag = userInfoService.InsertUserInfo(userInfo); } if (flag > -1) { MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle); this.Dispose(); } else { MsgHelper.InfoMsg(ValidationRegex.I002, ValidationRegex.publicTitle); } } else { userInfo.id = id; if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle)) { flag = userInfoService.UpdateUserInfo(userInfo); } if (flag > -1) { MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle); this.Dispose(); } else { MsgHelper.InfoMsg(ValidationRegex.U002, ValidationRegex.publicTitle); } } } }