Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="BackupServerGroupDetail"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        public int UpdateBackupServerGroupDetail(BackupServerGroupDetail BackupServerGroupDetail, OdbcConnection conn)
        {
            int    result = -1;
            string sql    = @"UPDATE backupServerGroupDetail
                               SET backupServerGroupID = ?
                                  ,backupServerID = ?                                  
                                  ,updater = ?
                                  ,updateDate = ?
                             WHERE id=?";

            OdbcParameter[] para = new OdbcParameter[] {
                new OdbcParameter("@backupServerGroupID", BackupServerGroupDetail.backupServerGroupId),
                new OdbcParameter("@backupServerID", BackupServerGroupDetail.backupServerId),
                new OdbcParameter("@updater", BackupServerGroupDetail.updater),
                new OdbcParameter("@updateDate", BackupServerGroupDetail.updateDate),
                new OdbcParameter("@id", BackupServerGroupDetail.id)
            };
            try
            {
                result = db.Udaquery(sql, conn, para);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        public int UpdateBackupServerGroupDetail(BackupServerGroupDetail BackupServerGroupDetail, SqlConnection conn)
        {
            int    result = -1;
            string sql    = @"UPDATE backupServerGroupDetail
                               SET backupServerGroupID = @servergroupid
                                  ,backupServerID = @serverid                                  
                                  ,updater = @updater
                                  ,updateDate = @updatedate
                             WHERE id=@id";

            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@servergroupid", BackupServerGroupDetail.backupServerGroupId),
                new SqlParameter("@serverid", BackupServerGroupDetail.backupServerId),
                new SqlParameter("@updater", BackupServerGroupDetail.updater),
                new SqlParameter("@updateDate", BackupServerGroupDetail.updateDate),
                new SqlParameter("@id", BackupServerGroupDetail.id)
            };
            try
            {
                result = db.Udaquery(sql, conn, para);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public int InsertBackupServerGroupDetail(BackupServerGroupDetail BackupServerGroupDetail, SqlConnection conn)
 {
     try
     {
         return(db.insert(BackupServerGroupDetail, "backupServerGroupDetail", conn));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 7
0
        public int InsertBackupServerGroupDetail(BackupServerGroupDetail BackupServerGroupDetail)
        {
            OdbcConnection conn;
            int            count = 0;

            using (conn = OdbcHelper.CreateConntion())
            {
                conn.Open();
                count = BackupServerGroupDetailDal.InsertBackupServerGroupDetail(BackupServerGroupDetail, conn);
                conn.Close();
            }
            return(count);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        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);
        }