示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 /// <summary>
 /// 明細設定ページ
 /// </summary>
 /// <returns></returns>
 public ActionResult DetailEdit(int id)
 {
     try
     {
         ViewData["serverList"]   = sService.GetBackupServerList();
         ViewData["groupList"]    = groupSerivce.GetBackupServerGroupList();
         ViewData["selectList"]   = sService.GetGroupBackupServerList(id.ToString());
         ViewData["unSelectList"] = sService.GetPartBackupServerList(id.ToString());
         ViewData["groupId"]      = id.ToString();
     }
     catch (Exception ex)
     {
         ViewData["serverList"]   = new List <BackupServer>();
         ViewData["groupList"]    = new List <BackupServerGroup>();
         ViewData["selectList"]   = new List <BackupServer>();
         ViewData["unSelectList"] = new List <BackupServer>();
         ViewData["groupId"]      = "";
         logger.Error(ex.Message);
     }
     return(View());
 }
示例#4
0
        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;
        }