/// <summary> /// IPアドレスと開始フォル唯一。 /// </summary> /// 2014-06-24 wjd add /// <param name="id"></param> /// <param name="bkIP"></param> /// <param name="startFolder"></param> /// <returns></returns> public ActionResult CheckIPAndStartfolder(int id, string bkIP, string startFolder) { int result = 0; try { IList <BackupServer> bkList = bkService.GetBackupServerListButId(id, bkIP, startFolder); result = bkList.Count; } catch (Exception ex) { result = -10; logger.Error(ex.Message); } Response.Write(result); Response.End(); return(null); }
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); }