Esempio n. 1
0
        public string Update(Role r)
        {
            string msg = "编辑失败";

            if (HasRoleName(r.RoleName, r.KeyId))
            {
                msg = "角色名称已存在。";
            }
            Role old = RoleDal.Instance.Get(r.KeyId);
            int  k   = RoleDal.Instance.Update(r);

            if (k > 0)
            {
                msg = "编辑成功";
                LogBll <Role> log = new LogBll <Role>();
                log.UpdateLog(old, r);
            }

            if (r.IsDefault == 1)
            {
                SetDefaultRole(r.KeyId);
            }

            return(new JsonMessage {
                Success = true, Data = k.ToString(), Message = msg
            }.ToString());
        }
Esempio n. 2
0
        public string EditDepartment(Department dep)
        {
            string msg    = "修改失败。";
            int    k      = 0;
            var    oldDep = DepartmentDal.Instance.Get(dep.KeyId);

            if (HasDepartmentBy(dep.DepartmentName, dep.KeyId))
            {
                msg = "部门名称已存在。";
            }
            else
            {
                k = DepartmentDal.Instance.Update(dep);
                if (k > 0)
                {
                    msg = "修改成功。";
                    LogBll <Department> log = new LogBll <Department>();
                    log.UpdateLog(oldDep, dep);
                }
            }

            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
Esempio n. 3
0
        public string EditNav(Navigation nav)
        {
            string     msg    = "编辑失败。";
            Navigation oldNav = GetBy(nav.KeyId);

            if (HasNav(nav.NavTitle, nav.KeyId))
            {
                msg = "菜单名称已存在。";
            }

            int k = NavigationDal.Instance.Update(nav);

            if (k > 0)
            {
                msg = "编辑成功。";
                LogBll <Navigation> log = new LogBll <Navigation>();
                log.UpdateLog(oldNav, nav);
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
Esempio n. 4
0
        public int Edit(Dic d)
        {
            if (HasDicCode(d.Code, d.KeyId))
            {
                return(0); //字典编码已存在
            }

            Dic oldDic = DicDal.Instance.Get(d.KeyId);


            int i = DicDal.Instance.Update(d);

            if (i > 0)
            {
                if (d.IsDefault == 1)
                {
                    DicDal.Instance.UpdateDefaultState(d.KeyId);
                }

                LogBll <Dic> log = new LogBll <Dic>();
                log.UpdateLog(oldDic, d);
            }
            return(i);
        }