/// <summary>
        /// Sets the pagination links.
        /// </summary>
        /// <typeparam name="T">The class.</typeparam>
        /// <param name="routeName">Name of the route.</param>
        /// <param name="routeValues">The route values.</param>
        /// <param name="result">The result.</param>
        /// <param name="pageParam">The page parameter.</param>
        private void PaginationLinks <T>(string routeName, object routeValues, PagedResult <T> result, PageParam pageParam) where T : class
        {
            IDictionary <string, object> routeDictionary = routeValues as IDictionary <string, object>;

            routeDictionary.Remove("limit");

            routeDictionary["pageSize"] = pageParam.PageSize;

            if (result.TotalResults > 0)
            {
                if (pageParam.Page > 1)
                {
                    routeDictionary["page"] = pageParam.Page - 1;
                    string previous = this.GetLink(routeName, routeDictionary);
                    result._links.Add("previous", previous);
                }

                if ((pageParam.Page * pageParam.PageSize) < result.TotalResults)
                {
                    routeDictionary["page"] = pageParam.Page + 1;
                    string next = this.GetLink(routeName, routeDictionary);
                    result._links.Add("next", next);

                    //////routeValues["offset"] = result.TotalResults;
                    //////string last = this.GetLink(routeName, routeValues);
                    //////result._links.Add("last", last);
                }
            }
        }
        public ActionResult GetList(SearchModel search, PageParam pageParam)
        {
            PageData <QuestionTypeDto> pageData = _helper.GetPageList(search, o => o.OrderIndex, pageParam, true);

            return(Success(pageData));
        }
Exemple #3
0
 public abstract PagedList <AbstractCompany> CompanySelectAll(PageParam pageParam, string Search = "");
Exemple #4
0
 public ApiResponse <Page <Attachment> > AttachList(PageParam pageParam)
 {
     return(ApiResponse <Page <Attachment> > .Ok(_attachService.GetPage(pageParam)));
 }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="param">分页参数</param>
        /// <param name="indexName">索引名</param>
        /// <returns></returns>
        public async Task <IQueryResult <T> > PageQueryAsync <T>(IPageParam param, string indexName) where T : class
        {
            if (param == null)
            {
                param = new PageParam()
                {
                    Page     = 1,
                    PageSize = 20
                };
            }

            var searchRequest = new SearchDescriptor <T>()
                                .Index(indexName)
                                .From(param.GetSkipCount())
                                .Size(param.PageSize);

            if (param is PageParamWithSearch pageSearch)
            {
                ConfigPageRequest(pageSearch, ref searchRequest);
            }
            else if (param is PageParam pageParam)
            {
                ConfigPageRequest(pageParam, ref searchRequest);
            }

            // 是否需要高亮
            bool hasHighlight = param.Highlight?.Keys?.Length > 0;

            if (hasHighlight)
            {
                BuildHighLightQuery(param, ref searchRequest);
            }

            var client = await _builder.GetClientAsync();

            var response = await client.SearchAsync <T>(x => searchRequest);

            //if (hasHighlight)
            //{
            //    var listWithHightlight = new List<T>();
            //    response.Hits.ToList().ForEach(x =>
            //    {
            //        if (x.Highlights?.Count > 0)
            //        {
            //            PropertyInfo[] properties = typeof(T).GetProperties();
            //            foreach (string key in pageParams.Highlight?.Keys)
            //            {
            //                //先得到要替换的内容
            //                if (x.Highlights.ContainsKey(key))
            //                {
            //                    string value = string.Join("", x.Highlights[key]?.Highlights);
            //                    PropertyInfo info = properties.FirstOrDefault(p => p.Name == pageParams.Highlight.PrefixOfKey + key);
            //                    //没找到带前缀的属性,则替换之前的
            //                    if (info == null && pageParams.Highlight.ReplaceAuto)
            //                    {
            //                        info = properties.FirstOrDefault(p => p.Name == key);
            //                    }
            //                    if (info?.CanWrite == true)
            //                    {
            //                        if (!string.IsNullOrEmpty(value))
            //                        {
            //                            //如果高亮字段不为空,才赋值,否则就赋值成空
            //                            info.SetValue(x.Source, value);
            //                        }
            //                    }
            //                }
            //            }
            //        }
            //        listWithHightlight.Add(x.Source);
            //    });
            //}
            return(new CustomQueryResult <T>()
            {
                Data = response.Documents,
                Took = response.Took,
                TotalCount = response.Total
            });
        }
        public PageData <QuestionTypeDto> GetPageList(SearchModel searchModel, Expression <Func <QuestionType, int> > orderByKeySelector, PageParam pageParam, bool bIsAscOrder = true)
        {
            IQueryable <QuestionType> questionTypeQuerable = GetDbSet <QuestionType>();

            PageData <QuestionType> questionTypeList = PageHelper.GetPageData(questionTypeQuerable, orderByKeySelector, pageParam, bIsAscOrder, searchModel.Sort);

            PageData <QuestionTypeDto> questionTypeDtoList = new PageData <QuestionTypeDto>(questionTypeList.PageParam, questionTypeList.PageModel.TotalItem);

            List <int> questionTypeIdList = questionTypeList.Data.Select(o => o.Id).ToList();

            List <QuestionChapter> chapterList = GetDbSet <QuestionChapter>().Where(o => questionTypeIdList.Contains(o.QuestionTypeId)).ToList();

            questionTypeDtoList.Data = questionTypeList.Data.Select(o => new QuestionTypeDto
            {
                QuestionType     = o,
                QuestionChapters = chapterList.Where(a => a.QuestionTypeId == o.Id).OrderBy(a => a.OrderIndex).ToList()
            }).ToList();

            List <Question> questionList = GetDbSet <Question>().Where(o => questionTypeIdList.Contains(o.QuestionTypeId)).ToList();

            questionTypeDtoList.Data.ForEach(o =>
            {
                o.QuestionType.QuestionCount = questionList.Where(q => q.QuestionTypeId == o.QuestionType.Id).Count();
                o.QuestionChapters.ForEach(c =>
                {
                    c.QuestionCount = questionList.Where(q => q.QuestionTypeId == o.QuestionType.Id & q.QuestionChapterId == c.Id).Count();
                });
            });

            return(questionTypeDtoList);
        }
        public ActionResult GetList(SearchModel search, PageParam pageParam)
        {
            PageData <WithdrawDto> pageData = _helper.GetPageList(search, o => o.ApplyTime, pageParam, false);

            return(Success(pageData));
        }
Exemple #8
0
 public abstract PagedList <AbstractUsers> UsersSelectAll(PageParam pageParam, string Search = "", int RoleId = 0);
 public async Task <ApiResult <Page <SysRole> > > List([FromBody] PageParam param) => await _sysRoleService.PageList(param);
Exemple #10
0
        private T DoPage <T>(RequestContext ctx, GridRequest grid, Func <SqlMap, PageParam, T> func)
        {
            var map = GetSqlMap(ctx);

            // 附加查询参数,方便生成缓存Key
            map.AppendSqlParams(ctx);

            #region 从sqlmap中获取参数信息
            var param  = new PageParam();
            var isTree = map.Params.GetValue("istree", false);

            var table = map.Params.GetValue("table", "");
            param.Table    = map.Params.GetValue("operatetable", table);
            param.Columns  = map.Params.GetValue("fields", "*");
            param.Where    = map.Params.GetValue("where", "");
            param.Groupby  = map.Params.GetValue("groupby", "");
            param.Orderby  = map.Params.GetValue("orderby", "id");
            param.Page     = map.Params.GetValue("page", 1);
            param.PageSize = map.Params.GetValue("pagesize", 20);
            #endregion

            #region 当请求参数存在时,覆盖相应参数
            if (grid != null)
            {
                if (grid.Order.HasValue())
                {
                    var sb     = new StringBuilder();
                    var sorts  = grid.Sort.Split(',');
                    var orders = grid.Order.Split(',');
                    for (var i = 0; i < sorts.Length; i++)
                    {
                        sb.Append($",{sorts[i]} {orders[i]}");
                    }
                    if (sb.Length > 1)
                    {
                        sb.Remove(0, 1);
                        param.Orderby = sb.ToString();
                    }
                }
                if (grid.Page.HasValue)
                {
                    param.Page = grid.Page.Value;
                }
                if (grid.Rows.HasValue)
                {
                    param.PageSize = grid.Rows.Value;
                }
            }
            #endregion

            #region 处理查询参数
            string q                   = string.Empty;
            string queryValue          = null;
            bool   hasFilterParam      = false;
            bool   hasFilterParamValue = false;
            foreach (var query in map.Query)
            {
                if (query.Value != "qs" && query.Value != "ac")
                {
                    // 拼接条件
                    if (query.Key.StartsWith("_"))
                    {
                        hasFilterParam = true;
                    }
                    queryValue = App.GetQuery(query.Key, "").Trim();
                    if (queryValue.HasValue())
                    {
                        // 此处同步添加ctx的params
                        ctx.Params[query.Key] = queryValue;

                        // 拼接查询条件
                        hasFilterParamValue = hasFilterParam;
                        if (query.Key.StartsWith("in"))
                        {
                            q += $" and ({string.Format(query.Value, queryValue)})";
                        }
                        else
                        {
                            q += $" and ({string.Format(query.Value, queryValue.Split(','))})";
                        }
                    }
                }
            }
            if (q.HasValue() && (!isTree || (isTree && !grid.Id.HasValue)))
            {
                // 当不为树表格 或 树表格顶级数据时,拼接查询条件
                if (param.Where.HasValue())
                {
                    param.Where += q;
                }
                else
                {
                    param.Where = q.Substring(5);
                }
            }
            else if (!isTree || (isTree && !grid.Id.HasValue))
            {
                // 当存在filter参数,且没值的时候取wherenotfilter
                if (hasFilterParam && !hasFilterParamValue)
                {
                    string filter = map.Params.GetValue("wherenotfilter", "");
                    if (filter.HasValue())
                    {
                        if (param.Where.HasValue())
                        {
                            param.Where += " and " + filter;
                        }
                        else
                        {
                            param.Where = filter;
                        }
                    }
                }
            }

            if (isTree)
            {
                string w;
                var    asyncWhere = map.Params.GetValue("asyncwhere", "");
                var    rootWhere  = map.Params.GetValue("rootwhere", "");

                if (grid.Id.HasValue)
                {
                    w = asyncWhere.HasValue() ? asyncWhere : $"parentid={grid.Id.Value}";
                }
                else
                {
                    w = rootWhere.HasValue() ? rootWhere : "1=1";
                }

                if (param.Where.HasValue())
                {
                    param.Where += " and " + w;
                }
                else
                {
                    param.Where = w;
                }
            }
            #endregion

            #region 处理上下文变量
            if (ctx.ExtraParams != null)
            {
                param.Table   = param.Table.Replace(ctx.ExtraParams);
                param.Where   = param.Where.Replace(ctx.ExtraParams);
                param.Columns = param.Columns.Replace(ctx.ExtraParams);
            }
            param.Where = param.Where.Replace(ctx.Params);
            #endregion

            // 获取数据
            return(DoRequest(ctx, () => func(map, param)));
        }
Exemple #11
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootLayout = inflater.Inflate(Resource.Layout.HomeMainVw, container, false);
            var barTableTextView = RootLayout.FindViewById <TextView>(Resource.Id.BarTitle);

            barTableTextView.Text = "LCL";
            PageUrl          = "/LCL";
            PageId           = "ÎÒµÄÊ×Ò³";
            ParentWebViewKey = "";
            ParentPageId     = "";
            ParentPageUrl    = "";
            var pageParam = new PageParam()
            {
                PageUrl       = PageUrl,
                PageId        = PageId,
                ParentPageId  = "",
                ParentPageUrl = ""
            };

            if (AnalyticAgreement.PageParam.ContainsKey(pageParam.PageId))
            {
                AnalyticAgreement.PageParam[pageParam.PageId] = pageParam;
            }
            else
            {
                AnalyticAgreement.PageParam.Add(pageParam.PageId, pageParam);
            }
            if (X5WebViewHelper.PageActivity.ContainsKey(pageParam.PageId))
            {
                X5WebViewHelper.PageActivity[pageParam.PageId] = this.Activity;
            }
            else
            {
                X5WebViewHelper.PageActivity.Add(PageId, this.Activity);
            }
            //webViewÉèÖÃ
            pageParam.WebViewKey = X5WebViewHelper.WebViewInit(PageId);
            WebViewKey           = pageParam.WebViewKey;

            //var router = "{ path: '" + pageParam.PageUrl + "', params: { PageId: '" + PageId + "' }}";
            if (string.IsNullOrWhiteSpace(pageParam.OpenParam))
            {
                pageParam.OpenParam = "";
            }
            pageParam.OpenParam = pageParam.OpenParam.Replace("'", "```").Replace("\"", "~~~");
            var router = pageParam.PageUrl + "/" + pageParam.OpenParam;
            var js     = $@"window.AppBridge.Router.push(""{router}"")";

            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, js);
            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.SetPageId(""{pageParam.ParentPageId}"",""{pageParam.PageId}"")");


            //Òþ²Øµ¼º½Ìõ
            var rlTitle = RootLayout.FindViewById <RelativeLayout>(Resource.Id.rlTitle);

            rlTitle.Visibility = ViewStates.Gone;
            //Òþ²Ø·µ»Ø°´Å¥
            var btnReturn = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnReturn);

            btnReturn.Visibility = ViewStates.Gone;
            //Òþ²ØÓҲఴť
            var txtRight = RootLayout.FindViewById <TextView>(Resource.Id.txtRight);

            txtRight.Visibility = ViewStates.Gone;
            //ÓҲఴťÃû×Ö
            txtRight.Text = "ÏûÏ¢";
            //ÓҲఴťÏìÓ¦
            var btnRight = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnRight);

            btnRight.Click += (sender, args) =>
            {
                //var intent = new Intent(this.Activity, typeof(ChatMain));
                //intent.PutExtra("pram", "1");
                //StartActivity(intent);
                new ChatMain(PageId);
            };

            return(RootLayout);
        }
 /// <summary>
 /// 前台分页参数
 /// </summary>
 /// <param name="strFieldName">列名</param>
 /// <param name="param">参数类型</param>
 /// <param name="strFieldValue">列值</param>
 public PageParams(string strFieldName, PageParam param, string strFieldValue)
 {
     this.strFieldName  = strFieldName;
     this.param         = param;
     this.strFieldValue = strFieldValue;
 }
Exemple #13
0
 public PageResult <StudentDto> GetStudents(PageParam pageParam)
 {
     return(_studentRepository.GetAll().ToDtos().ToPageResult(pageParam));
 }
 public abstract PagedList <AbstractOpportunities_Tasks> Opportunities_TasksSelectAll(PageParam pageParam, string Search = "", int OpportunityId = 0, int AssignedUserId = 0, int StatusId = 0, string StartDate = "", string EndDate = "");
Exemple #15
0
 public ActionResult GetQuestionChapterList(SearchModel searchModel, PageParam pageParam)
 {
     return(Success(_helper.GetQuestionChapter(searchModel, pageParam)));
 }
 public async Task <ApiResult <Page <SysAuthority> > > List([FromBody] PageParam param) => await _sysAuthorityService.PageList(param);
Exemple #17
0
        /// <summary>
        /// 根据商家Id 获取 商家分店列表
        /// </summary>
        /// <param name="storeId"></param>
        /// <returns></returns>
        public Tuple <bool, string, int, List <SonStoreInfoParam> > GetSonStoreList(string token, PageParam pageParam)
        {
            UserEntity user = helper.Query <UserEntity>($@"select a.* from [User] a left join [UserAccessToken] b on a.Id=b.UserId where b.TokenId='{token}'").FirstOrDefault();

            if (user.UserType != 2)
            {
                return(Tuple.Create(false, "当前账号不是商家,没有分店", 0, new List <SonStoreInfoParam>()));
            }
            if (!user.StoreManage)
            {
                return(Tuple.Create(false, "当前账号没有管理分店的权限", 0, new List <SonStoreInfoParam>()));
            }
            if (string.IsNullOrWhiteSpace(user.StoreCode))
            {
                return(Tuple.Create(false, string.Empty, 0, new List <SonStoreInfoParam>()));
            }

            string likeSql = string.IsNullOrWhiteSpace(pageParam.Keyword) ? string.Empty : $@" and  b.StoreName like '%{pageParam.Keyword}%' ";

            string sql   = string.Format(@"
                select top {0} * from (select row_number() over(order by  b.CreateTime desc) as rownumber,
 a.Id,b.StoreName,a.Phone,a.Password,b.Enabled from [User] a left join StoreDetailInfo b on a.Id= b.UserId 
where a.StoreCode='{2}' and a.UserType=3 {3}) temp_row
                    where temp_row.rownumber>(({1}-1)*{0});", pageParam.PageSize, pageParam.PageIndex, user.StoreCode, likeSql);
            int    count = Convert.ToInt32(helper.QueryScalar($@"select Count(1) from [User] a left join StoreDetailInfo b on a.Id= b.UserId  where a.Status=1 and a.UserType=3 and a.StoreCode= '{user.StoreCode}'  {likeSql} "));



            var result = helper.Query <SonStoreInfoParam>(sql).ToList();

            return(Tuple.Create(true, string.Empty, count, result));
        }
 public async Task <ApiResult <List <SysOrganizeTree> > > List([FromQuery] PageParam param) => await _sysOrganizeService.GetTree(param);
        /// <summary>
        /// Executes the query.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <param name="param">The parameter.</param>
        /// <returns>
        /// returns the paged list result.
        /// </returns>
        public async Task <SuccessResult <PagedList <dynamic> > > ExecuteDynamicQuery(string query, PageParam param)
        {
            SuccessResult <PagedList <dynamic> > result = null;
            PagedList <dynamic> page = new PagedList <dynamic>(param);

            using (SqlConnection connection = new SqlConnection(Configurations.ConnectionString))
            {
                var task = await connection.QueryMultipleAsync(query);

                page.Values.AddRange(task.Read <dynamic>());
                page.TotalRecords = task.Read <int>().SingleOrDefault();
            }

            result = new SuccessResult <PagedList <dynamic> >
            {
                Item = page,
                Code = 200
            };

            return(result);
        }
Exemple #20
0
 public async Task <ApiResult <Page <SysCode> > > List([FromQuery] PageParam param) => await _sysCodeService.PageList(param);
        public ActionResult SearchInfo(PageParam bannerParams)
        {
            PageList <Config_ServiceTypeSearch> bannerList = Config_ServiceTypeBLL.SearchInfo(bannerParams);

            return(Json(bannerList, JsonRequestBehavior.AllowGet));
        }
Exemple #22
0
        /// <summary>
        /// 筛选某台车辆之前的车辆( CarSeriesGrade seriesGrade = CarSeriesGrade.None, CarBrandCountry brandCountry = CarBrandCountry.None, CarDrive carDrive = CarDrive.None, CarEnergy carEnergy = CarEnergy.None, CarGearbox carGearbox = CarGearbox.None, CarSeat carSeat = CarSeat.None,DateTime ? carAgeBegin = null, DateTime? CarAgeEnd = null, float mileageBegin = 0, float mileageEnd = 0, float emissionBegin = 0, float emissionEnd = 0)
        /// </summary>
        /// <param name="pageParam"></param>
        /// <param name="indexCarId"></param>
        /// <param name="brandId"></param>
        /// <param name="seriesId"></param>
        /// <param name="seriesGrade"></param>
        /// <param name="carActivity"></param>
        /// <param name="brandCountry"></param>
        /// <param name="carAgeBegin"></param>
        /// <param name="CarAgeEnd"></param>
        /// <param name="mileageBegin"></param>
        /// <param name="mileageEnd"></param>
        /// <param name="emissionBegin"></param>
        /// <param name="emissionEnd"></param>
        /// <param name="carDrive"></param>
        /// <param name="carEnergy"></param>
        /// <param name="carGearbox"></param>
        /// <param name="carSeat"></param>
        /// <returns></returns>
        public List <ResCarConciseInfo> GetBeforeFilterCars(PageParam pageParam, string indexCarId, string brandId = null, string seriesId = null, CarActivity carActivity           = CarActivity.None,
                                                            CarSeriesGrade seriesGrade = CarSeriesGrade.None, CarBrandCountry brandCountry = CarBrandCountry.None, CarDrive carDrive = CarDrive.None,
                                                            CarEnergy carEnergy        = CarEnergy.None, CarGearbox carGearbox = CarGearbox.None, CarSeat carSeat = CarSeat.None)
        {
            using (var dbs = WxDbFactory.GetDbContext("hch_dbs").MyDB)
            {
                //var ret = dbs.From<CarsConcise>().Join<CarsConcise, CarsDetails>((cc, cd) => cc.CarsDetailsId == cd.Id).Where<CarsConcise>(x => x.State == ValidityState.Enabled && x.CarSell == CarSell.Sale && x.Id.CompareTo(indexCarId) < 0
                // && (string.IsNullOrWhiteSpace(brandId) || x.BrandId == brandId) && (string.IsNullOrWhiteSpace(seriesId) || x.SeriesId == seriesId) && (carActivity == CarActivity.None || x.CarActivity == carActivity))
                //.Select<CarsConcise, CarsDetails>((cc, cd) => new { CarInfoId = cc.Id, cc.Name, cc.BrandId, cc.CarsDetailsId, cc.AccountId, cc.CorporationId, cc.GuidePrice, cc.SellingPrice, cc.SurfaceImage, cc.CarActivity, cc.UpdateTime, cd.CarLicenseTime, cd.Mileage });
                //if (pageParam.SortType == SortType.Price)
                //{
                //    if (pageParam.Ascending == true)
                //    {
                //        var list = dbs.Select<ResCarConciseInfo>(ret).OrderBy(x => x.SellingPrice).Take(pageParam.PageSize).ToList();
                //        return list;
                //    }
                //    else
                //    {
                //        var list = dbs.Select<ResCarConciseInfo>(ret).OrderByDescending(x => x.SellingPrice).Take(pageParam.PageSize).ToList();
                //        return list;
                //    }
                //}
                //else
                //{
                //    if (pageParam.Ascending == true)
                //    {
                //        var list = dbs.Select<ResCarConciseInfo>(ret).OrderBy(x => x.UpdateTime).Take(pageParam.PageSize).ToList();
                //        return list;
                //    }
                //    else
                //    {
                //        var list = dbs.Select<ResCarConciseInfo>(ret).OrderByDescending(x => x.UpdateTime).Take(pageParam.PageSize).ToList();
                //        return list;
                //    }
                //}

                var sql = new StringBuilder(" SELECT cc.Id,cc.Id as CarInfoId, cc.`Name`,cc.CarsDetailsId,cc.GuidePrice,cc.SellingPrice,cc.SurfaceImage,cc.CarActivity,cc.UpdateTime,cd.CarLicenseTime,cd.Mileage FROM " +
                                            " ( SELECT carc.Id,carc.`Name`,carc.SeriesId, carc.CarsDetailsId, carc.GuidePrice, carc.SellingPrice,  carc.SurfaceImage, carc.CarActivity, carc.UpdateTime FROM CarsConcise as carc ");

                if (seriesGrade != CarSeriesGrade.None || brandCountry != CarBrandCountry.None)
                {
                    sql.Append(" INNER JOIN ( SELECT Id FROM CarsBrandSeries WHERE 1=1 ");
                    if (seriesGrade != CarSeriesGrade.None)
                    {
                        sql.Append(" and SeriesGrade= " + (int)seriesGrade);
                    }
                    if (brandCountry != CarBrandCountry.None)
                    {
                        sql.Append(" and BrandCountry= " + (int)brandCountry);
                    }
                    sql.Append(" ) AS cbs ON cbs.Id = carc.SeriesId ");
                }
                sql.Append("WHERE carc.CarSell = 0 and carc.State=1 ");
                if (!string.IsNullOrWhiteSpace(indexCarId))
                {
                    sql.Append(" and carc.Id < '" + indexCarId + "'");
                }
                if (!string.IsNullOrWhiteSpace(brandId))
                {
                    sql.Append(" and carc.BrandId ='" + brandId + "'");
                }
                if (!string.IsNullOrWhiteSpace(seriesId))
                {
                    sql.Append(" and carc.SeriesId = '" + seriesId + "'");
                }
                if (carActivity != CarActivity.None)
                {
                    sql.Append(" and carc.CarActivity =" + (int)carActivity);
                }
                sql.Append(" ) AS cc  INNER JOIN(SELECT Id, CarLicenseTime, Mileage FROM CarsDetails where 1=1 ");

                if (carDrive != CarDrive.None)
                {
                    sql.Append(" and  CarDrive= " + (int)carDrive);
                }
                if (carEnergy != CarEnergy.None)
                {
                    sql.Append(" and  CarEnergy= " + (int)carEnergy);
                }
                if (carGearbox != CarGearbox.None)
                {
                    sql.Append(" and CarGearbox= " + (int)carGearbox);
                }
                if (carSeat != CarSeat.None)
                {
                    sql.Append(" and CarSeat= " + (int)carSeat);
                }
                sql.Append(" )AS cd  ON cd.Id = cc.CarsDetailsId ");

                if (pageParam.SortType == SortType.Time)
                {
                    if (pageParam.Ascending == true)
                    {
                        sql.Append(" ORDER BY cc.UpdateTime ");
                    }
                    else
                    {
                        sql.Append(" ORDER BY cc.UpdateTime desc");
                    }
                }
                else
                {
                    if (pageParam.Ascending == true)
                    {
                        sql.Append(" ORDER BY cc.SellingPrice ");
                    }
                    else
                    {
                        sql.Append(" ORDER BY cc.SellingPrice desc");
                    }
                }
                //var ss = sql.ToString();
                var query = dbs.Select <ResCarConciseInfo>(sql.ToString()).Take(pageParam.PageSize).ToList();
                return(query);
            }
        }
Exemple #23
0
 public ApiResponse <List <Logs> > SysLogs(PageParam pageParam)
 {
     return(ApiResponse <List <Logs> > .Ok(new List <Logs>()));
 }
Exemple #24
0
        /// <summary>
        /// 筛选某台太车辆之后的车辆(索引车辆为空,获取最新的几台车辆)
        /// </summary>
        /// <param name="pageParam"></param>
        /// <param name="indexCarId"></param>
        /// <param name="brandId"></param>
        /// <param name="seriesId"></param>
        /// <param name="seriesGrade"></param>
        /// <param name="carActivity"></param>
        /// <param name="brandCountry"></param>
        /// <param name="carAgeBegin"></param>
        /// <param name="CarAgeEnd"></param>
        /// <param name="mileageBegin"></param>
        /// <param name="mileageEnd"></param>
        /// <param name="emissionBegin"></param>
        /// <param name="emissionEnd"></param>
        /// <param name="carDrive"></param>
        /// <param name="carEnergy"></param>
        /// <param name="carGearbox"></param>
        /// <param name="carSeat"></param>
        /// <returns></returns>
        public List <ResCarConciseInfo> GetLaterFilterCars(PageParam pageParam, string indexCarId = null, string brandId = null, string seriesId = null, CarActivity carActivity = CarActivity.None,
                                                           CarSeriesGrade seriesGrade             = CarSeriesGrade.None, CarBrandCountry brandCountry = CarBrandCountry.None, CarDrive carDrive = CarDrive.None,
                                                           CarEnergy carEnergy = CarEnergy.None, CarGearbox carGearbox = CarGearbox.None, CarSeat carSeat = CarSeat.None)
        {
            using (var dbs = WxDbFactory.GetDbContext("hch_dbs").MyDB)
            {
                var sql = new StringBuilder(" SELECT cc.Id,cc.Id as CarInfoId, cc.`Name`,cc.CarsDetailsId,cc.GuidePrice,cc.SellingPrice,cc.SurfaceImage,cc.CarActivity,cc.UpdateTime,cd.CarLicenseTime,cd.Mileage FROM " +
                                            " ( SELECT carc.Id,carc.`Name`,carc.SeriesId, carc.CarsDetailsId, carc.GuidePrice, carc.SellingPrice,  carc.SurfaceImage, carc.CarActivity, carc.UpdateTime FROM CarsConcise as carc ");

                if (seriesGrade != CarSeriesGrade.None || brandCountry != CarBrandCountry.None)
                {
                    sql.Append(" INNER JOIN ( SELECT Id FROM CarsBrandSeries WHERE 1=1 ");
                    if (seriesGrade != CarSeriesGrade.None)
                    {
                        sql.Append(" and SeriesGrade= " + (int)seriesGrade);
                    }
                    if (brandCountry != CarBrandCountry.None)
                    {
                        sql.Append(" and BrandCountry= " + (int)brandCountry);
                    }
                    sql.Append(" ) AS cbs ON cbs.Id = carc.SeriesId ");
                }
                sql.Append("WHERE carc.CarSell = 0 and carc.State=1 ");
                if (!string.IsNullOrWhiteSpace(indexCarId))
                {
                    sql.Append(" and carc.Id > '" + indexCarId + "'");
                }
                if (!string.IsNullOrWhiteSpace(brandId))
                {
                    sql.Append(" and carc.BrandId ='" + brandId + "'");
                }
                if (!string.IsNullOrWhiteSpace(seriesId))
                {
                    sql.Append(" and carc.SeriesId = '" + seriesId + "'");
                }
                if (carActivity != CarActivity.None)
                {
                    sql.Append(" and carc.CarActivity =" + (int)carActivity);
                }
                sql.Append(" ) AS cc  INNER JOIN(SELECT Id, CarLicenseTime, Mileage FROM CarsDetails where 1=1 ");

                if (carDrive != CarDrive.None)
                {
                    sql.Append(" and  CarDrive= " + (int)carDrive);
                }
                if (carEnergy != CarEnergy.None)
                {
                    sql.Append(" and  CarEnergy= " + (int)carEnergy);
                }
                if (carGearbox != CarGearbox.None)
                {
                    sql.Append(" and CarGearbox= " + (int)carGearbox);
                }
                if (carSeat != CarSeat.None)
                {
                    sql.Append(" and CarSeat= " + (int)carSeat);
                }
                sql.Append(" )AS cd  ON cd.Id = cc.CarsDetailsId ");

                if (pageParam.SortType == SortType.Time)
                {
                    if (pageParam.Ascending == true)
                    {
                        sql.Append(" ORDER BY cc.UpdateTime ");
                    }
                    else
                    {
                        sql.Append(" ORDER BY cc.UpdateTime desc");
                    }
                }
                else
                {
                    if (pageParam.Ascending == true)
                    {
                        sql.Append(" ORDER BY cc.SellingPrice ");
                    }
                    else
                    {
                        sql.Append(" ORDER BY cc.SellingPrice desc");
                    }
                }
                //var ss = sql.ToString();
                var query = dbs.Select <ResCarConciseInfo>(sql.ToString()).Take(pageParam.PageSize).ToList();
                return(query);
            }
        }
 public override PagedList <AbstractOpportunities_Tasks> Opportunities_TasksSelectAll(PageParam pageParam, string Search = "", int OpportunityId = 0, int AssignedUserId = 0, int StatusId = 0, string StartDate = "", string EndDate = "")
 {
     return(this.abstractOpportunities_TasksDao.Opportunities_TasksSelectAll(pageParam, Search, OpportunityId, AssignedUserId, StatusId, StartDate, EndDate));
 }
Exemple #26
0
        /// <summary>
        /// 查询某个人发布的(在售、下架)某台太车辆之前的车辆
        /// </summary>
        /// <param name="openId"></param>
        /// <param name="carSell"></param>
        /// <param name="pageParam"></param>
        /// <param name="indexCarId"></param>
        /// <returns></returns>

        public List <ResCarConciseInfo> GetBeforeUserCars(string openId, CarSell carSell, PageParam pageParam, string indexCarId)
        {
            using (var dbs = WxDbFactory.GetDbContext("hch_dbs").MyDB)
            {
                var q   = dbs.From <CarsConcise>().Join <CarsConcise, CarsDetails>((cc, cd) => cc.CarsDetailsId == cd.Id).Where(x => x.State == ValidityState.Enabled && x.CarSell == carSell && x.AccountId == openId).Select <CarsConcise, CarsDetails>((cc, cd) => new { cc.Id, CarInfoId = cc.Id, cc.CarsDetailsId, cc.Name, cc.GuidePrice, cc.SellingPrice, cc.SurfaceImage, cc.CarActivity, cc.UpdateTime, cd.CarLicenseTime, cd.Mileage });
                var ret = dbs.Select <ResCarConciseInfo>(q).Where(x => x.Id.CompareTo(indexCarId) < 0).OrderByDescending(x => x.UpdateTime).Take(pageParam.PageSize).ToList();
                return(ret);
            }
        }
        /// <summary>
        /// 方法有点长,需要重构
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pageParams"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public IQueryResult <T> Query <T>(IPageParam pageParams, string index = null) where T : class
        {
            if (pageParams == null)
            {
                pageParams = new PageParam
                {
                    PageIndex = 0,
                    PageSize  = 20
                };
            }

            SearchDescriptor <T> searchDescriptor = new SearchDescriptor <T>()
                                                    .Type(_defaultType)
                                                    .Index(index ?? _defaultIndex)
                                                    .From(pageParams.From)
                                                    .Size(pageParams.PageSize);


            if (pageParams is PageParamWithSearch)
            {
                PageParamWithSearch pageParamsSearch = pageParams as PageParamWithSearch;

                searchDescriptor = searchDescriptor.Query(q =>
                                                          q.QueryString(qs =>
                                                                        qs.Fields(pageParamsSearch.SearchKeys)
                                                                        .Query(pageParamsSearch.KeyWord)
                                                                        .DefaultOperator(pageParamsSearch.Operator)));
            }
            else if (pageParams is PageParam)
            {
                searchDescriptor = searchDescriptor.Query(q =>
                                                          q.QueryString(qs =>
                                                                        qs.Query(pageParams.KeyWord)
                                                                        .DefaultOperator(pageParams.Operator)));
            }

            //是否需要高亮
            bool hasHighlight = pageParams.Highlight?.Keys?.Length > 0;

            if (hasHighlight)
            {
                //TODO
                BuildHighLightQuery <T>(pageParams, ref searchDescriptor);
            }
            //所有条件配置完成之后执行查询
            ISearchResponse <T> response = _builder?.Client.Search <T>(s => searchDescriptor);

            var list = response.Documents;
            var listWithHightlight = new List <T>();

            if (hasHighlight)
            {
                response.Hits.ToList().ForEach(x =>
                {
                    if (x.Highlights?.Count > 0)
                    {
                        PropertyInfo[] properties = typeof(T).GetProperties();
                        foreach (string key in pageParams.Highlight?.Keys)
                        {
                            //先得到要替换的内容
                            if (x.Highlights.ContainsKey(key))
                            {
                                string value      = string.Join("", x.Highlights[key]?.Highlights);
                                PropertyInfo info = properties.FirstOrDefault(p => p.Name == pageParams.Highlight.PrefixOfKey + key);
                                //没找到带前缀的属性,则替换之前的
                                if (info == null && pageParams.Highlight.ReplaceAuto)
                                {
                                    var filed = key[0].ToString().ToUpper() + key.Substring(1, key.Length - 1);
                                    info      = properties.FirstOrDefault(p => p.Name == filed);
                                }
                                if (info?.CanWrite == true)
                                {
                                    if (!string.IsNullOrEmpty(value))
                                    {
                                        //如果高亮字段不为空,才赋值,否则就赋值成空
                                        info.SetValue(x.Source, value);
                                    }
                                }
                            }
                        }
                    }
                    listWithHightlight.Add(x.Source);
                });
            }


            IQueryResult <T> result = new CustomQueryResult <T>
            {
                List  = listWithHightlight,
                Took  = response.Took,
                Total = response.Total
            };

            return(result);
        }
Exemple #28
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootLayout = inflater.Inflate(Resource.Layout.HomeMainVw, container, false);
            var barTableTextView = RootLayout.FindViewById <TextView>(Resource.Id.BarTitle);

            barTableTextView.Text = "我的";
            PageUrl          = "/User";
            PageId           = "我的个人中心";
            ParentWebViewKey = "";
            ParentPageId     = "";
            ParentPageUrl    = "";
            var pageParam = new PageParam()
            {
                PageUrl       = PageUrl,
                PageId        = PageId,
                ParentPageId  = "",
                ParentPageUrl = ""
            };

            if (AnalyticAgreement.PageParam.ContainsKey(pageParam.PageId))
            {
                AnalyticAgreement.PageParam[pageParam.PageId] = pageParam;
            }
            else
            {
                AnalyticAgreement.PageParam.Add(pageParam.PageId, pageParam);
            }
            if (X5WebViewHelper.PageActivity.ContainsKey(pageParam.PageId))
            {
                X5WebViewHelper.PageActivity[pageParam.PageId] = this.Activity;
            }
            else
            {
                X5WebViewHelper.PageActivity.Add(PageId, this.Activity);
            }
            //webView设置
            pageParam.WebViewKey = X5WebViewHelper.WebViewInit(PageId);
            WebViewKey           = pageParam.WebViewKey;


            //var router = "{ path: '" + pageParam.PageUrl + "', params: { PageId: '" + PageId + "' }}";
            if (string.IsNullOrWhiteSpace(pageParam.OpenParam))
            {
                pageParam.OpenParam = "";
            }
            pageParam.OpenParam = pageParam.OpenParam.Replace("'", "```").Replace("\"", "~~~");
            var router = pageParam.PageUrl + "/" + pageParam.OpenParam;

            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.Router.push(""{router}"")");
            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.SetPageId(""{pageParam.ParentPageId}"",""{pageParam.PageId}"")");

            //隐藏导航条
            var rlTitle = RootLayout.FindViewById <RelativeLayout>(Resource.Id.rlTitle);

            rlTitle.Visibility = ViewStates.Gone;
            //隐藏返回按钮
            var btnReturn = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnReturn);

            btnReturn.Visibility = ViewStates.Gone;
            //隐藏右侧按钮
            var txtRight = RootLayout.FindViewById <TextView>(Resource.Id.txtRight);

            txtRight.Visibility = ViewStates.Gone;

            return(RootLayout);
        }
Exemple #29
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="cateid"></param>
        /// <param name="title"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static Pager <v_get_articles> GetArticlesByPager(int cateid, string title, PageParam page)
        {
            using (ARTICLE_DBEntities context = new ARTICLE_DBEntities())
            {
                Pager <v_get_articles> pg = new Pager <v_get_articles>();
                var res = context.v_get_articles.Where(t => true);
                if (cateid != -1)
                {
                    res = res.Where(t => t.cate_id == cateid);
                }
                if (!string.IsNullOrEmpty(title))
                {
                    // contains -> like
                    res = res.Where(t => t.title.Contains(title));
                }
                pg.Total = res.Count();
                pg.Rows  = res.OrderBy(t => t.update_time).Skip(page.Skip).Take(page.PageSize).ToList();

                return(pg);
            }
        }
        /// <summary>
        /// Sets the offset links.
        /// </summary>
        /// <typeparam name="T">The class.</typeparam>
        /// <param name="routeName">Name of the route.</param>
        /// <param name="routeValues">The route values.</param>
        /// <param name="result">The result.</param>
        /// <param name="pageParam">The page parameter.</param>
        private void OffsetLinks <T>(string routeName, object routeValues, PagedResult <T> result, PageParam pageParam) where T : class
        {
            IDictionary <string, object> routeDictionary = routeValues as IDictionary <string, object>;

            routeDictionary.Remove("page");
            routeDictionary.Remove("pageSize");

            routeDictionary["limit"] = pageParam.Limit;

            if (result.TotalResults > 0)
            {
                ////routeValues["offset"] = offset;
                ////string current = this.GetLink(routeName, routeValues);
                ////result._links.Add("current", current);

                if (pageParam.Offset > 0)
                {
                    routeDictionary["offset"] = pageParam.Offset - pageParam.Limit;
                    string previous = this.GetLink(routeName, routeDictionary);
                    result._links.Add("previous", previous);

                    ////routeValues["offset"] = 0;
                    ////string first = this.GetLink(routeName, routeValues);
                    ////result._links.Add("first", first);
                }

                if (pageParam.Offset + pageParam.Limit < result.TotalResults)
                {
                    routeDictionary["offset"] = pageParam.Offset + pageParam.Limit;
                    string next = this.GetLink(routeName, routeDictionary);
                    result._links.Add("next", next);

                    //////routeValues["offset"] = result.TotalResults;
                    //////string last = this.GetLink(routeName, routeValues);
                    //////result._links.Add("last", last);
                }
            }
        }