Ejemplo n.º 1
0
        public ActionResult SelectUser()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.Sms.SelectUser();
                if (Request["UserType"] != null)
                {
                    Code.EnumHelper.SysUserType userType;
                    Enum.TryParse(Request["UserType"], out userType);
                    vm.UserType = userType;
                }

                var tb = from p in db.Table <Sys.Entity.tbSysUser>()
                         select p;

                if (string.IsNullOrEmpty(vm.SearchText) == false)
                {
                    tb = tb.Where(d => d.UserCode.Contains(vm.SearchText) || d.UserName.Contains(vm.SearchText) || d.Mobile.Contains(vm.SearchText));
                }

                vm.SelectUserList = (from p in tb
                                     where p.UserType == vm.UserType
                                     orderby p.UserCode
                                     select new Dto.Sms.SelectUser
                {
                    Id = p.Id,
                    UserCode = p.UserCode,
                    UserName = p.UserName,
                    SexName = p.tbSex.SexName,
                    Mobile = p.Mobile,
                    UserType = p.UserType
                }).ToPageList(vm.Page);
                return(View(vm));
            }
        }
Ejemplo n.º 2
0
 public ActionResult SelectUser(Models.Sms.SelectUser vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("SelectUser",
                                                 new
     {
         searchText = vm.SearchText,
         userType = vm.UserType,
         pageIndex = vm.Page.PageIndex,
         pageSize = vm.Page.PageSize
     })));
 }
Ejemplo n.º 3
0
 public ActionResult SelectUserJson(List <int> ids)
 {
     using (var db = new XkSystem.Models.DbContext())
     {
         var vm = new Models.Sms.SelectUser();
         var tb = (from p in db.Table <Sys.Entity.tbSysUser>()
                   where ids.Contains(p.Id)
                   select new Dto.Sms.SelectUser
         {
             Id = p.Id,
             UserCode = p.UserCode,
             UserName = p.UserName,
             SexName = p.tbSex.SexName,
             Mobile = p.Mobile,
             UserType = p.UserType
         }).ToList();
         return(Json(tb, JsonRequestBehavior.AllowGet));
     }
 }