Exemplo n.º 1
0
 public ErrorResult Insert(Sys_Template entity)
 {
     ErrorResult result = new ErrorResult();
     if (entity.Type == 0 && entity.Lever > 2)
     {
         result.Flag = false;
         result.Message = "栏目编码最多有两层";
         return result;
     }
     int res = GetCountByCode(entity.TemplateCode);
     if (res > 0)
     {
         result.Flag = false;
         result.Message = "栏目编码不能重复";
         return result;
     }
     result = new Helper().Insert(entity);
     return result;
 }
Exemplo n.º 2
0
 public ActionResult Delete(int Id)
 {
     ErrorResult result = new ErrorResult();
     List<Sys_Dept> listDept = new Sys_DeptDAL().GetList(Id);
     if (listDept != null && listDept.Count > 0)
     {
         result.Flag = false;
         result.Message = "此部门下面有子部门或者人员";
         return Json(result);
     }
     List<Sys_User> listUser = new Sys_UserDAL().GetList(Id);
     if (listUser != null && listUser.Count > 0)
     {
         result.Flag = false;
         result.Message = "此部门下面有子部门或者人员";
         return Json(result);
     }
     result = new Sys_DeptDAL().Delete(Id);
     return Json(result);
 }
Exemplo n.º 3
0
 public ActionResult Logins(string account, string password)
 {
     ErrorResult result = new ErrorResult();
     Sys_User entity = new Sys_UserDAL().Login(account, password);
     if (entity != null)
     {
         var count = 0;
         result.Flag = true;
         List<SysTemplateViewModel> template = new List<SysTemplateViewModel>();
         LoginUser model = new LoginUser();
         model.DeptId = entity.DeptId;
         model.UserId = entity.Id;
         model.UserName = entity.Account;
         List<Sys_UserRole> userRoleList = new Sys_UserRoleDAL().GetList(entity.Id);
         if (userRoleList != null && userRoleList.Count > 0)
         {
             Session["RoleName"] = new Sys_RoleDAL().GetModel(userRoleList[0].RoleId).RoleName;
             foreach (var item in userRoleList)
             {
                 List<SysTemplateViewModel> templateItemList = new Sys_TemplateDAL().GetViewListByRoleId(item.RoleId);
                 template.AddRange(templateItemList);
                 template.Union(templateItemList).ToList();
             }
         }
         Session["UserName"] = model.UserName;
         model.UserRoleList = userRoleList;
         model.ActionList = template;
         Session["data"] = model;
         Session["menu"] = template;
         SessionHelper.Add("Re_USER_OBJ", model.UserName, 60);
     }
     else
     {
         result.Flag = false;
         result.Message = "用户名或者密码";
     }
     return Json(result);
 }