示例#1
0
        public static IList <StoreLocationInfo> GetAllStoreLocationInfo()
        {
            IList <StoreLocationInfo> list = (IList <StoreLocationInfo>)HiCache.Get("DataCache-StoreInfoDataKey");

            if (list == null)
            {
                list = new StoresDao().GetAllStoreLocationInfo();
            }
            return(list);
        }
示例#2
0
        private static bool ProcessStoreType4PromotionInfo(PromotionInfo countDownInfo)
        {
            bool result = false;

            if (!string.IsNullOrEmpty(countDownInfo.StoreIds))
            {
                StoresDao storesDao   = new StoresDao();
                int       storeLength = storesDao.GetStoreLength();
                if (storeLength == countDownInfo.StoreIds.Split(',').Length)
                {
                    countDownInfo.StoreType = 1;
                }
                else if (countDownInfo.StoreIds == "0")
                {
                    countDownInfo.StoreType = 0;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
示例#3
0
        public static StoresInfo GetNearDeliveStores(string latLng, bool isApp = false)
        {
            StoresInfo storesInfo = new StoresInfo();
            string     text       = "";
            string     province   = "";
            string     text2      = "";
            string     country    = "";
            string     text3      = "";

            DepotHelper.GetAddressByLatLng(latLng, ref text, ref province, ref text2, ref country, ref text3);
            int regionIdByRegionName = RegionHelper.GetRegionIdByRegionName(text2, 2);
            int regionId             = RegionHelper.GetRegionId(text3, country, text2, province);

            if (regionId == 0)
            {
                IList <RegionInfo> regionChildList = RegionHelper.GetRegionChildList(regionIdByRegionName, false);
                if (regionChildList != null && regionChildList.Count > 0)
                {
                    regionId = regionChildList[0].RegionId;
                }
            }
            string             fullPath         = RegionHelper.GetFullPath(regionId, true);
            string             fullPath2        = RegionHelper.GetFullPath(regionId, true);
            IList <StoresInfo> nearDeliveStores = new StoresDao().GetNearDeliveStores(regionIdByRegionName, fullPath);

            storesInfo = DepotHelper.GetBestNearStoreInfo(latLng, nearDeliveStores);
            if (storesInfo == null || storesInfo.StoreId <= 0)
            {
                nearDeliveStores = new StoresDao().GetNearOtherStores(regionIdByRegionName);
                storesInfo       = DepotHelper.GetBestNearStoreInfo(latLng, nearDeliveStores);
            }
            if (!isApp)
            {
                string   userCoordinateTimeCookieName = DepotHelper.UserCoordinateTimeCookieName;
                DateTime now   = DateTime.Now;
                string   value = now.ToString();
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateTimeCookieName, value, now.AddMinutes(1.0), null, true);
                string userCoordinateCookieName = DepotHelper.UserCoordinateCookieName;
                string value2 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text) ? text3 : text);
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName, "Address", value2, now.AddMinutes(10.0));
                string userCoordinateCookieName2 = DepotHelper.UserCoordinateCookieName;
                string value3 = HttpUtility.UrlEncode(text2);
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName2, "CityName", value3, now.AddMinutes(10.0));
                string userCoordinateCookieName3 = DepotHelper.UserCoordinateCookieName;
                string value4 = regionIdByRegionName.ToString();
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName3, "CityRegionId", value4, now.AddMinutes(10.0));
                string userCoordinateCookieName4 = DepotHelper.UserCoordinateCookieName;
                string value5 = regionId.ToString();
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName4, "RegionId", value5, now.AddMinutes(10.0));
                string userCoordinateCookieName5 = DepotHelper.UserCoordinateCookieName;
                string value6 = storesInfo.StoreId.ToString();
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName5, "StoreId", value6, now.AddMinutes(10.0));
                string userCoordinateCookieName6 = DepotHelper.UserCoordinateCookieName;
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName6, "Coordinate", latLng, now.AddMinutes(10.0));
                string userCoordinateCookieName7 = DepotHelper.UserCoordinateCookieName;
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName7, "NewCoordinate", latLng, now.AddMinutes(10.0));
                string userCoordinateCookieName8 = DepotHelper.UserCoordinateCookieName;
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName8, "StoreType", "1", now.AddMinutes(10.0));
                string userCoordinateCookieName9 = DepotHelper.UserCoordinateCookieName;
                string value7 = fullPath2;
                now = DateTime.Now;
                WebHelper.SetCookie(userCoordinateCookieName9, "FullRegionPath", value7, now.AddMinutes(10.0));
            }
            return(storesInfo);
        }