Esempio n. 1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回列表</returns>
        public IEnumerable <Ku_LocationEntity> GetList(string queryJson)
        {
            var queryParam = queryJson.ToJObject();
            //限坐标表
            string strOrder = "";
            string strSql   = "";
            string des      = OperatorProvider.Provider.Current().Description;
            //string des = "兰山区";
            string locationSql = LocationHelper.GetLocationSql(des);

            //假如有微信坐标的话
            if (!queryParam["wxLon"].IsEmpty() && !queryParam["wxLat"].IsEmpty())
            {
                string wxLon = queryParam["wxLon"].ToString();
                string wxLat = queryParam["wxLat"].ToString();
                strSql   = "select top 100 id,wxlon,wxlat,regeoname,address,count,dbo.f_GetDistance(" + wxLon + "," + wxLat + ",wxlon,wxlat) as description,picture FROM " + locationSql + " t where 1=1";
                strOrder = " order by dbo.f_GetDistance(" + wxLon + "," + wxLat + ",wxlon,wxlat) asc";
            }
            else
            {
                strSql   = "select top 100 id,wxlon,wxlat,regeoname,address,count from " + locationSql + " where 1 = 1 ";
                strOrder = " ORDER BY CreateDate desc";
            }
            //店铺名
            if (!queryParam["SearchName"].IsEmpty())
            {
                string OfficeName = queryParam["SearchName"].ToString();
                strSql += " and regeoname = '" + OfficeName + "'";
            }
            strSql += strOrder;

            return(this.BaseRepository().FindList(strSql.ToString()));
        }
Esempio n. 2
0
        /// <summary>
        /// 获取列表自动补全公司名称
        /// </summary>
        /// <param name="CompanyName">查询参数</param>
        /// <returns>返回列表</returns>
        public IEnumerable <Ku_CompanyEntity> GetListByName(string CompanyName)
        {
            string des         = OperatorProvider.Provider.Current().Description;
            string locationSql = LocationHelper.GetLocationSql(des);
            string strSql      = $"select top 5 c.Id,c.CompanyName from Ku_Company c LEFT JOIN {locationSql} l ON l.Id=c.LocationId where ManageState=1 AND LocationId>0 AND c.District!='' ";

            //公司名
            if (!CompanyName.IsEmpty())
            {
                strSql += " and c.CompanyName like '%" + CompanyName + "%'";
            }

            return(this.BaseRepository().FindList(strSql.ToString()));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取列表自动补全公司名称(私池)
        /// </summary>
        /// <param name="CompanyName">查询参数</param>
        /// <returns>返回列表</returns>
        public IEnumerable <Ku_CompanyEntity> GetListByNameSi(string CompanyName)
        {
            string des         = OperatorProvider.Provider.Current().Description;
            string locationSql = LocationHelper.GetLocationSql(des);
            string strSql      = $"select top 5 c.CompanyName from Ku_Company c LEFT JOIN {locationSql} l ON l.Id=c.LocationId where ObtainState=1 and ManageState=1 AND LocationId>0 AND c.District!='' ";

            //公司名
            if (!CompanyName.IsEmpty())
            {
                strSql += " and c.CompanyName like '%" + CompanyName + "%'";
            }
            if (!OperatorProvider.Provider.Current().IsSystem)
            {
                string dataAutor = string.Format(OperatorProvider.Provider.Current().DataAuthorize.ReadAutorize, OperatorProvider.Provider.Current().UserId);
                strSql += " and (c.ObtainUserId in (" + dataAutor + "))";
            }
            return(this.BaseRepository().FindList(strSql.ToString()));
        }
Esempio n. 4
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="pagination">分页</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表</returns>
        public IEnumerable <Ku_CompanyEntity> GetPageList(Pagination pagination, string queryJson)
        {
            var    expression  = LinqExtensions.True <Ku_CompanyEntity>();
            var    queryParam  = queryJson.ToJObject();
            string des         = OperatorProvider.Provider.Current().Description;
            string locationSql = LocationHelper.GetLocationSql(des);
            string strSql      = $"select c.* from Ku_Company c LEFT JOIN {locationSql} l ON l.Id=c.LocationId where ManageState=1 AND LocationId>0 AND c.District!='' ";//在营公海显示被获取公司 ObtainState=0

            //坐标位置商圈ID存在的话,不以输入的商圈文字搜索
            if (!queryParam["LocationId"].IsEmpty())
            {
                string LocationId = queryParam["LocationId"].ToString();
                strSql += " and LocationId = " + LocationId;
            }
            else if (!queryParam["RegeoName"].IsEmpty())
            {
                string RegeoName = queryParam["RegeoName"].ToString();
                strSql += " and c.RegeoName  like '%" + RegeoName + "%' ";
            }
            //位置ID
            if (!queryParam["LocationIds"].IsEmpty())
            {
                string LocationIds = queryParam["LocationIds"].ToString();
                strSql += " and LocationId in (" + LocationIds + ")";
            }
            //单据日期
            if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
            {
                DateTime startTime = queryParam["StartTime"].ToDate();
                DateTime endTime   = queryParam["EndTime"].ToDate().AddDays(1);
                strSql += " and BuildTime >= '" + startTime + "' and BuildTime < '" + endTime + "'";
            }
            //公司名
            if (!queryParam["CompanyName"].IsEmpty())
            {
                string CompanyName = queryParam["CompanyName"].ToString();
                strSql += " and c.CompanyName  like '%" + CompanyName + "%' ";
            }
            //经营范围
            if (!queryParam["Scope"].IsEmpty())
            {
                string Scope = queryParam["Scope"].ToString();
                strSql += " and c.Scope  like '%" + Scope + "%' ";
            }
            //行业
            if (!queryParam["Sector"].IsEmpty())
            {
                string Sector = queryParam["Sector"].ToString();
                Sector  = Sector.Replace("[", "").Replace("]", "").Replace("\"", "'");
                strSql += " and c.Sector  in(" + Sector + ")";
            }
            //区域
            if (!queryParam["District"].IsEmpty())
            {
                string District = queryParam["District"].ToString();
                District = District.Replace("[", "").Replace("]", "").Replace("\"", "'");
                strSql  += " and c.District in(" + District + ")";
            }
            //POI分布
            if (!queryParam["TypeName"].IsEmpty())
            {
                string TypeName = queryParam["TypeName"].ToString();
                TypeName = TypeName.Replace("[", "").Replace("]", "").Replace("\"", "'");
                strSql  += " and l.TypeName in(" + TypeName + ")";
            }
            //销售人
            if (!queryParam["ObtainUserId"].IsEmpty())
            {
                string ObtainUserId = queryParam["ObtainUserId"].ToString();
                strSql += " and c.ObtainUserId = '" + ObtainUserId + "'";
            }
            //状态
            if (!queryParam["FollowState"].IsEmpty())
            {
                string FollowState = queryParam["FollowState"].ToString();
                strSql += " and c.FollowState = '" + FollowState + "'";
            }
            //排序楼层,房间
            if (pagination.sidx == "Floor")
            {
                pagination.sidx = "Floor " + pagination.sord + ",Room " + pagination.sord;
            }
            return(this.BaseRepository().FindList(strSql.ToString(), pagination));
        }