//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 }); }
// // GET: /Home/ public ActionResult Index(int page = 1) { List<SqlParamList> list = new List<SqlParamList>(); list.Add(new SqlParamList("IsTrue", "=", 0)); PagerInfo pi = new PagerInfo(); pi.CurrenetPageIndex = page; ObjEntity data = new munich_reDAL().GetPagerList(pi, list); return View(data); }
/// <summary> /// 检索条件 /// </summary> /// <param name="name"></param> protected void Query(string typeName) { var pager = new PagerInfo(); pager.CurrenetPageIndex = AspNetPager1.CurrentPageIndex; pager.PageSize = AspNetPager1.PageSize; rptList.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.FindWithPager(string.Format("M_Type='{0}'", typeName), pager, "M_Time", true); rptList.DataBind(); AspNetPager1.RecordCount = pager.RecordCount; }
protected void Bind(Repeater rpt, string typeName) { var pager = new PagerInfo(); pager.CurrenetPageIndex = 1; pager.PageSize = 10; rpt.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.FindWithPager(string.Format("M_Type='{0}'", typeName), pager, "M_Time", true); // rpt.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.Find(string.Format("M_Type='{0}'",typeName), "order by M_Time desc"); rpt.DataBind(); }
/// <summary> /// 检索条件 /// </summary> /// <param name="name"></param> protected void Query(string name) { PagerInfo pager = new PagerInfo(); pager.CurrenetPageIndex = AspNetPager1.CurrentPageIndex; pager.PageSize = AspNetPager1.PageSize; rptList.DataSource = BLLFactory<T_RoleManager>.Instance.FindWithPager(string.Format("RoleName like '%{0}%'", name), pager, "RoleID", true); rptList.DataBind(); AspNetPager1.RecordCount = pager.RecordCount; }
/// <summary> /// 检索条件 /// </summary> /// <param name="name"></param> protected void Query(string where) { PagerInfo pager = new PagerInfo(); pager.CurrenetPageIndex = AspNetPager1.CurrentPageIndex; pager.PageSize = AspNetPager1.PageSize; rptList.DataSource = BLLFactory<T_UserInfoManager>.Instance.FindWithPager(where, pager, "UserID", true); rptList.DataBind(); AspNetPager1.RecordCount = pager.RecordCount; }
// // GET: /IPAccess/IPAccess/ public ActionResult Index(int pageIndex = 1, int pageSize = 20) { int count = 0; List<Models.IPAccess> ipaccess = _IIPAccessService.GetIPAccessAll(pageIndex, pageSize, out count); PagerInfo pager = new PagerInfo(pageIndex, pageSize, count); PagerQuery<PagerInfo, List<Models.IPAccess>, string> query = new PagerQuery<PagerInfo, List<Models.IPAccess>, string>(pager, ipaccess, ""); ViewBag.navigation = new Navigation { Level = new List<string> { "系統設定", "登入IP管理" }, HaveButton = false }; return View(query); }
public static HtmlString ShowPageNavigate(this HtmlHelper HtmlHelper, PagerInfo paging, int btnNumber = 5, string paramName = "page") { if (HtmlHelper.ViewContext.RequestContext.HttpContext.Request.Url == null) return null; var urlStr = HtmlHelper.ViewContext.RequestContext.HttpContext.Request.Url.ToString(); var pageIndex = paging.CurrenetPageIndex; //当前页数 var pageCount = paging.PageCount; //总页数 if (pageCount <= 1) return null; var outPut = new StringBuilder(); outPut.AppendFormat("<ul class='pagination'>"); if (pageIndex > 1) { var urlTo = UrlComHelper.UpdateParam(urlStr, paramName, (pageIndex - 1).ToString()); var firstPage = UrlComHelper.UpdateParam(urlStr, paramName, "1"); outPut.AppendFormat("<li class='firstPage'><a href='{0}'><span>首页</span></a></li>", firstPage); outPut.AppendFormat("<li class='prev'><a href='{0}'>← <span>上一页</span></a></li>", urlTo); } const int index = 5; for (var i = 0; i < btnNumber; i++) { if ((pageIndex + i - index) < 1 || (pageIndex + i - index) > pageCount) continue; var urlTo = UrlComHelper.UpdateParam(urlStr, paramName, (pageIndex + i - index).ToString()); outPut.AppendFormat( pageIndex + i - index == pageIndex ? "<li class='active'><a href='{0}'>{1}</a></li>" : "<li><a href='{0}'>{1}</a></li>", urlTo, pageIndex + i - index); } if (pageIndex < pageCount) { var urlTo = UrlComHelper.UpdateParam(urlStr, paramName, (pageIndex + 1).ToString()); var trailerPage = UrlComHelper.UpdateParam(urlStr, paramName, pageCount.ToString()); outPut.AppendFormat("<li class='next'><a href='{0}'><span>下一页</span>→</a></li>", urlTo); outPut.AppendFormat("<li class='trailerPage'><a href='{0}'> <span>尾页</span></a></li>", trailerPage); } outPut.AppendFormat("</ul>"); return new HtmlString(outPut.ToString()); }
public ActionResult TennisAlliance(string keyWords, int pageIndex = 1, int pageSize = 20) { int count = 0; List<TennisAlliance> pagedList = _ITennisAllianceService.GetTennisAllianceByCondition(keyWords, pageIndex, pageSize, out count); PagerInfo pager = new PagerInfo(pageIndex, pageSize, count); PagerQuery<PagerInfo, List<TennisAlliance>, string> query = new PagerQuery<PagerInfo, List<TennisAlliance>, string>(pager, pagedList, keyWords); ViewBag.navigation = new Navigation { Level = new List<string> { "網球", "聯盟資料" }, Area = RouteData.DataTokens["area"].ToString(), Controller = RouteData.Values["controller"].ToString(), Action = "Index", HaveButton = true, ButtonText = "回賽程頁", Parameter = new List<Parameter>{ new Parameter("date",DateTime.Now.ToString("yyyy-MM-dd")), } }; return View(query); }
public ActionResult BKOSTeam(BKOSTeamQuery queryModel, int pageIndex = 1, int pageSize = 100) { int count = 0; List<BKOSTeam> pagedList = _IBKOSTeamService.GetBKOSTeamByCondition(queryModel, pageIndex, pageSize, out count).ToList(); PagerInfo pager = new PagerInfo(pageIndex, pageSize, count); PagerQuery<PagerInfo, List<BKOSTeam>, BKOSTeamQuery> query = new PagerQuery<PagerInfo, List<BKOSTeam>, BKOSTeamQuery>(pager, pagedList, queryModel); ViewBag.SelectAlliances = _IBKOSAllianceService.QueryAll().ToList().Select(p => new SelectListItem { Text = p.ShowName, Value = p.AllianceID.ToString(), Selected = queryModel != null && queryModel.AllianceID == p.AllianceID }); ViewBag.navigation = new Navigation { Level = new List<string> { "奧訊籃球", "隊伍管理" }, Area = RouteData.DataTokens["area"].ToString(), Controller = RouteData.Values["controller"].ToString(), Action = "Index", HaveButton = true, ButtonText = "回賽程頁", Parameter = new List<Parameter>{ new Parameter("date",DateTime.Now.ToString("yyyy-MM-dd")), } }; return View(query); }
/// <summary> /// 主頁顯示 /// </summary> /// <returns></returns> public ActionResult Index(string gameType = "IHBF", string keyWords = null, int pageIndex = 1, string sMsg = null) { int count = 0; List<IceHockeyAlliance> ia = _IIceHockeyAllianceService.getAllianceListByIHBF(gameType, keyWords, pageIndex, pageSize, out count); PagerInfo pager = new PagerInfo(pageIndex, pageSize, count); PagerQuery<PagerInfo, List<IceHockeyAlliance>, string> query = new PagerQuery<PagerInfo, List<IceHockeyAlliance>, string>(pager, ia, keyWords); ViewBag.PageCount = count; ViewBag.gameType = gameType.ToUpper(); ViewBag.navigation = new Navigation { Level = new List<string> { AppData.GetGameTypeName(gameType), "聯盟管理" }, Area = RouteData.DataTokens["area"].ToString(), Controller = "IHBFSchedules", Action = "Index", HaveButton = true, Parameter = new List<Models.ViewModel.Parameter> { new Parameter("date", DateTime.Now.ToString("yyyy-MM-dd")), new Parameter("gameType", gameType) }, ButtonText = "返回賽程" }; return View(query); }
/// <summary> /// 根据Owner获取对应的附件列表 /// </summary> /// <param name="ownerID">拥有者ID</param> /// <returns></returns> public List <FileUploadInfo> GetByOwner(string ownerID, PagerInfo pagerInfo) { string condition = string.Format("Owner_ID ='{0}' ", ownerID); return(base.FindWithPager(condition, pagerInfo)); }
private DataTable QueryWorkItemListData(PagerInfo pagerInfo, string distributorName, string startDate, string endDate, ref int total) { string userId = this.UserValidator.UserID; string sql = @" select * from (select rownum rn , A.* from (select a.totaldzje ,a.totalhkje ,a.totallxje ,a.totaldzje-(a.totalhkje+a.totallxje) yqsje ,to_char(Max(b.cjjedzsj),'yyyy-mm-dd HH24:mi') hkdzsj ,f.objectid workid ,e.objectid instanceid ,a.jxs,to_char(f.receivetime,'yyyy-mm-dd HH24:mi') receivetime ,a.JXSH3ID from I_Repayment a Left join I_DZJEList b on a.objectid = b.parentobjectid join Ot_Instancecontext e on e.bizobjectid = a.objectid join Ot_Workitem f on f.instanceid = e.objectid where e.workflowcode = 'Repayment' and ACTIVITYCODE = 'Market' and f.participant = '{0}' {3} group by a.totaldzje,a.totalhkje,a.totallxje,f.objectid,e.objectid,a.jxs,f.receivetime,a.JXSH3ID order by f.receivetime desc ) A {4}) A where A.rn >= {1} and A.rn <={2} "; string sqlCount = @"select count(1) from ( select a.jxs,to_char(f.receivetime,'yyyy-mm-dd') receivetime from I_Repayment a join Ot_Instancecontext e on e.bizobjectid = a.objectid join Ot_Workitem f on f.instanceid = e.objectid where e.workflowcode = 'Repayment' and ACTIVITYCODE = 'Market' and f.participant = '{0}' {1} ) A"; string conditions = ""; if (!string.IsNullOrEmpty(distributorName)) { conditions = conditions + string.Format(@" AND a.jxs like '%{0}%'", distributorName); } if (!string.IsNullOrEmpty(startDate)) { conditions = conditions + string.Format(@" AND to_char(f.receivetime,'yyyy-mm-dd HH24:mi') >= '{0}'", startDate); } if (!string.IsNullOrEmpty(endDate)) { conditions = conditions + string.Format(@" AND to_char(f.receivetime,'yyyy-mm-dd') <= '{0}'", endDate); } #region 排序 string OrderBy = " order by A.receivetime asc "; if (pagerInfo.iSortCol_0 != 0) { OrderBy = " ORDER BY "; if (pagerInfo.iSortCol_0 == 5) { OrderBy += " A.receivetime " + pagerInfo.sSortDir_0.ToUpper(); } else if (pagerInfo.iSortCol_0 == 6) { OrderBy += " A.hkdzsj " + pagerInfo.sSortDir_0.ToUpper(); } } #endregion sql = string.Format(sql, userId, pagerInfo.StartIndex, pagerInfo.EndIndex, conditions, OrderBy); sqlCount = string.Format(sqlCount, userId, conditions); DataTable dt = this.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql); var count = this.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteScalar(sqlCount); if (count != null) { total = Convert.ToInt32(count); } return(dt); }
public ActionResult FindApplyByTag() { //检查用户是否有权限,否则抛出MyDenyAccessException异常 base.CheckAuthorized(AuthorizeKey.ListKey); //解析自定义的CustomedCondition条件 string where = GetPagerCondition(); string condition = where;//存储另外一个条件 //有三个条件 add: todo: done: if (!string.IsNullOrEmpty(where)) { string value = where.Substring(where.IndexOf(':') + 1); if (where.StartsWith("add:")) {//我发起的 condition = string.Format("Editor='{0}'", CurrentUser.ID); if (!string.IsNullOrEmpty(value)) { condition += string.Format(" AND Status={0}", value);//加上状态 } } else if (where.StartsWith("todo:")) { //我的待办 string applyIdString = BLLFactory <ApplyUser> .Instance.GetApplyIdByUser(CurrentUser.ID); //我的待办 condition = string.Format("ID IN ({0}) AND Status=0", applyIdString); if (!string.IsNullOrEmpty(value)) { condition += string.Format(" AND Category='{0}'", value);//加上状态 } } else if (where.StartsWith("done:")) { //我的已办 string applyIdString = BLLFactory <ApplyUser> .Instance.GetApplyIdDone(CurrentUser.ID); //我的待办 condition = string.Format("ID IN ({0})", applyIdString); if (!string.IsNullOrEmpty(value)) { condition += string.Format(" AND Category='{0}'", value);//加上状态 } } } PagerInfo pagerInfo = GetPagerInfo(); var sort = GetSortOrder(); List <ApplyInfo> list = null; if (sort != null && !string.IsNullOrEmpty(sort.SortName)) { list = baseBLL.FindWithPager(condition, pagerInfo, sort.SortName, sort.IsDesc); } else { list = baseBLL.FindWithPager(condition, pagerInfo); } //转换ExpandoObject对象列表 var objList = ConvertObjectList(list); //Json格式的要求{total:22,rows:{}} //构造成Json的格式传递 var result = new { total = pagerInfo.RecordCount, rows = objList }; //如果使用转义,请使用objList对象 return(ToJsonContent(result)); }
/// <summary> /// 查询药品基础信息 /// </summary> /// <param name="keys"></param> /// <param name="index"></param> /// <param name="size"></param> /// <param name="pager"></param> /// <param name="ValidCondition"></param> /// <returns></returns> public IEnumerable <Business.Models.DrugInfoModel> GetDrugInfoByCondition(string keys, int index, int size, out PagerInfo pager, bool ValidCondition) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { var all = this.Queryable; if (!string.IsNullOrEmpty(keys)) { all = all.Where(r => (r.Pinyin != null && r.Pinyin.ToUpper().Contains(keys.ToUpper())) || (r.ProductGeneralName != null && r.ProductGeneralName.Contains(keys)) || (r.BusinessScopeCode != null && r.BusinessScopeCode.Contains(keys)) || (r.DictionaryDosageCode != null && r.DictionaryDosageCode.Contains(keys)) || (r.DictionarySpecificationCode != null && r.DictionarySpecificationCode.Contains(keys))); } all = all.Where(r => !r.BusinessScopeCode.Contains("医疗器械") || !r.BusinessScopeCode.Contains("保健食品")); //医疗器械和保健食品不查 if (ValidCondition) //查询被锁定药品 { all = all.Where(r => r.Valid == false); } var c = from i in all join w in RepositoryProvider.Db.Warehouses on i.WareHouses equals w.Id join u in RepositoryProvider.Db.Users on i.CreateUserId equals u.Id select new Business.Models.DrugInfoModel { BarCode = i.BarCode, BigPackage = i.BigPackage, BusinessScopeCode = i.BusinessScopeCode, Code = i.Code, CreateTime = i.CreateTime, CreateUserId = u.Employee.Name, DictionaryDosageCode = i.DictionaryDosageCode, DictionaryMeasurementUnitCode = i.DictionaryMeasurementUnitCode, DictionaryPiecemealUnitCode = i.DictionaryPiecemealUnitCode, DictionarySpecificationCode = i.DictionarySpecificationCode, DocCode = i.DocCode, DrugCategoryCode = i.DrugCategoryCode, DrugClinicalCategoryCode = i.DrugClinicalCategoryCode, DrugStorageTypeCode = i.DrugStorageTypeCode, FactoryName = i.FactoryName, id = i.Id, IsApproval = i.IsApproval == true ? "审批通过" : "未审批通过", IsImport = i.IsImport == true ? "进口" : "非进口", IsMainMaintenance = i.IsMainMaintenance ? "重点养护" : "一般养护", IsMedicalInsurance = i.IsMedicalInsurance ? "医保药品" : "非医保药品", IsPrescription = i.IsPrescription ? "处方药" : "非处方药", IsSpecialDrugCategory = i.IsSpecialDrugCategory ? "特殊管理药品" : "非特殊管理药品", LicensePermissionNumber = i.LicensePermissionNumber, LimitedUpPrice = i.LimitedUpPrice, MaxInventoryCount = i.MaxInventoryCount, MedicalCategoryDetailCode = i.MedicalCategoryDetailCode, MiddlePackage = i.MiddlePackage, MinInventoryCount = i.MinInventoryCount, Origin = i.Origin, Package = i.Package, PackageAmount = i.PackageAmount, PerformanceStandards = i.PerformanceStandards, PermitLicenseCode = i.PermitLicenseCode, PiecemealNumber = i.PiecemealNumber, PiecemealSpecification = i.PiecemealSpecification, Pinyin = i.Pinyin, Price = i.Price, ProductGeneralName = i.ProductGeneralName, ProductName = i.ProductName, PurchaseManageCategoryDetailCode = i.PurchaseManageCategoryDetailCode, RetailPrice = i.RetailPrice, SalePrice = i.SalePrice, SmallPackage = i.SmallPackage, SpecialDrugCategoryCode = i.SpecialDrugCategoryCode, StandardCode = i.StandardCode, Valid = i.Valid ? "有效" : "无效", ValidPeriod = i.ValidPeriod, WareHouses = w.Name, WholeSalePrice = i.WholeSalePrice, Description = i.Description, WareHouseZones = i.WareHouseZones }; pager.RecordCount = c.Count(); c = c.OrderBy(d => d.Code).ThenBy(r => r.ProductGeneralName); var records = c .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); records.ForEach(r => { if (!string.IsNullOrEmpty(r.WareHouseZones)) { Guid wzid = Guid.Parse(r.WareHouseZones); var wz = RepositoryProvider.Db.WarehouseZones.FirstOrDefault(u => u.Id == wzid); if (wz != null) { r.WareHouseZones = wz.Name; } } }); return(records); } catch (Exception ex) { return(null); } finally { this.Dispose(); } }
public JsonNetResult Query(string condition, string rootId, string unitId, PagerInfo pager) { var list = new UserService().Query(condition, rootId, unitId, pager); return(JsonNet(new ResponseResult(true, list, pager))); }
/// <summary> /// 以分页方式通用获取集合对象方法 /// </summary> /// <param name="sql">查询的Sql语句</param> /// <param name="info">分页实体</param> /// <param name="paramList">参数列表,如果没有则为null</param> /// <param name="trans">事务对象</param> /// <returns></returns> public virtual List <T> GetListWithPager(string sql, PagerInfo info, IDbDataParameter[] paramList = null, DbTransaction trans = null) { CheckDAL(); return(baseDal.GetListWithPager(sql, info, paramList, trans)); }
/// <summary> /// 根据客户分组的名称,搜索属于该分组的客户列表 /// </summary> /// <param name="ownerUser">客户所属用户</param> /// <param name="groupName">客户分组的名称,如果客户分组为空,那么返回未分组客户列表</param> /// <param name="pagerInfo">分页条件</param> /// <returns></returns> public List <CustomerInfo> FindByGroupName(string ownerUser, string groupName, PagerInfo pagerInfo = null) { ICustomer dal = baseDal as ICustomer; return(dal.FindByGroupName(ownerUser, groupName, pagerInfo)); }
public IList <ProductEntity> Query(string condition, PagerInfo pager) { return(ProductRepository.Query(condition, pager)); }
public DataTable StatisticsLogsDAL(LogConditionModel conditValue, PagerInfo pagerInfo, SortInfo sortInfo) { StringBuilder whereSql = new StringBuilder(); string sql = @"SELECT d.DeviceName,d.SIM,d.SN,dl.dtinsert,dl.content FROM device_log dl LEFT JOIN device_info d ON dl.device_sn = d.SN {0} ORDER BY dl.dtinsert DESC, dl.id LIMIT " + (pagerInfo.PageSize * (pagerInfo.CurrenetPageIndex - 1)) + "," + pagerInfo.PageSize + ";"; if (!string.IsNullOrEmpty(conditValue.DeviceType)) { whereSql.Append(@" AND DeviceType='" + conditValue.DeviceType + "'"); } else { whereSql.Append(@" AND DeviceType ='生化仪'"); } if (!string.IsNullOrEmpty(conditValue.Model)) { whereSql.Append(@" AND Model='" + conditValue.Model + "'"); } if (!string.IsNullOrEmpty(conditValue.Region)) { whereSql.Append(@" AND Region='" + conditValue.Region + "'"); } if (!string.IsNullOrEmpty(conditValue.DeviceName)) { whereSql.Append(@" AND DeviceName='" + conditValue.DeviceName + "'"); } if (!string.IsNullOrEmpty(conditValue.SIM)) { whereSql.Append(@" AND SIM='" + conditValue.SIM + "'"); } if (!string.IsNullOrEmpty(conditValue.SN)) { whereSql.Append(@" AND SN='" + conditValue.SN + "'"); } if (!string.IsNullOrEmpty(conditValue.dtStart)) { whereSql.Append(@" AND dtInsert >='" + conditValue.dtStart + "'"); } if (!string.IsNullOrEmpty(conditValue.dtEnd)) { whereSql.Append(@" AND dtInsert <='" + conditValue.dtEnd + "'"); } if (!string.IsNullOrEmpty(whereSql.ToString())) { whereSql = new StringBuilder(" WHERE " + whereSql.ToString().Substring(4)); } var SqlCondit = string.Format(sql, whereSql.ToString()); using (var conn = new MySqlConnection(Global.strConn)) { MySqlDataAdapter adapter = new MySqlDataAdapter(SqlCondit, conn); DataSet ds = new DataSet(); adapter.Fill(ds); return(ds.Tables[0]); } }
/// <summary> /// 根据供应商ID,分页获取客户列表(关联客户列表) /// </summary> /// <param name="supplierID">供应商ID</param> /// <param name="pagerInfo">分页条件</param> /// <returns></returns> public List <CustomerInfo> FindBySupplier(string supplierID, string condition, PagerInfo pagerInfo = null) { ICustomer dal = baseDal as ICustomer; return(dal.FindBySupplier(supplierID, condition, pagerInfo)); }
/// <summary> /// 分页查询 + 条件查询 + 排序 /// </summary> /// <param name="pager">分页对象</param> /// <param name="condition">过滤条件</param> /// <returns></returns> public async Task <PagerEntity <WarehouseSingleDto> > QueryWarehouseByPagesAsync(PagerInfo pager, List <SearchCondition> condition = null) { return(await Task.Run(() => { var list = _repository.QueryWarehouseByPagers(pager, condition); return _mapper.Map <PagerEntity <WarehouseSingleDto> >(list); })); }
//列表页 public ActionResult List() { Comm_Platform_Worker workerModel = Session["worker"] as Comm_Platform_Worker; if (workerModel == null) { redirectTo(); return(null); } string region_code = CommonFunc.SafeGetStringFromObj(workerModel.region_code); string dell_user_name = CommonFunc.SafeGetStringFromObj(workerModel.user_name); string name = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["names"]).Trim()); string sex = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["sex"]).Trim()); string birthdateBegin = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["txtBirthDateBegin"]).Trim()); string birthdateEnd = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["txtBirthDateEnd"]).Trim()); string id_card_number = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["idCard"]).Trim()); string address = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request["address"]).Trim()); string s = string.Empty; //获取区域代码 if (!string.IsNullOrEmpty(CommonFunc.SafeGetStringFromObj(Request["ddlProvince"]))) { s = CommonFunc.SafeGetStringFromObj(Request["ddlProvince"]); } if (!string.IsNullOrEmpty(CommonFunc.SafeGetStringFromObj(Request["ddlCity"]))) { s = CommonFunc.SafeGetStringFromObj(Request["ddlCity"]); } if (!string.IsNullOrEmpty(CommonFunc.SafeGetStringFromObj(Request["ddlCounty"]))) { s = CommonFunc.SafeGetStringFromObj(Request["ddlCounty"]); } if (!string.IsNullOrEmpty(CommonFunc.SafeGetStringFromObj(Request["ddlStreet"]))) { s = CommonFunc.SafeGetStringFromObj(Request["ddlStreet"]); } if (!string.IsNullOrEmpty(CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]))) { s = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]); } if (s.Length > region_code.Length) { region_code = s; } int pageIndex = CommonFunc.SafeGetIntFromObj(this.Request["pageIndex"], 1); int pageSize = this.Request["pageSize"] == null ? PageSize.GetPageSize : int.Parse(Request["pageSize"]); int totalCount = 0; CommonParam commonParam = new CommonParam() { PageIndex = pageIndex, PageSize = pageSize, TotalCount = totalCount, region_code = region_code, name = name, sex = sex, txtBirthDateBegin = birthdateBegin, txtBirthDateEnd = birthdateEnd, idCard = id_card_number, address = address }; var disease_Comm_Testing_BloodList = disease_Supplementary_Examination_USService.LoadSearchEntities(commonParam); totalCount = commonParam.TotalCount; int PageCount = Convert.ToInt32(Math.Ceiling((double)totalCount / pageSize)); List <Chronic_disease_Supplementary_Examination_US> result = new List <Chronic_disease_Supplementary_Examination_US>(); result.AddRange(disease_Comm_Testing_BloodList); PagerInfo pager = new PagerInfo(); pager.PageIndex = pageIndex; pager.PageSize = pageSize; pager.TotalCount = totalCount; PagerQuery <PagerInfo, List <Chronic_disease_Supplementary_Examination_US> > query = new PagerQuery <PagerInfo, List <Chronic_disease_Supplementary_Examination_US> >(pager, result); ViewData.Model = query; ViewBag.dell_user_name = dell_user_name; ViewBag.PageIndex = pageIndex; ViewBag.PageSize = pageSize; return(View()); }
/// <summary> /// 根据Owner获取对应的附件列表 /// </summary> /// <param name="ownerID">拥有者ID</param> /// <param name="attachmentGUID">附件组GUID</param> /// <returns></returns> public List <FileUploadInfo> GetByOwnerAndAttachGUID(string ownerID, string attachmentGUID, PagerInfo pagerInfo) { string condition = string.Format("Owner_ID ='{0}' AND AttachmentGUID='{1}' ", ownerID, attachmentGUID); return(base.FindWithPager(condition, pagerInfo)); }
/// <summary> /// 根据条件查询数据库,并返回DataTable集合(用于分页数据显示) /// </summary> /// <param name="condition">查询的条件</param> /// <param name="info">分页实体</param> /// <param name="fieldToSort">排序字段</param> /// <param name="desc">是否降序</param> /// <param name="trans">事务对象</param> /// <returns>指定DataTable的集合</returns> public virtual DataTable FindToDataTable(string condition, PagerInfo info, string fieldToSort, bool desc, DbTransaction trans = null) { CheckDAL(); return(baseDal.FindToDataTable(condition, info, fieldToSort, desc, trans)); }
/// <summary> /// 根据条件查询数据库,并返回对象集合(用于分页数据显示) /// </summary> /// <param name="condition">查询的条件</param> /// <param name="info">分页实体</param> /// <param name="trans">事务对象</param> /// <returns>指定对象的集合</returns> public virtual List <T> FindWithPager(string condition, PagerInfo info, DbTransaction trans = null) { CheckDAL(); return(baseDal.FindWithPager(condition, info, trans)); }
/// <summary> /// 根据条件,从视图里面获取记录 /// </summary> /// <param name="viewName">视图名称</param> /// <param name="condition">查询条件</param> /// <param name="sortField">排序字段</param> /// <param name="isDescending">是否为降序</param> /// <param name="info">分页条件</param> /// <param name="trans">事务对象</param> /// <returns></returns> public virtual DataTable FindByViewWithPager(string viewName, string condition, string sortField, bool isDescending, PagerInfo info, DbTransaction trans = null) { CheckDAL(); return(baseDal.FindByViewWithPager(viewName, condition, sortField, isDescending, info, trans)); }
/// <summary> /// 获取指定用户的上传信息 /// </summary> /// <param name="userId">用户ID</param> /// <param name="category">附件分类:个人附件,业务附件</param> /// <param name="pagerInfo">分页信息</param> /// <returns></returns> public List <FileUploadInfo> GetAllByUser(Int32 userId, string category, PagerInfo pagerInfo) { IFileUploads dal = baseDal as IFileUploads; return(dal.GetAllByUser(userId, category, pagerInfo)); }
/// <summary> /// 获取指定附件组GUID的附件信息 /// </summary> /// <param name="attachmentGUID">附件组GUID</param> /// <param name="pagerInfo">分页信息</param> /// <returns></returns> public List <FileUploadInfo> GetByAttachGUID(string attachmentGUID, PagerInfo pagerInfo) { string condition = string.Format("AttachmentGUID='{0}' ", attachmentGUID); return(FindWithPager(condition, pagerInfo)); }
public IList <ReturnFormEntity> Query(ReturnQueryCondition condition, PagerInfo pager) { return(ReturnFormRepository.Query(condition, pager)); }
/// <summary> /// 列表页 /// </summary> /// <param name="condition"></param> /// <param name="rootId"></param> /// <param name="unitId"></param> /// <param name="pager"></param> /// <returns></returns> public JsonNetResult JsonQuery(string condition, string rootId, string unitId, PagerInfo pager) { if (!this.IsAdmin) { condition = UserContext.RootUnitName; } var list = new UserService().Query(condition, rootId, unitId, pager); return(JsonNet(new ResponseResult(true, list, pager))); }
/// <summary> /// 返回数据库所有的对象集合(用于分页数据显示) /// </summary> /// <param name="info">分页实体信息</param> /// <param name="fieldToSort">排序字段</param> /// <param name="desc">是否降序</param> /// <param name="trans">事务对象</param> /// <returns>指定对象的集合</returns> public virtual List <T> GetAll(PagerInfo info, string fieldToSort, bool desc, DbTransaction trans = null) { CheckDAL(); return(baseDal.GetAll(info, fieldToSort, desc, trans)); }
public List <DrugInfo> SearchPagedDrugInfosByAllStrings(string keys, int index, int size, out PagerInfo pager) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <DrugInfo> records = new List <DrugInfo>(); var queryBuilder = QueryBuilder.Create <DrugInfo>(); Expression <Func <DrugInventoryRecord, bool> > expression = dir => true; var query = this.Queryable; query = query.Where(PreparePredicate(queryBuilder.Expression)); if (!string.IsNullOrWhiteSpace(keys)) { query = query.Where(d => false //编码 || (d.Code != null && d.Code.Contains(keys)) //商品名称 || (d.ProductName != null && d.ProductName.Contains(keys)) //拼音码 || (d.Pinyin != null && d.Pinyin.Contains(keys)) //条形码 || (d.BarCode != null && d.BarCode.Contains(keys)) //规格 || (d.DictionarySpecificationCode != null && d.DictionarySpecificationCode.Contains(keys)) //剂型 || (d.DictionaryDosageCode != null && d.DictionaryDosageCode.Contains(keys)) //计量单位 || (d.DictionaryMeasurementUnitCode != null && d.DictionaryMeasurementUnitCode.Contains(keys)) //厂家 || (d.FactoryName != null && d.FactoryName.Contains(keys)) //特殊药物 || (d.SpecialDrugCategoryCode != null && d.SpecialDrugCategoryCode.Contains(keys)) //经营范围 || (d.BusinessScopeCode != null && d.BusinessScopeCode.Contains(keys)) ); } pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(d => d.BarCode) .OrderBy(d => d.ProductName); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <DrugInfo> >("根据字符串查询药物基础信息失败", ex)); } }
/// <summary> /// 根据分页条件,返回DataSet对象 /// </summary> /// <param name="info">分页条件</param> /// <param name="trans">事务对象</param> /// <returns></returns> public virtual DataTable GetAllToDataTable(PagerInfo info, DbTransaction trans = null) { CheckDAL(); return(baseDal.GetAllToDataTable(info, trans)); }
/// <summary> /// 查询保健食品 /// </summary> /// <param name="keys"></param> /// <param name="index"></param> /// <param name="size"></param> /// <param name="pager"></param> /// <param name="ValidCondition"></param> /// <returns></returns> public System.Collections.Generic.IEnumerable <Business.Models.FoodModel> GetFoodByCondition(string keys, int index, int size, out BugsBox.Application.Core.PagerInfo pager, bool ValidCondition) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { var all = this.Queryable.Where(r => r.BusinessScopeCode.Contains("保健食品")); if (!string.IsNullOrEmpty(keys)) { all = all.Where(r => (r.Pinyin != null && r.Pinyin.ToUpper().Contains(keys.ToUpper())) || (r.ProductGeneralName != null && r.ProductGeneralName.Contains(keys)) || (r.DictionaryDosageCode != null && r.DictionaryDosageCode.Contains(keys)) || (r.DictionarySpecificationCode != null && r.DictionarySpecificationCode.Contains(keys))); } if (ValidCondition)//查询被锁定保健食品 { all = all.Where(r => r.Valid == false); } var c = from i in all join w in RepositoryProvider.Db.Warehouses on i.WareHouses equals w.Id join u in RepositoryProvider.Db.Users on i.CreateUserId equals u.Id select new Business.Models.FoodModel { BusinessScopeCode = i.BusinessScopeCode, CreateTime = i.CreateTime, CreateUserName = u.Employee.Name, DictionaryDosageCode = i.DictionaryDosageCode, DictionaryMeasurementUnitCode = i.DictionaryMeasurementUnitCode, DictionarySpecificationCode = i.DictionarySpecificationCode, DocCode = i.DocCode, Code = i.Code, DrugStorageTypeCode = i.DrugStorageTypeCode, FactoryName = i.FactoryName, Id = i.Id, IsApproval = i.IsApproval == true ? "审批通过" : "未审批通过", IsImport = i.IsImport == true ? "进口" : "非进口", LicensePermissionNumber = i.LicensePermissionNumber, LimitedUpPrice = i.LimitedUpPrice, MaxInventoryCount = i.MaxInventoryCount, MinInventoryCount = i.MinInventoryCount, PerformanceStandards = i.PerformanceStandards, Pinyin = i.Pinyin, Price = i.Price, ProductGeneralName = i.ProductGeneralName, SalePrice = i.SalePrice, Origin = i.Origin, LicensePermissionOutValidDate = i.PermitOutDate, Valid = i.Valid == true ? "有效" : "无效", ValidPeriod = i.ValidPeriod, WareHouses = w.Name, Locked = i.IsLock == true ? "锁定" : "未锁定", NotValidReason = i.ValidRemark, WareHouseZone = i.WareHouseZones, BarCode = i.BarCode, LimitedLowPrice = i.LimitedLowPrice, Contact = i.FactoryNameAbbreviation, Description = i.Description, }; pager.RecordCount = c.Count(); c = c.OrderBy(d => d.Code).ThenBy(r => r.ProductGeneralName); var records = c .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); records.ForEach(r => { if (!string.IsNullOrEmpty(r.WareHouseZone)) { Guid wzid = Guid.Parse(r.WareHouseZone); var wz = RepositoryProvider.Db.WarehouseZones.FirstOrDefault(u => u.Id == wzid); if (wz != null) { r.WareHouseZone = wz.Name; } } }); return(records); } catch (Exception ex) { return(null); } finally { this.Dispose(); } }
/// <summary> /// 根据分页条件,返回DataSet对象 /// </summary> /// <param name="info">分页条件</param> /// <param name="fieldToSort">排序字段</param> /// <param name="trans">事务对象</param> /// <param name="desc">是否降序</param> /// <returns></returns> public virtual DataTable GetAllToDataTable(PagerInfo info, string fieldToSort, bool desc, DbTransaction trans = null) { CheckDAL(); return(baseDal.GetAllToDataTable(info, fieldToSort, desc, trans)); }
public static IList <FormApproverEntity> Query(AuditQueryCondition condition, PagerInfo pager) { pager.ComputePageCount(QueryCount(condition)); var list = new List <FormApproverEntity>(); var orderSql = " ORDER BY "; if (pager.OrderFields.Count > 0) { foreach (var field in pager.OrderFields) { orderSql += field.Field + (field.Desc ? " DESC" : "") + ","; } } else { orderSql += "form_no"; } var sql = string.Format(@"SELECT {0} FROM form_approvers WHERE 1=1{1}", COLUMN_SQL, GetConditionSql(condition)); sql = @"SELECT * FROM ( SELECT ROW_NUMBER() OVER(" + orderSql + @") pid," + COLUMN_SQL + @" FROM (" + sql + @") t ) t1 WHERE t1.pid BETWEEN @p_pageNo * @p_pageSize + 1 AND (@p_pageNo + 1) * @p_pageSize "; var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); AddParameters(db, dc, condition); db.AddInParameter(dc, "p_pageNo", DbType.Int32, pager.PageIndex); db.AddInParameter(dc, "p_pageSize", DbType.Int32, pager.PageSize); using (IDataReader reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new FormApproverEntity(); entity.Init(reader); list.Add(entity); } } return(list); }
/// <summary> /// 根据查询条件,返回记录到DataTable集合中 /// </summary> /// <param name="condition">查询条件</param> /// <param name="pagerInfo">分页条件</param> /// <param name="trans">事务对象</param> /// <returns></returns> public virtual DataTable FindToDataTable(string condition, PagerInfo pagerInfo, DbTransaction trans = null) { CheckDAL(); return(baseDal.FindToDataTable(condition, pagerInfo, trans)); }
/// <summary> /// 根据条件查询数据库,并返回对象集合(用于分页数据显示) /// </summary> /// <param name="condition">查询的条件</param> /// <param name="info">分页实体</param> /// <param name="fieldToSort">排序字段</param> /// <param name="desc">是否降序</param> /// <param name="trans">事务对象</param> /// <returns>指定对象的集合</returns> public virtual List <T> FindWithPager(string condition, PagerInfo info, string fieldToSort, bool desc, DbTransaction trans = null) { CheckDAL(); return(baseDal.FindWithPager(condition, info, fieldToSort, desc, trans)); }
/// <summary> /// 获取指定附件组GUID的附件信息 /// </summary> /// <param name="attachmentGUID">附件组GUID</param> /// <param name="pagerInfo">分页信息</param> /// <returns></returns> public List <FileUploadInfo> GetByAttachGUID(string attachmentGUID, PagerInfo pagerInfo) { IFileUploads dal = baseDal as IFileUploads; return(dal.GetByAttachGUID(attachmentGUID, pagerInfo)); }
/// <summary> /// 搜索LUCENE数据 /// </summary> /// <param name="indexType"></param> /// <param name="query"></param> /// <param name="sort"></param> /// <param name="pagerInfo"></param> /// <param name="callback"></param> /// <returns></returns> public static List<Document> SearchLuceneData(LuceneTextIndexType indexType, Query query, Sort sort, PagerInfo pagerInfo, SearchLuceneDataLoopItemHandler callback) { List<Document> list = new List<Document>(); string textIndexDir = Utilities.GetLuceneTextIndexDirectoryPath(indexType, null); FSDirectory directory = FSDirectory.Open(new System.IO.DirectoryInfo(textIndexDir), new NoLockFactory()); IndexReader indexReader = IndexReader.Open(directory, true); IndexSearcher indexSearcher = new IndexSearcher(indexReader); ScoreDoc[] docs; int totalCount; int startOffset; int endOffset; if (sort != null) { TopFieldDocs resultFieldDocs = indexSearcher.Search(query, null, indexSearcher.MaxDoc(), sort); totalCount = resultFieldDocs.totalHits; pagerInfo.RecordCount = totalCount; startOffset = (pagerInfo.PageIndex - 1) * pagerInfo.PageSize; endOffset = pagerInfo.PageIndex * pagerInfo.PageSize; if (endOffset >= totalCount) { endOffset = totalCount; } docs = resultFieldDocs.scoreDocs; } else { TopDocs resultFieldDocs = indexSearcher.Search(query, null, indexSearcher.MaxDoc()); totalCount = resultFieldDocs.totalHits; pagerInfo.RecordCount = totalCount; startOffset = (pagerInfo.PageIndex - 1) * pagerInfo.PageSize; endOffset = pagerInfo.PageIndex * pagerInfo.PageSize; if (endOffset >= totalCount) { endOffset = totalCount; } docs = resultFieldDocs.scoreDocs; } if (totalCount > 0) { for (int i = startOffset; i < endOffset; i++) { ScoreDoc hit = docs[i]; Document doc = indexSearcher.Doc(hit.doc); list.Add(doc); if (callback != null) { callback(doc); } } } indexSearcher.Close(); directory.Close(); return list; }
/// <summary> /// 返回数据库所有的对象集合(用于分页数据显示) /// </summary> /// <param name="info">分页实体信息</param> /// <param name="trans">事务对象</param> /// <returns>指定对象的集合</returns> public virtual List <T> GetAll(PagerInfo info, DbTransaction trans = null) { CheckDAL(); return(baseDal.GetAll(info, trans)); }