示例#1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        public string GetListData()
        {
            var service = new TUnitSortBLL(new SessionManager().CurrentUserLoginInfo);
            IList <TUnitSortEntity> data = new List <TUnitSortEntity>();
            string content = string.Empty;

            data = service.GetAll().ToList();

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            content = jsonData.ToJSON();
            return(content);
        }
示例#2
0
        /// <summary>
        /// 获取某个客户的所有门店所在的城市列表,地级市
        /// </summary>
        public string GetCityList()
        {
            string content = string.Empty;

            var respData = new GetCityListRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <GetCityListReqData>();

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("GetCityList: {0}", reqContent)
                });

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                else
                {
                    respData.code        = "103";
                    respData.description = "customerId不能为空";
                    return(respData.ToJSON());
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                respData.content          = new GetCityListRespContentData();
                respData.content.cityList = new List <CityEntity>();

                DataSet ds = new TUnitSortBLL(loggingSessionInfo).GetCityListByCustomerId(customerId);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    respData.content.cityList = DataTableToObject.ConvertToList <CityEntity>(ds.Tables[0]);
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
示例#3
0
        public string GetStoreList()
        {
            string content  = string.Empty;
            var    respData = new getStoreListByItemRespData();

            try
            {
                string reqContent = Request["ReqContent"];

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("GetStoreList: {0}", reqContent)
                });

                #region 解析请求字符串
                var reqObj = reqContent.DeserializeJSONTo <getStoreListByItemReqData>();
                reqObj = reqObj == null ? new getStoreListByItemReqData() : reqObj;
                if (reqObj.special == null)
                {
                    reqObj.special          = new getStoreListByItemReqSpecialData();
                    reqObj.special.page     = 1;
                    reqObj.special.pageSize = 20;
                }

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                else
                {
                    respData.code        = "103";
                    respData.description = "customerId不能为空";
                    return(respData.ToJSON());
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");
                #endregion

                respData.content           = new getStoreListByItemRespContentData();
                respData.content.storeList = new List <getStoreListByItemRespContentItemTypeData>();
                #region
                string strError = string.Empty;

                TUnitSortBLL server    = new TUnitSortBLL(loggingSessionInfo);
                var          storeInfo = server.GetStoreListByItem(reqObj.special.cityName, reqObj.special.page, reqObj.special.pageSize, reqObj.special.longitude, reqObj.special.latitude, out strError);
                if (strError.Equals("ok"))
                {
                    IList <getStoreListByItemRespContentItemTypeData> list = new List <getStoreListByItemRespContentItemTypeData>();
                    foreach (var store in storeInfo.StoreBrandList)
                    {
                        getStoreListByItemRespContentItemTypeData info = new getStoreListByItemRespContentItemTypeData();
                        info.storeId      = ToStr(store.StoreId);
                        info.storeName    = ToStr(store.StoreName);
                        info.imageURL     = ToStr(store.ImageUrl);
                        info.address      = ToStr(store.Address);
                        info.tel          = ToStr(store.Tel);
                        info.displayIndex = ToStr(store.DisplayIndex);
                        info.lng          = ToStr(store.Longitude);
                        info.lat          = ToStr(store.Latitude);
                        if (store.Distance.ToString().Equals("0"))
                        {
                            info.distance = "";
                        }
                        else
                        {
                            info.distance = ToStr(store.Distance) + "km";
                        }
                        list.Add(info);
                    }
                    respData.content.storeList  = list;
                    respData.content.totalCount = ToInt(storeInfo.TotalCount);
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "数据库操作错误";
                    respData.exception   = strError;
                }
                #endregion
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }