示例#1
0
        /// <summary>
        /// 查询所有驾校信息 按当前位置坐标距离最近排序
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public List <SchoolEntity> GetAllShoolList(SchoolEntity para)
        {
            var list = SchoolBLL.Instance.GetList(para);

            list.ForEach((o) =>
            {
                if (o.Lat != null && o.Lng != null && para.Lat != null && para.Lng != null)
                {
                    o.HowLong = HarvenSin.GetDistance(
                        new Point2D()
                    {
                        Lng = (double)para.Lng,
                        Lat = (double)para.Lat
                    },
                        new Point2D()
                    {
                        Lng = (double)o.Lng,
                        Lat = (double)o.Lat
                    }).ToString("f2");
                }
                else
                {
                    o.HowLong = "未知";
                }
            });
            //list = list.OrderByDescending(d => d.HowLong).ToList();
            list = list.OrderBy(i => i.HowLong).ThenBy(i => i.SortNum).ToList();
            return(list);
        }
示例#2
0
        public JsonResult GetList(string queryJson)
        {
            var result = new ReturnMessage(false)
            {
                Message = "加载列表失败!"
            };

            try
            {
                int type = 1;
                InsuranceCommpayEntity para = new InsuranceCommpayEntity();
                if (!string.IsNullOrWhiteSpace(queryJson))
                {
                    var queryParam = queryJson.ToJObject();
                    if (!queryParam["lat"].IsEmpty())
                    {
                        para.Lat = decimal.Parse(queryParam["lat"].ToString());
                    }
                    if (!queryParam["lng"].IsEmpty())
                    {
                        para.Lng = decimal.Parse(queryParam["lng"].ToString());
                    }
                    if (!queryParam["type"].IsEmpty())
                    {
                        type = int.Parse(queryParam["type"].ToString());
                    }
                }
                para.Status = (int)Model.Enums.UseStatus.启用;

                var pageList = InsuranceCommpayBLL.Instance.GetList(para).OrderBy(o => o.SortNum).ToList();
                if (pageList != null)
                {
                    pageList.ForEach((page) =>
                    {
                        if (page.FaceImage != null)
                        {
                            var imageHost  = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"];
                            page.FaceImage = imageHost + page.FaceImage;
                        }
                        if (page.ProvinceId != null)
                        {
                            page.ProvinceName = AreaBLL.Instance.GetEntity(page.ProvinceId).AreaName;
                        }
                        if (page.CityId != null)
                        {
                            page.CityName = AreaBLL.Instance.GetEntity(page.CityId).AreaName;
                        }
                        if (page.CountyId != null)
                        {
                            page.CountyName = AreaBLL.Instance.GetEntity(page.CountyId).AreaName;
                        }
                        page.AddressInfo = page.ProvinceName + page.CityName + page.CountyName + page.AddressInfo;

                        if (page.Lat != null && page.Lng != null && para.Lat != null && para.Lng != null)
                        {
                            page.HowLong = HarvenSin.GetDistance(
                                new Point2D()
                            {
                                Lng = (double)para.Lng,
                                Lat = (double)para.Lat
                            },
                                new Point2D()
                            {
                                Lng = (double)page.Lng,
                                Lat = (double)page.Lat
                            }).ToString("f2");
                        }
                        else
                        {
                            page.HowLong = "未知";
                        }
                    });
                }
                switch (type)
                {
                case 1:    //按距离
                    pageList = pageList.OrderBy(i => i.HowLong).ThenBy(i => i.HowLong).ToList();
                    break;

                case 2:    //按默认排序
                    pageList = pageList.OrderBy(i => i.CreateTime).ThenBy(i => i.CreateTime).ToList();
                    break;
                }
                result.IsSuccess          = true;
                result.Message            = "加载列表成功!";
                result.ResultData["List"] = pageList;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "VsInsuranceController>>List";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public JsonResult List(string queryJson)
        {
            var result = new ReturnMessage(false)
            {
                Message = "加载列表失败!"
            };

            try
            {
                int          trainingtype = 1;
                SchoolEntity para         = new SchoolEntity();
                if (!string.IsNullOrWhiteSpace(queryJson))
                {
                    var queryParam = queryJson.ToJObject();
                    if (!queryParam["keyword"].IsEmpty())
                    {
                        para.Name = queryParam["keyword"].ToString();
                    }
                    if (!queryParam["provinceid"].IsEmpty())
                    {
                        para.ProvinceId = queryParam["provinceid"].ToString();
                    }
                    if (!queryParam["cityid"].IsEmpty())
                    {
                        para.CityId = queryParam["cityid"].ToString();
                    }
                    if (!queryParam["countyid"].IsEmpty())
                    {
                        para.CountyId = queryParam["countyid"].ToString();
                    }
                    if (!queryParam["priceid"].IsEmpty())
                    {
                        para.TrainingPriceRange = (RCHL.Model.Enums.PriceRange) int.Parse(queryParam["priceid"].ToString());
                    }
                    if (!queryParam["distanceid"].IsEmpty())
                    {
                        para.DistanceRange = (RCHL.Model.Enums.DistanceRange) int.Parse(queryParam["distanceid"].ToString());
                    }
                    if (!queryParam["lat"].IsEmpty())
                    {
                        para.Lat = decimal.Parse(queryParam["lat"].ToString());
                    }
                    if (!queryParam["lng"].IsEmpty())
                    {
                        para.Lng = decimal.Parse(queryParam["lng"].ToString());
                    }
                    if (!queryParam["schoolid"].IsEmpty())
                    {
                        para.SchoolId = queryParam["schoolid"].ToString();
                    }
                    if (!queryParam["istraining"].IsEmpty())
                    {
                        para.IsTraining = int.Parse(queryParam["istraining"].ToString());
                    }
                    if (!queryParam["trainingtype"].IsEmpty())
                    {
                        trainingtype = int.Parse(queryParam["trainingtype"].ToString());
                    }
                }
                para.IsTraining = 1;
                para.Status     = (int)Model.Enums.UseStatus.启用;
                var newlist = new List <SchoolEntity>();
                var flag    = false;
                para.sidx = "sortnum";
                para.sord = "asc";
                var list = SchoolBLL.Instance.GetList(para);
                if (list != null)
                {
                    foreach (var page in list)
                    {
                        if (page.SchoolId != null)
                        {
                            page.TagList = TagBLL.Instance.GetList(new TagEntity()
                            {
                                ObjectId = page.SchoolId
                            });
                            int count = SubjectBLL.Instance.GetList(new SubjectEntity()
                            {
                                SchoolId = page.SchoolId, ItemId = trainingtype.ToString()
                            }).Count();
                            if (count > 0)
                            {
                                flag = true;
                            }
                            else
                            {
                                continue;
                            }
                        }
                        if (page.FaceImage != null)
                        {
                            var imageHost = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"];
                            page.FaceImage = imageHost + page.FaceImage;
                        }

                        if (page.Lat != null && page.Lng != null && para.Lat != null && para.Lng != null)
                        {
                            page.HowLong = HarvenSin.GetDistance(
                                new Point2D()
                            {
                                Lng = (double)para.Lng,
                                Lat = (double)para.Lat
                            },
                                new Point2D()
                            {
                                Lng = (double)page.Lng,
                                Lat = (double)page.Lat
                            }).ToString("f2");
                        }
                        else
                        {
                            page.HowLong = "未知";
                        }

                        //添加数据
                        if (flag)
                        {
                            newlist.Add(page);
                        }
                    }
                }
                result.IsSuccess          = true;
                result.Message            = "加载列表成功!";
                result.ResultData["List"] = newlist;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ExamPlaceController>>List";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public JsonResult GetList(int?pageIndex, string queryJson)
        {
            var result = new ReturnMessage(false)
            {
                Message = "加载列表失败!"
            };

            try
            {
                ShopEntity para = new ShopEntity();
                if (!string.IsNullOrWhiteSpace(queryJson))
                {
                    var queryParam = queryJson.ToJObject();
                    if (!queryParam["keyword"].IsEmpty())
                    {
                        para.Name = queryParam["keyword"].ToString();
                    }
                    if (!queryParam["provinceid"].IsEmpty())
                    {
                        para.ProvinceId = queryParam["provinceid"].ToString();
                    }
                    if (!queryParam["cityid"].IsEmpty())
                    {
                        para.CityId = queryParam["cityid"].ToString();
                    }
                    if (!queryParam["countyid"].IsEmpty())
                    {
                        para.CountyId = queryParam["countyid"].ToString();
                    }
                    if (!queryParam["priceid"].IsEmpty())
                    {
                        para.PriceRange = queryParam["priceid"].ToString();
                    }
                    if (!queryParam["brandid"].IsEmpty())
                    {
                        para.BrandRange = queryParam["brandid"].ToString();
                    }
                    if (!queryParam["distanceid"].IsEmpty())
                    {
                        para.DistanceRange = (QX360.Model.Enums.DistanceRange) int.Parse(queryParam["distanceid"].ToString());
                    }
                    if (!queryParam["lat"].IsEmpty())
                    {
                        para.Lat = decimal.Parse(queryParam["lat"].ToString());
                    }
                    if (!queryParam["lng"].IsEmpty())
                    {
                        para.Lng = decimal.Parse(queryParam["lng"].ToString());
                    }
                }
                para.Status = (int)Model.Enums.UseStatus.启用;
                Pagination pagination = new Pagination();
                pagination.page = pageIndex ?? 1;
                pagination.rows = 10;
                var pageList = ShopBLL.Instance.GetPageList(para, ref pagination).OrderBy(o => o.SortNum).ToList();
                if (pageList != null)
                {
                    pageList.ForEach((page) =>
                    {
                        if (page.ShopId != null)
                        {
                            page.ShopCarList = ShopCarBLL.Instance.GetList(new ShopCarEntity()
                            {
                                ShopId = page.ShopId, Status = (int)Model.Enums.UseStatus.启用
                            }).OrderBy(o => o.SortNum).ToList();
                            if (page.ShopCarList != null)
                            {
                                if (para.PriceRange != null)
                                {
                                    switch ((QX360.Model.Enums.CarPriceRange) int.Parse(para.PriceRange))
                                    {
                                    case Enums.CarPriceRange.十万以内:
                                        page.ShopCarList = page.ShopCarList.FindAll(o => o.MaxPrice <= 10).ToList();

                                        break;

                                    case Enums.CarPriceRange.十万到二十万:
                                        page.ShopCarList = page.ShopCarList.Where((o) => { return(o.LimitPrice >= 10 && o.MaxPrice <= 20); }).ToList();

                                        break;

                                    case Enums.CarPriceRange.二五到三十万:
                                        page.ShopCarList = page.ShopCarList.Where(o => o.LimitPrice >= 20 && o.MaxPrice <= 30).ToList();

                                        break;

                                    case Enums.CarPriceRange.十到五十:
                                        page.ShopCarList = page.ShopCarList.Where(o => o.LimitPrice >= 30 && o.MaxPrice <= 50).ToList();

                                        break;

                                    case Enums.CarPriceRange.五十万以上:
                                        page.ShopCarList = page.ShopCarList.Where(o => o.LimitPrice >= 50).ToList();

                                        break;
                                    }
                                }
                                if (para.BrandRange != null)
                                {
                                    page.ShopCarList = page.ShopCarList.Where(o => o.BrandId == para.BrandRange).ToList();
                                }
                                if (para.Name != null)
                                {
                                    page.ShopCarList = page.ShopCarList.Where((o) => { return(o.Name.IndexOf(para.Name) > -1); }).ToList();
                                }

                                page.ShopCarList.Foreach((o) =>
                                {
                                    if (o.FaceImage != null)
                                    {
                                        var imageHost = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"];
                                        o.FaceImage   = imageHost + o.FaceImage;
                                    }
                                });
                            }
                        }
                        if (page.Lat != null && page.Lng != null && para.Lat != null && para.Lng != null)
                        {
                            page.HowLong = HarvenSin.GetDistance(
                                new Point2D()
                            {
                                Lng = (double)para.Lng,
                                Lat = (double)para.Lat
                            },
                                new Point2D()
                            {
                                Lng = (double)page.Lng,
                                Lat = (double)page.Lat
                            }).ToString("f2");
                        }
                        else
                        {
                            page.HowLong = "未知";
                        }
                    });
                }
                result.IsSuccess = true;
                result.Message   = "加载列表成功!";
                result.ResultData["IsEndPage"] = (pagination.total == (pageIndex ?? 1));
                result.ResultData["List"]      = pageList;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ShopController>>List";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public JsonResult List(int?pageIndex, string queryJson)
        {
            var result = new ReturnMessage(false)
            {
                Message = "加载列表失败!"
            };

            try
            {
                SchoolEntity para = new SchoolEntity();
                if (!string.IsNullOrWhiteSpace(queryJson))
                {
                    var queryParam = queryJson.ToJObject();
                    if (!queryParam["keyword"].IsEmpty())
                    {
                        para.Name = queryParam["keyword"].ToString();
                    }
                    if (!queryParam["provinceid"].IsEmpty())
                    {
                        para.ProvinceId = queryParam["provinceid"].ToString();
                    }
                    if (!queryParam["cityid"].IsEmpty())
                    {
                        para.CityId = queryParam["cityid"].ToString();
                    }
                    if (!queryParam["countyid"].IsEmpty())
                    {
                        para.CountyId = queryParam["countyid"].ToString();
                    }
                    if (!queryParam["priceid"].IsEmpty())
                    {
                        para.TrainingPriceRange = (RCHL.Model.Enums.PriceRange) int.Parse(queryParam["priceid"].ToString());
                    }
                    if (!queryParam["distanceid"].IsEmpty())
                    {
                        para.DistanceRange = (RCHL.Model.Enums.DistanceRange) int.Parse(queryParam["distanceid"].ToString());
                    }
                    if (!queryParam["lat"].IsEmpty())
                    {
                        para.Lat = decimal.Parse(queryParam["lat"].ToString());
                    }
                    if (!queryParam["lng"].IsEmpty())
                    {
                        para.Lng = decimal.Parse(queryParam["lng"].ToString());
                    }
                    if (!queryParam["schoolid"].IsEmpty())
                    {
                        para.SchoolId = queryParam["schoolid"].ToString();
                    }
                    if (!queryParam["istraining"].IsEmpty())
                    {
                        para.IsTraining = int.Parse(queryParam["istraining"].ToString());
                    }
                }
                para.Status = (int)Model.Enums.UseStatus.启用;
                Pagination pagination = new Pagination();
                pagination.page = pageIndex ?? 1;
                pagination.rows = 10;
                pagination.sidx = "SortNum";
                pagination.sord = "asc";
                var pageList = SchoolBLL.Instance.GetPageList(para, ref pagination);
                if (pageList != null)
                {
                    pageList.ForEach((page) =>
                    {
                        if (page.FaceImage != null)
                        {
                            var imageHost  = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"];
                            page.FaceImage = imageHost + page.FaceImage;
                        }
                        if (page.SchoolId != null)
                        {
                            page.TagList = TagBLL.Instance.GetList(new TagEntity()
                            {
                                ObjectId = page.SchoolId
                            });
                            page.TeacherList = TeacherBLL.Instance.GetList(new TeacherEntity()
                            {
                                SchoolId = page.SchoolId, Status = (int)Model.Enums.UseStatus.启用
                            }).OrderBy(o => o.SortNum).ToList();
                            if (page.TeacherList != null)
                            {
                                page.TeacherList.Foreach((o) =>
                                {
                                    if (o.FaceImage != null)
                                    {
                                        var imageHost = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"];
                                        o.FaceImage   = imageHost + o.FaceImage;
                                    }
                                });
                            }
                        }
                        if (page.Lat != null && page.Lng != null && para.Lat != null && para.Lng != null)
                        {
                            page.HowLong = HarvenSin.GetDistance(
                                new Point2D()
                            {
                                Lng = (double)para.Lng,
                                Lat = (double)para.Lat
                            },
                                new Point2D()
                            {
                                Lng = (double)page.Lng,
                                Lat = (double)page.Lat
                            }).ToString("f2");
                        }
                        else
                        {
                            page.HowLong = "未知";
                        }
                    });
                }
                result.IsSuccess = true;
                result.Message   = "加载列表成功!";
                result.ResultData["IsEndPage"] = (pagination.total == (pageIndex ?? 1));
                result.ResultData["List"]      = pageList;
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ApplyController>>List";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }