Ejemplo n.º 1
0
        //public ActionResult GetList(int DeptId)
        //{
        //    List<Sys_User> list = new Sys_UserDAL().GetList(DeptId);
        //    return Json(list);
        //}

        public ActionResult GetList(int DeptId, int page = 1)
        {
            PagerInfo pi = new PagerInfo();
            pi.CurrenetPageIndex = page;
            ObjEntity list = new Sys_UserDAL().GetList(DeptId, pi);
            return Json(new { data = list.ResultData, pager = list.ResultPager });
        }
Ejemplo 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);
 }
Ejemplo 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);
 }
Ejemplo n.º 4
0
 public ActionResult Update(Sys_User entity)
 {
     ErrorResult result = new Sys_UserDAL().Update(entity);
     return Json(result);
 }
Ejemplo n.º 5
0
 public ActionResult Add(Sys_User entity)
 {
     entity.Password = "******";
     ErrorResult result = new Sys_UserDAL().Insert(entity);
     return Json(result);
 }