/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomTypeViewModel> GetAllList() { JsonRsp <CustomTypeViewModel> rsp = new JsonRsp <CustomTypeViewModel>(); List <CustomTypeModel> list = GetAllModelList(); rsp.data = list.ConvertAll <CustomTypeViewModel>(o => { return(new CustomTypeViewModel() { ID = o.ID, CustomTypeName = o.CustomTypeName, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
public JsonRsp <TreeSelect> GetMenuTreeSelect(int roleId) { string menuIds = "0"; if (roleId > 0) { AdminRole role = new AdminRoleBLL().GetModelById(roleId); if (role != null) { menuIds = "," + role.MenuIds + ","; } } JsonRsp <TreeSelect> rsp = new JsonRsp <TreeSelect>(); List <AdminMenu> list = GetAllModelList();//使用OQL扩展 List <TreeSelect> allList = list.ConvertAll <TreeSelect>(o => { return(new TreeSelect() { id = o.ID, value = o.ID, ParentID = o.ParentID, name = o.MenuName, isChecked = menuIds.IndexOf("," + o.ID + ",") > -1, }); } ); rsp.data = getMenuNodes(0, 0, allList); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketTypeViewModel> GetAllList() { JsonRsp <TicketTypeViewModel> rsp = new JsonRsp <TicketTypeViewModel>(); rsp.data = GetAllModelList().ConvertAll <TicketTypeViewModel>(o => { return(new TicketTypeViewModel() { ID = o.ID, TicketTypeName = o.TicketTypeName, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime == null ? "" : Convert.ToDateTime(o.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <AccountViewModel> GetAllList() { JsonRsp <AccountViewModel> rsp = new JsonRsp <AccountViewModel>(); AdminAccount model = new AdminAccount(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminAccount> list = q.ToList <AdminAccount>();//使用OQL扩展 rsp.data = list.ConvertAll <AccountViewModel>(o => { return(new AccountViewModel() { ID = o.ID, AccountName = o.AccountName, TrueName = o.TrueName, Status = o.Status, LoginTime = o.LoginTime, LastLoginTime = o.LastLoginTime, LoginCount = o.LoginCount, CreateTime = o.CreateTIme, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <ProductTypeViewModel> GetAllList() { JsonRsp <ProductTypeViewModel> rsp = new JsonRsp <ProductTypeViewModel>(); rsp.data = GetAllModelList().ConvertAll <ProductTypeViewModel>(o => { return(new ProductTypeViewModel() { ID = o.ID, ProductTypeName = o.ProductTypeName, MerchantTypeId = o.MerchantTypeId, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomViewModel> GetAllList() { JsonRsp <CustomViewModel> rsp = new JsonRsp <CustomViewModel>(); rsp.data = GetAllModelList().ConvertAll <CustomViewModel>(o => { return(new CustomViewModel() { ID = o.ID, CustomTypeId = o.CustomTypeId, CustomName = o.CustomName, LinkPhone = o.LinkPhone, LinkName = o.LinkName, LinkMobile = o.LinkMobile, CustomArea = o.CustomArea, CustomAddress = o.CustomAddress, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
public JsonRsp <TreeSelect> GetRoleTreeSelect(int accountId) { List <long> roleIds = GetRoles(accountId); JsonRsp <TreeSelect> rsp = new JsonRsp <TreeSelect>(); AdminRole model = new AdminRole(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminRole> list = q.ToList <AdminRole>();//使用OQL扩展 List <TreeSelect> allList = list.ConvertAll <TreeSelect>(o => { return(new TreeSelect() { value = o.ID, name = o.RoleName, isChecked = roleIds.Contains(o.ID), }); } ); rsp.data = allList; rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketBatchViewModel> GetAllList() { JsonRsp <TicketBatchViewModel> rsp = new JsonRsp <TicketBatchViewModel>(); TicketBatchModel model = new TicketBatchModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <TicketBatchModel> list = q.ToList <TicketBatchModel>();//使用OQL扩展 rsp.data = list.ConvertAll <TicketBatchViewModel>(o => { return(new TicketBatchViewModel() { ID = o.ID, TicketTypeId = o.TicketTypeId, TicketBatchNo = o.TicketBatchNo, TicketPrefix = o.TicketPrefix, DataFrom = o.DataFrom, Count = o.Count, TicketBatchName = o.TicketBatchName, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Status = o.Status, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomAccReceiptEntryViewModel> GetAllList() { JsonRsp <CustomAccReceiptEntryViewModel> rsp = new JsonRsp <CustomAccReceiptEntryViewModel>(); rsp.data = GetAllModelList().ConvertAll <CustomAccReceiptEntryViewModel>(o => { return(new CustomAccReceiptEntryViewModel() { ID = o.ID, CustomAccReceiptId = o.CustomAccReceiptId, BankAccountId = o.BankAccountId, CurrentAmount = o.CurrentAmount, BankSerialNumber = o.BankSerialNumber, DateOfEntry = o.DateOfEntry, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Status = o.Status, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <MenuViewModel> GetAllList() { JsonRsp <MenuViewModel> rsp = new JsonRsp <MenuViewModel>(); AdminMenu model = new AdminMenu(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 rsp.data = list.ConvertAll <MenuViewModel>(o => { return(new MenuViewModel() { ID = o.ID, MenuKey = o.MenuKey, MenuName = o.MenuName, MenuUrl = o.MenuUrl, MenuType = o.MenuType, IDPath = o.IDPath, Remark = o.Remark, Sort = o.Sort, Status = o.Status, CreateTIme = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
public JsonRsp <TreeSelect> GetMenuTreeSelect(int roleId) { AdminRole role = new AdminRoleBLL().GetModelById(roleId); string menuIds = "," + role.MenuIds + ","; int[] checkedArray = Array.ConvertAll(role.MenuIds.Split(','), int.Parse); JsonRsp <TreeSelect> rsp = new JsonRsp <TreeSelect>(); AdminMenu model = new AdminMenu(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 List <TreeSelect> allList = list.ConvertAll <TreeSelect>(o => { return(new TreeSelect() { value = o.ID, ParentID = o.ParentID, name = o.MenuName, isChecked = menuIds.IndexOf("," + o.ID + ",") > -1, }); } ); rsp.data = getMenuNodes(0, 0, allList); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <RoleViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <RoleViewModel> rsp = new JsonRsp <RoleViewModel>(); AdminRole m = new AdminRole(); OQL q = OQL.From(m) .Select(m.ID, m.RoleName, m.Status, m.CreateTIme) .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <AdminRole> list = q.ToList <AdminRole>();//使用OQL扩展 rsp.data = list.ConvertAll <RoleViewModel>(o => { return(new RoleViewModel() { ID = o.ID, RoleName = o.RoleName, Status = o.Status, CreateTIme = o.CreateTIme.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CinemaChainViewModel> GetAllList() { JsonRsp <CinemaChainViewModel> rsp = new JsonRsp <CinemaChainViewModel>(); CinemaChainModel model = new CinemaChainModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <CinemaChainModel> list = q.ToList <CinemaChainModel>();//使用OQL扩展 rsp.data = list.ConvertAll <CinemaChainViewModel>(o => { return(new CinemaChainViewModel() { ID = o.ID, CinemaChainName = o.CinemaChainName, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime == null ? "" : Convert.ToDateTime(o.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <AdminActionViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <AdminActionViewModel> rsp = new JsonRsp <AdminActionViewModel>(); AdminAction action = new AdminAction(); AdminMenu menu = new AdminMenu(); //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(action) .Join(menu).On(action.MenuId, menu.ID) .Select(action.ID, menu.MenuName, action.ActionKey, action.ActionName, action.Status, action.CreateTime) .OrderBy(action.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <AdminActionViewModel>)ec.MapToList <AdminActionViewModel>(() => new AdminActionViewModel() { ID = action.ID, MenuId = menu.ID, MenuName = menu.MenuName, ActionKey = action.ActionKey, ActionName = action.ActionName, Status = action.Status, CreateTime = action.CreateTime, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <BankViewModel> GetAllList() { JsonRsp <BankViewModel> rsp = new JsonRsp <BankViewModel>(); List <BankModel> list = GetAllModelList();//使用OQL扩展 rsp.data = list.ConvertAll <BankViewModel>(o => { return(new BankViewModel() { ID = o.ID, BankName = o.BankName, BankType = o.BankType, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Sort = o.Sort, Status = o.Status, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 登录 /// </summary> /// <param name="customerID"></param> /// <returns></returns> public JsonRsp Login(string accountName, string accountPwd) { JsonRsp json = new JsonRsp(); AdminAccount model = new AdminAccount(); model.AccountName = accountName; OQL q = OQL.From(model) .Select() .Where(model.AccountName) //以用户名和密码来验证登录 .END; model = q.ToEntity <AdminAccount>();//ToEntity,OQL扩展方法 if (model == null) { json.success = false; json.retmsg = "账号或密码不匹配"; } else { if (model.AccountPwd == EncryptHelper.MD5Encoding(accountPwd, model.Salt)) { json.success = true; json.code = 0; json.returnObj = model; } else { json.success = false; json.retmsg = "账号或密码不匹配"; } } return(json); }
/// <summary> /// 增 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonRsp Add(AdminAccount model) { JsonRsp json = CheckAccount(model.AccountName); if (!json.success) { json.retmsg = "该用户名已存在"; return(json); } if (string.IsNullOrEmpty(model.AccountPwd)) { model.AccountPwd = "888888"; } //salt string strSalt = Guid.NewGuid().ToString(); model.Salt = strSalt; model.AccountPwd = EncryptHelper.MD5Encoding(model.AccountPwd, strSalt); int returnvalue = Add <AdminAccount>(model); return(new JsonRsp { success = returnvalue > 0, code = returnvalue }); }
/// <summary> /// 获取列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomFinancialModel> GetList(long customId, int moneyType) { JsonRsp <CustomFinancialModel> rsp = new JsonRsp <CustomFinancialModel>(); rsp.data = GetAllModelList().FindAll(o => o.CustomId == customId); rsp.success = true; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomModel> GetPageList(string searchTxt, int pageIndex, int pageSize) { CustomModel CustomModel = new Model.Custom.CustomModel(); JsonRsp <CustomModel> rsp = new JsonRsp <CustomModel>(); OQLCompareFunc <CustomModel> cmpResult = (cmp, c) => ( //cmp.Property(c.CustomName) == "ABC" & cmp.Comparer(c.CustomName, OQLCompare.CompareType.Like, "%" + searchTxt + "%") ); rsp.success = true; rsp.code = 0; rsp.data = GetList <CustomModel>(cmpResult, null, pageSize, pageIndex); //CustomModel model = new CustomModel(); //CustomTypeModel customType = new CustomTypeModel(); //model.TenantId = TenantId; ////Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 //OQL joinQ = OQL.From(model) // .Join(customType).On(model.CustomTypeId, customType.ID) // .Select() // .OrderBy(model.Sort, "desc") // .END; //joinQ.Limit(pageSize, pageIndex, true); //PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); //EntityContainer ec = new EntityContainer(joinQ, db); //rsp.data = (List<CustomViewModel>)ec.MapToList<CustomViewModel>(() => new CustomViewModel() //{ // ID = model.ID, // CustomTypeId = model.CustomTypeId, // CustomTypeName = customType.CustomTypeName, // CustomName = model.CustomName, // LinkPhone = model.LinkPhone, // LinkName = model.LinkName, // LinkMobile = model.LinkMobile, // CustomArea = model.CustomArea, // CustomAddress = model.CustomAddress, // CreateBy = model.CreateUser, // CreateIP = model.CreateIP, // CreateTime = model.CreateTime, // Sort = model.Sort, // Status = model.Status, // UpdateBy = model.UpdateUser, // UpdateIP = model.UpdateIP, // UpdateTime = model.UpdateTime, //}); //rsp.success = true; //rsp.code = 0; //rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
public ActionResult LoginIn(string username, string password, string rememberMe, string returnUrl) { JsonRsp json = new JsonRsp { success = false }; if (!ModelState.IsValid) { return(Json(json, JsonRequestBehavior.AllowGet)); } bool status = Request.IsAuthenticated; json = bll.Login(username, password); if (!json.success) { return(Json(json, JsonRequestBehavior.AllowGet)); } //4. 用户描述用户基本信息 AccountViewModel userInfo = new AccountViewModel() { ID = json.code, AccountName = json.retmsg, }; //2.用它来序列化要对象 JavaScriptSerializer serial = new JavaScriptSerializer(); //5. 生成初始化凭据 FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket( 1, username, DateTime.Now, DateTime.Now.AddMinutes(30), false, serial.Serialize(userInfo) ); //6. 加密 string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //7. 响应到客户端 System.Web.HttpCookie authCookie = new System.Web.HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); System.Web.HttpContext.Current.Response.Cookies.Add(authCookie); //8. 返回首页, 也可以跳回 RetureUrl if (!String.IsNullOrEmpty(returnUrl)) { json.retmsg = returnUrl; } else { json.retmsg = "/Admin/Home/"; } return(Json(json, JsonRequestBehavior.AllowGet)); //if (!String.IsNullOrEmpty(returnUrl)) return Redirect(returnUrl); //else return RedirectToAction("Home", "Admin"); }
/// <summary> /// 获取用户权限菜单 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <MenuViewModel> GetMenuJsonList(long accountId, long menuType) { JsonRsp <MenuViewModel> rsp = new JsonRsp <MenuViewModel>(); rsp.data = GetMenuListByAccountId(accountId, menuType); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomAccReceiptEntryModel> GetAllModelList() { JsonRsp <CustomAccReceiptEntryViewModel> rsp = new JsonRsp <CustomAccReceiptEntryViewModel>(); CustomAccReceiptEntryModel model = new CustomAccReceiptEntryModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "desc") .END; return(q.ToList <CustomAccReceiptEntryModel>()); }
/// <summary> /// 获取列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <ChargeCardViewModel> GetPageList(int pageIndex, int pageSize, bool limit = true) { JsonRsp <ChargeCardViewModel> rsp = new JsonRsp <ChargeCardViewModel>(); ChargeCardsModel c = new ChargeCardsModel(); CustomModel custom = new CustomModel(); TicketTypeModel t = new TicketTypeModel(); OQL joinQ = OQL.From(c) .Join(custom).On(c.CustomId, custom.ID) .LeftJoin(t).On(c.TicketTypeID, t.ID) .Select() .OrderBy(c.Sort, "desc") .END; //分页 if (limit) { joinQ.Limit(pageSize, pageIndex, true); } PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <ChargeCardViewModel>)ec.MapToList <ChargeCardViewModel>(() => new ChargeCardViewModel() { ID = c.ID, CustomId = c.CustomId, CustomName = custom.CustomName, TicketTypeID = c.TicketTypeID, TicketTypeName = t.TicketTypeName, MoneyType = c.MoneyType, CurrentCount = c.CurrentCount, FaceAmount = c.FaceAmount, CurrentAmount = c.CurrentAmount, ExpireDate = c.ExpireDate, TicketBatchId = c.TicketBatchId, TicketStart = c.TicketStart, TicketEnd = c.TicketEnd, Consumptionlevel = c.Consumptionlevel, IsCommonCard = c.IsCommonCard, Sort = c.Sort, CreateId = c.CreateId, CreateUser = c.CreateUser, CreateIP = c.CreateIP, CreateTime = c.CreateTime, UpdateBy = c.UpdateUser, UpdateIP = c.UpdateIP, UpdateTime = c.UpdateTime, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <MerchantModel> GetAllModelList() { JsonRsp <MerchantViewModel> rsp = new JsonRsp <MerchantViewModel>(); MerchantModel model = new MerchantModel(); OQL q = OQL.From(model) .Select() .Where(model.TenantId == TenantId) .OrderBy(model.Sort, "desc") .END; return(q.ToList <MerchantModel>()); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomModel> GetAllModelList() { JsonRsp <CustomViewModel> rsp = new JsonRsp <CustomViewModel>(); CustomModel model = new CustomModel(); model.TenantId = TenantId; OQL q = OQL.From(model) .Select() .Where(model.TenantId) .OrderBy(model.Sort, "desc") .END; return(q.ToList <CustomModel>()); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <TicketViewModel> rsp = new JsonRsp <TicketViewModel>(); TicketInfo ticket = new TicketInfo(); TicketTypeModel ticketType = new TicketTypeModel(); //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(ticket) .Join(ticketType).On(ticket.TicketTypeId, ticketType.ID) .Select() .OrderBy(ticket.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <TicketViewModel>)ec.MapToList <TicketViewModel>(() => new TicketViewModel() { ID = ticket.ID, TicketCode = ticket.TicketCode, TicketTypeId = ticket.TicketTypeId, Consumptionlevel = BaseEnum.ConsumptionlevelEnum.初始化, MoneyTyp = BaseEnum.MoneyTypeEnum.初始化, CustomID = 0, InitialAmount = 0, CostAmount = 0, Balance = 0, Status = BaseEnum.CredentialEnum.未交付, IsExpire = false, IsActivated = false, //MakeTime=null, //ExpireDate=null, TicketBatchNo = ticket.TicketBatchNo, GrantBy = 0, //GrantTime=null, CreateBy = AdminName, CreateIP = Util.GetLocalIP(), CreateTime = ticket.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = ticket.Sort, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <MerchantViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <MerchantViewModel> rsp = new JsonRsp <MerchantViewModel>(); MerchantModel model = new MerchantModel(); MerchantTypeModel MerchantType = new MerchantTypeModel(); model.TenantId = TenantId; //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(model) .Join(MerchantType).On(model.MerchantTypeId, MerchantType.ID) .Select() .OrderBy(model.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <MerchantViewModel>)ec.MapToList <MerchantViewModel>(() => new MerchantViewModel() { ID = model.ID, MerchantTypeId = model.MerchantTypeId, MerchantTypeName = MerchantType.MerchantTypeName, MerchantName = model.MerchantName, LinkPhone = model.LinkPhone, LinkName = model.LinkName, LinkMobile = model.LinkMobile, MerchantArea = model.MerchantArea, MerchantAddress = model.MerchantAddress, CreateId = model.CreateId, CreateUser = model.CreateUser, CreateIP = model.CreateIP, CreateTime = model.CreateTime, Sort = model.Sort, Status = model.Status, UpdateBy = model.UpdateUser, UpdateIP = model.UpdateIP, UpdateTime = model.UpdateTime, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomModel> GetPageList(string searchTxt, int pageIndex, int pageSize) { CustomModel CustomModel = new CustomModel(); JsonRsp <CustomModel> rsp = new JsonRsp <CustomModel>(); OQLCompareFunc <CustomModel> cmpResult = (cmp, c) => ( //cmp.Property(c.CustomName) == "ABC" & cmp.Comparer(c.CustomName, OQLCompare.CompareType.Like, "%" + searchTxt + "%") ); rsp.success = true; rsp.code = 0; rsp.data = GetList <CustomModel>(cmpResult, null, pageSize, pageIndex); return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <ContractViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <ContractViewModel> rsp = new JsonRsp <ContractViewModel>(); ContractModel contract = new ContractModel(); CustomModel custom = new CustomModel(); CustomTypeModel customType = new CustomTypeModel(); //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(contract) .Join(custom).On(contract.CustomId, custom.ID) .Join(customType).On(custom.CustomTypeId, customType.ID) .Select() .OrderBy(contract.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <ContractViewModel>)ec.MapToList <ContractViewModel>(() => new ContractViewModel() { ID = contract.ID, CustomId = contract.CustomId, CustomName = custom.CustomName, CustomTypeName = customType.CustomTypeName, ContractNo = contract.ContractNo, ContractAmount = contract.ContractAmount, Deductions = contract.Deductions, Balance = contract.Balance, Remark = contract.Remark, Sort = contract.Sort, Status = contract.Status, CreateId = contract.CreateId, CreateUser = contract.CreateUser, CreateIP = contract.CreateIP, CreateTime = contract.CreateTime, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <ProductTypeViewModel> GetPageList(string searchTxt, int pageIndex, int pageSize) { JsonRsp <ProductTypeViewModel> rsp = new JsonRsp <ProductTypeViewModel>(); ProductTypeModel pt = new ProductTypeModel(); MerchantTypeModel mt = new MerchantTypeModel(); OQLCompareFunc <ProductTypeModel> cmpFun = (cmp, u) => { OQLCompare cmpResult = null; //and 条件 cmpResult = cmpResult & cmp.Comparer(pt.ProductTypeName, OQLCompare.CompareType.Like, "%" + searchTxt + "%"); //or cmpResult = cmpResult | cmp.Comparer(pt.TenantId, OQLCompare.CompareType.Equal, TenantId); return(cmpResult); }; //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(pt) .Join(mt).On(pt.MerchantTypeId, mt.ID) .Select(pt.ID, pt.ProductTypeName, mt.MerchantTypeName, pt.Status, pt.CreateTime) .Where(cmpFun) .OrderBy(pt.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <ProductTypeViewModel>)ec.MapToList <ProductTypeViewModel>(() => new ProductTypeViewModel() { ID = pt.ID, ProductTypeName = pt.ProductTypeName, MerchantTypeId = mt.ID, MerchantTypeName = mt.MerchantTypeName, CreateId = pt.CreateId, CreateUser = pt.CreateUser, CreateIP = pt.CreateIP, CreateTime = pt.CreateTime, Status = pt.Status, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }