Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var user = UserBD.Get(id);
            var m    = new UserEditVM
            {
                Input = Map <User, UserEditVM.EditInput>(user)
            };

            foreach (var func in user.Dept.Corp.Funcs)
            {
                m.Input.CorpFuncIds = m.Input.CorpFuncIds + "," + func.Id;
            }
            if (m.Input.CorpFuncIds != "")
            {
                m.Input.CorpFuncIds = m.Input.CorpFuncIds.Substring(1);
            }
            foreach (var func in user.Dept.Funcs)
            {
                m.Input.DeptFuncIds = m.Input.DeptFuncIds + "," + func.Id;
            }
            if (m.Input.DeptFuncIds != "")
            {
                m.Input.DeptFuncIds = m.Input.DeptFuncIds.Substring(1);
            }
            foreach (var func in user.Funcs)
            {
                m.Input.UserFuncIds = m.Input.UserFuncIds + "," + func.Id;
            }
            if (m.Input.UserFuncIds != "")
            {
                m.Input.UserFuncIds = m.Input.UserFuncIds.Substring(1);
            }
            m.CanChangeUserFunc = (!user.Equals(GetLoginUser()) && CanAccess("_ChangeUserFunc"));
            return(ForView(m));
        }
Ejemplo n.º 2
0
 public ActionResult Save(UserEditVM editvm)
 {
     if (ModelState.IsValid)
     {
         Save(editvm.Input);
         SetViewMessage(Message_SaveSuccessfully);
         if (editvm.Input.Id == 0)
         {
             return(RcJson());
         }
     }
     return(ClientShowMessage());
 }
Ejemplo n.º 3
0
        public ActionResult Add(int?deptId)
        {
            var m = new UserEditVM {
                Input = new UserEditVM.EditInput {
                    IsActive = true
                }
            };

            if (deptId != null)
            {
                m.Input.Dept = new DORef <Dept>(deptId.Value);
            }
            m.CanChangeUserFunc = CanAccess("_ChangeUserFunc");
            return(ForView("Edit", m));
        }