Пример #1
0
        public ActionResult RigAdminUserRoleAdd(AdminModel model)
        {
            RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"];

            if (ModelState.IsValid)
            {
                LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("Position");

                UserModel user = ServiceSystem.GetUser(model.Passport);
                model.Name   = user.DisplayName;
                model.UserId = user.Passport;
                model.dt     = DateTime.Now;
                DataTable dt = this.GetIaType();
                if (model.Position == null || dt.Select("Name='" + model.Position + "'").Length == 0)
                {
                    model.Position = (string)lkpList.GetDisplayValue(user.Position);
                }

                IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Admin);
                AdminModel            item      = dataModel.GetItem(string.Format("UserId=\"{0}\" and RoleId={1} and Position=\"{2}\" ", model.UserId, model.RoleId, model.Position), "id");
                if (item == null)
                {
                    model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.Admin, model, true);
                }
            }

            return(PartialView("RigAdminUserRolePartial", manageRigModel.AdminUsers));
        }
Пример #2
0
        public ActionResult RigAdminIsolationLockAdd(LockModel model)
        {
            RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"];

            if (ModelState.IsValid)
            {
                LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("YesNoList");
                int listId = 0;
                if (!int.TryParse(model.Available, out listId))
                {
                    listId = 0;
                }
                model.Available = (string)lkpList.GetDisplayValue(listId);

                model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.IsolationLock, model, true);
            }

            return(PartialView("RigAdminIsolationLockPartial", manageRigModel.IsolationLocks));
        }