private void saveOperation() { try { innerFlag = groupSerivce.InsertBackupServerGroup(this.innerBackupServerGroup); innerFlag = backupService.InsertBackupServer(innerBackupServer); //add relation detail IList <BackupServerGroup> groupList = groupSerivce.GetBackupServerGroupByName(this.innerBackupServerGroup.backupServerGroupName); IList <BackupServer> bkList = backupService.GetBackupServerListByName(innerBackupServer.backupServerName); if (groupList.Count > 0 && bkList.Count > 0) { BackupServerGroupDetail modelDetail = new BackupServerGroupDetail(); modelDetail.backupServerGroupId = Convert.ToInt32(groupList[0].id); modelDetail.backupServerId = Convert.ToInt32(bkList[0].id); modelDetail.deleteFlg = 0; modelDetail.creater = FrmMain.userinfo.loginID; modelDetail.createDate = CommonUtil.DateTimeNowToString(); modelDetail.updater = FrmMain.userinfo.loginID; modelDetail.updateDate = CommonUtil.DateTimeNowToString(); IBackupServerGroupDetailService groubDetailService = BLLFactory.ServiceAccess.CreateBackupServerGroupDetailService(); innerFlag = groubDetailService.InsertBackupServerGroupDetail(modelDetail); } } catch (Exception ex) { logger.Error(ex.Message); } }
private void btnLeft_Click_Copy(object sender, EventArgs e) { //save or delete group detail data //get the selected row data from dgrdBackupServer if (null == dgrdBackupServer.CurrentCell) { return; } BackupServerGroupDetail bsgd = new BackupServerGroupDetail(); string backupServerId = dgrdBackupServer.CurrentRow.Cells[0].Value.ToString(); //get the combobox selected value string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString(); bsgd.backupServerGroupId = Convert.ToInt32(selectGroupId); bsgd.backupServerId = Convert.ToInt32(backupServerId); bsgd.creater = FrmMain.userinfo.loginID; bsgd.createDate = DateTime.Now.ToString(); bsgd.updater = FrmMain.userinfo.loginID; bsgd.updateDate = DateTime.Now.ToString(); IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); IBackupServerGroupDetailService backGroupDetail = BLLFactory.ServiceAccess.CreateBackupServerGroupDetailService(); int flag = backGroupDetail.InsertBackupServerGroupDetail(bsgd); if (flag > -1) { //empty the monitor rows this.dgrdMonitorServer.Rows.Clear(); this.dgrdMonitorServer.AllowUserToAddRows = false; IList <BackupServer> gbsList = bs.GetGroupBackupServerList(selectGroupId); foreach (BackupServer gbs in gbsList) { DataGridViewRow dgvr = new DataGridViewRow(); foreach (DataGridViewColumn c in dgrdMonitorServer.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);//add row cells } dgvr.Cells[0].Value = gbs.id; dgvr.Cells[1].Value = gbs.backupServerName; this.dgrdMonitorServer.Rows.Add(dgvr); } //empty the monitor rows this.dgrdBackupServer.Rows.Clear(); this.dgrdBackupServer.AllowUserToAddRows = false; IList <BackupServer> gbpList = bs.GetPartBackupServerList(selectGroupId); foreach (BackupServer gbs in gbpList) { DataGridViewRow dgvr = new DataGridViewRow(); foreach (DataGridViewColumn c in dgrdBackupServer.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);//add row cells } dgvr.Cells[0].Value = gbs.id; dgvr.Cells[1].Value = gbs.backupServerName; this.dgrdBackupServer.Rows.Add(dgvr); } } }
private void FrmGroupDetail_FormClosing(object sender, FormClosingEventArgs e) { string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString(); IBackupServerGroupDetailService backGroupDetail = BLLFactory.ServiceAccess.CreateBackupServerGroupDetailService(); IList <BackupServerGroupDetail> bsgdLists = backGroupDetail.GetBackupServerGroupDetailByGroupId(selectGroupId); List <string> list1 = new List <string>(); List <string> list2 = new List <string>(); foreach (BackupServerGroupDetail bsgd in bsgdLists) { list1.Add(bsgd.backupServerId.ToString()); } for (int i = 0; i < this.dgrdMonitorServer.Rows.Count; i++) { list2.Add(this.dgrdMonitorServer.Rows[i].Cells[0].Value.ToString()); } if (list1.Count != list2.Count) { //if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle)) //{ // e.Cancel = false; //} //else //{ // e.Cancel = true; //} } else { bool flag = false; foreach (string i in list1) { if (!list2.Contains(i)) { flag = true; break; } } if (flag) { if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle)) { e.Cancel = false; } else { e.Cancel = true; } } } }
private void btnGroupDetailSave_Click(object sender, EventArgs e) { IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); IBackupServerGroupDetailService backGroupDetail = BLLFactory.ServiceAccess.CreateBackupServerGroupDetailService(); //get the combobox selected value string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString(); if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle)) { int delFlg = backGroupDetail.DeleteBackupServerGroupDetailByGroupId(Convert.ToInt32(selectGroupId), FrmMain.userinfo.loginID); if (delFlg > -1) { for (int i = 0; i < this.dgrdMonitorServer.Rows.Count; i++) { BackupServerGroupDetail bsgd = new BackupServerGroupDetail(); string backupServerId = this.dgrdMonitorServer.Rows[i].Cells[0].Value.ToString(); bsgd.backupServerGroupId = Convert.ToInt32(selectGroupId); bsgd.backupServerId = Convert.ToInt32(backupServerId); bsgd.creater = FrmMain.userinfo.loginID; bsgd.createDate = DateTime.Now.ToString(); bsgd.updater = FrmMain.userinfo.loginID; bsgd.updateDate = DateTime.Now.ToString(); int insertFlg = backGroupDetail.InsertBackupServerGroupDetail(bsgd); if (insertFlg > -1) { MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle); this.Dispose(); } else { MsgHelper.InfoMsg(ValidationRegex.I002, ValidationRegex.publicTitle); } } } } }
public BackupServerGroupDetailManager(IBackupServerGroupDetailService backupServerGroupDetailService) { this.backupServerGroupDetailService = backupServerGroupDetailService; }