示例#1
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);
        }
示例#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);
            }
        }