/// <summary> /// init the backup server modifification page /// </summary> private void FrmTransfer_Load(object sender, EventArgs e) { //get monitor server by record id if (!String.IsNullOrWhiteSpace(id)) { IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); backupServer = bs.GetBackupServerById(Convert.ToInt32(id)); this.txtTrId.Text = backupServer.id.ToString(); this.txtTrName.Text = backupServer.backupServerName; this.txtTrIp.Text = backupServer.backupServerIP; this.txtTrMemo.Text = backupServer.memo; this.txtTraccount.Text = backupServer.account; this.txtTrPass.Text = backupServer.password; this.txtTrStfile.Text = backupServer.startFile; //Set the related MonitorServer. this.innerBackupServerGroup = groupSerivce.GetBackupServerGroupByBackupServerID(Convert.ToInt32(id)); foreach (object item in this.cobMonitorServer.Items) { ComboBoxItem cobItem = (ComboBoxItem)item; if (cobItem.Value != null && cobItem.Value.Equals(this.innerBackupServerGroup.monitorServerID)) { this.cobMonitorServer.SelectedItem = item; break; } } this.txtBackupServerGroupName.Text = this.innerBackupServerGroup.backupServerGroupName; } else { this.IP_StartFolder = CommonUtil.GetTransfer_IP_StartFolder(); } }
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 btnSave_Click(object sender, EventArgs e) { bool mesFlg = messageCheck(); if (mesFlg) { return; } else { string id = this.txtTrId.Text; //save operation //BackupServer backupServer = new BackupServer(); this.innerBackupServerGroup.monitorServerID = this.cobMonitorServer.SelectedValue.ToString(); this.innerBackupServerGroup.backupServerGroupName = innerBackupServer.backupServerName = this.txtTrName.Text.Trim(); innerBackupServer.backupServerIP = this.txtTrIp.Text.Trim(); this.innerBackupServerGroup.memo = innerBackupServer.memo = this.txtTrMemo.Text.Trim(); innerBackupServer.account = this.txtTraccount.Text.Trim(); innerBackupServer.password = this.txtTrPass.Text.Trim(); innerBackupServer.startFile = this.txtTrStfile.Text.Trim(); innerBackupServer.ssbpath = this.txtssbpath.Text.Trim(); this.innerBackupServerGroup.deleteFlg = innerBackupServer.deleteFlg = 0; this.innerBackupServerGroup.creater = innerBackupServer.creater = FrmMain.userinfo.loginID; this.innerBackupServerGroup.createDate = innerBackupServer.createDate = CommonUtil.DateTimeNowToString(); this.innerBackupServerGroup.updater = innerBackupServer.updater = FrmMain.userinfo.loginID; this.innerBackupServerGroup.updateDate = innerBackupServer.updateDate = CommonUtil.DateTimeNowToString(); IBackupServerService backupService = BLLFactory.ServiceAccess.CreateBackupServer(); //int flag = -1; if (id == "") { 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 { innerBackupServer.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 cobBKServerGroup_SelectedIndexChanged(object sender, EventArgs e) { if (changed) { //get the combobox selected value string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString(); IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); //remove the monitor current row //RowNumber = this.dgrdMonitorServer.CurrentCell.RowIndex; //dgrdMonitorServer.Rows.RemoveAt(RowNumber); //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 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); } } } } }
private void btnLeft_Click(object sender, EventArgs e) { //save or delete group detail data //get the selected row data from dgrdBackupServer if (null == this.dgrdBackupServer.CurrentCell) { return; } BackupServerGroupDetail bsgd = new BackupServerGroupDetail(); string backupServerId = dgrdBackupServer.CurrentRow.Cells[0].Value.ToString(); string backupServerName = dgrdBackupServer.CurrentRow.Cells[1].Value.ToString(); //get the combobox selected value string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString(); IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); //empty the monitor rows this.dgrdMonitorServer.AllowUserToAddRows = false; this.dgrdMonitorServer.Rows.Add(backupServerId, backupServerName); //empty the monitor rows this.dgrdBackupServer.AllowUserToAddRows = false; this.dgrdBackupServer.Rows.RemoveAt(this.dgrdBackupServer.CurrentCell.RowIndex); }
public BackupServerManager(IBackupServerService backupServerService) { this.backupServerService = backupServerService; }
private void FrmGroupDetail_Load(object sender, EventArgs e) { //init the backup group select tab IBackupServerGroupService backGroupList = BLLFactory.ServiceAccess.CreateBackupServerGroupService(); IBackupServerService bs = BLLFactory.ServiceAccess.CreateBackupServer(); IList <BackupServerGroup> bsgList = backGroupList.GetBackupServerGroupList(); List <ComboBoxItem> cbiList = new List <ComboBoxItem>(); int index = 0; int i = 0; foreach (BackupServerGroup bgs in bsgList) { if (bgs.id == id) { index = i; } cbiList.Add(new ComboBoxItem(bgs.id.ToString(), bgs.backupServerGroupName)); i++; } this.cobBKServerGroup.DisplayMember = "Text"; this.cobBKServerGroup.ValueMember = "Value"; this.cobBKServerGroup.DataSource = cbiList; //set the combobox default value; this.cobBKServerGroup.SelectedIndex = index; //not allowed user add new row to datagridview this.dgrdMonitorServer.AllowUserToAddRows = false; IList <BackupServer> gbsList = bs.GetGroupBackupServerList(this.cobBKServerGroup.SelectedValue.ToString()); 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); } //not allowed user add new row to datagridview this.dgrdBackupServer.AllowUserToAddRows = false; IList <BackupServer> bsList = bs.GetPartBackupServerList(this.cobBKServerGroup.SelectedValue.ToString()); foreach (BackupServer bserver in bsList) { 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 = bserver.id; dgvr.Cells[1].Value = bserver.backupServerName; this.dgrdBackupServer.Rows.Add(dgvr); } changed = true; }