Пример #1
0
        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);
            }
        }
Пример #2
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);
                }
            }
        }
Пример #3
0
        public ActionResult Add(BackupServerGroup model, BackupServer bkModel)
        {
            int result = -1;

            //session获取值
            if (Session["LoginId"] == null)
            {
                result = -99;
            }
            else
            {
                try
                {
                    string dt      = CommonUtil.DateTimeNowToString();
                    string loginId = Session["LoginId"].ToString();

                    model.backupServerGroupName = bkModel.backupServerName;
                    model.creater    = loginId;
                    model.createDate = dt;
                    model.updater    = loginId;
                    model.updateDate = dt;
                    model.deleteFlg  = 0;
                    result           = groupSerivce.InsertBackupServerGroup(model);

                    bkModel.creater    = loginId;
                    bkModel.createDate = dt;
                    bkModel.updater    = loginId;
                    bkModel.updateDate = dt;
                    bkModel.deleteFlg  = 0;
                    result             = bkService.InsertBackupServer(bkModel);

                    //add relation detail
                    IList <BackupServerGroup> groupList = groupSerivce.GetBackupServerGroupByName(model.backupServerGroupName);
                    IList <BackupServer>      bkList    = bkService.GetBackupServerListByName(bkModel.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             = loginId;
                        modelDetail.createDate          = dt;
                        modelDetail.updater             = loginId;
                        modelDetail.updateDate          = dt;
                        result = groubDetailService.InsertBackupServerGroupDetail(modelDetail);
                    }
                }
                catch (Exception ex)
                {
                    result = -10;
                    logger.Error(ex.Message);
                }
            }
            Response.Write(result);
            Response.End();
            return(null);
        }
Пример #4
0
        public ActionResult AddDetail(int groupId)
        {
            int result = -1;

            if (Session["LoginId"] == null)
            {
                result = -99;
            }
            else
            {
                if (Request.Form != null)
                {
                    string dt = CommonUtil.DateTimeNowToString();
                    try
                    {
                        for (int i = 0; i < Request.Form.Count; i++)
                        {
                            BackupServerGroupDetail model = new BackupServerGroupDetail();
                            model.backupServerGroupId = groupId;
                            model.backupServerId      = Convert.ToInt16(Request.Form[Request.Form.Keys[i]].ToString());
                            model.deleteFlg           = 0;
                            model.creater             = Session["LoginId"].ToString();
                            model.createDate          = dt;
                            model.updater             = Session["LoginId"].ToString();
                            model.updateDate          = dt;
                            result = groubDetailService.InsertBackupServerGroupDetail(model);
                        }
                    }
                    catch (Exception ex)
                    {
                        result = -10;
                        logger.Error(ex.Message);
                    }
                }
            }
            Response.Write(result);
            Response.End();
            return(null);
        }
Пример #5
0
        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);
                        }
                    }
                }
            }
        }