/// <summary> /// init the monitor server modifification page /// </summary> private void FrmGroupTransfer_Load(object sender, EventArgs e) { //get monitor server by record id IBackupServerGroupService bs = BLLFactory.ServiceAccess.CreateBackupServerGroupService(); backupServerGroup = bs.GetBackupServerGroupById(Convert.ToInt32(id)); this.txtMonitorId.Text = backupServerGroup.id.ToString(); this.txtMonitorName.Text = backupServerGroup.backupServerGroupName; this.txtMonitorMemo.Text = backupServerGroup.memo; this.cobMonitorServer.SelectedValue = backupServerGroup.monitorServerID; }
/// <summary> /// /// </summary> private void dgrdMain_Load() { //init dgrdMain //not allowed user add new row to datagridview this.dgrdMain.AllowUserToAddRows = false; this.dgrdMain.Rows.Clear(); //init table data IBackupServerGroupService bss = BLLFactory.ServiceAccess.CreateBackupServerGroupService(); IList <MonitorServer> lists = MonitorServerService.GetMonitorServerList(); int i = 1; foreach (MonitorServer list in lists) { string monitorServerId = list.id; string backupGroupid = "0"; DataGridViewRow dgvr = new DataGridViewRow(); try { foreach (DataGridViewColumn c in dgrdMain.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);//add row cells } dgvr.Cells[0].Value = list.id; dgvr.Cells[1].Value = i.ToString(); dgvr.Cells[2].Value = list.monitorServerName; BackupServerGroup result = bss.GetBackupServerGroupByMonitorId(Int32.Parse(list.id)); if (result != null) { dgvr.Cells[3].Value = result.backupServerGroupName; dgvr.Cells[3].Tag = result.id; backupGroupid = result.id; } else { dgvr.Cells[3].Value = "バックアップ先選択"; dgvr.Cells[3].Tag = 0; } dgvr.Cells[4].Value = ""; dgvr.Cells[5].Value = "転送始める"; dgvr.Cells[5].Tag = 0; dgvr.Cells[6].Value = "転送停止"; this.dgrdMain.Rows.Add(dgvr); int rowIndex = dgvr.Cells[0].RowIndex; if (backupGroupid != "0" && !GlobalVariable.stopTransferThread.ContainsKey(list.id)) { bool transfer = ButtonTansferStart(list.id, backupGroupid, rowIndex); } i++; } catch (Exception ex) { logger.Error(ex.Message); continue; } } }
public BackupServerGroupManager(IBackupServerGroupService backupServerGroupService) { this.backupServerGroupService = backupServerGroupService; }
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; }