Beispiel #1
0
        public void ProcessRequest(HttpContext context)
        {
            bool showallShop = false;

            if (context.Request.Params["showAllBrandInf"] != null && context.Request.Params["showAllBrandInf"].ToLower() == "true")
            {
                showallShop = true;
            }

            string dataString = string.Empty;

            List <RosShopInfo> shopDatas = new List <RosShopInfo>(HotSpotWebService.LoadShopData("M001001", "F1_0", showallShop));

            if (context.Request.Params["data"] != null && context.Request.Params["data"].ToLower() == "true")
            {
                List <ROSHotSpot> dataarrays = new List <ROSHotSpot>();
                foreach (RosShopInfo shopInfo in shopDatas)
                {
                    dataarrays.Add(shopInfo.HotSpotInfo);
                }
                dataString = JsonConvert.SerializeObject(dataarrays);
            }
            else
            {
                DataRecordArray <RosShopInfo> datas = new DataRecordArray <RosShopInfo>(shopDatas);
                dataString = JsonConvert.SerializeObject(datas);
            }


            context.Response.ContentType = "text/plain";
            context.Response.Write(dataString);
            context.Response.End();
        }
Beispiel #2
0
        public static List <BrandCompetitionScoreResult> GetBrandCompetitionScoreResult(string shopMallNo, string floorNo, string shopBrandInfoDatas)
        {
            List <RosShopInfo> shopDatas = HotSpotWebService.LoadShopData(shopMallNo, floorNo, true);

            List <ShopBrandInfo> oldshopBrandInfos = new List <ShopBrandInfo>();

            foreach (RosShopInfo shopInfo in shopDatas)
            {
                ShopBrandInfo shopBrandInfo = new ShopBrandInfo();
                shopBrandInfo.SeatNo    = shopInfo.SeatNO;
                shopBrandInfo.BrandName = shopInfo.ShopBrandInfo;
                oldshopBrandInfos.Add(shopBrandInfo);
            }

            List <BrandCompetitionScore> oldbrandCompetitionScores = CaculateBrandCompetitionScore(shopMallNo, floorNo, oldshopBrandInfos);

            List <ShopBrandInfo> newshopBrandInfos = null;

            List <BrandCompetitionScore> newbrandCompetitionScores = null;

            if (!string.IsNullOrEmpty(shopBrandInfoDatas))
            {
                newshopBrandInfos = JsonConvert.DeserializeObject <List <ShopBrandInfo> >(shopBrandInfoDatas);

                newbrandCompetitionScores = CaculateBrandCompetitionScore(shopMallNo, floorNo, newshopBrandInfos);
            }

            List <BrandCompetitionScoreResult> brandCompetitionScoreResults = new List <BrandCompetitionScoreResult>();

            foreach (BrandCompetitionScore brandCompetitionScoreResult in oldbrandCompetitionScores)
            {
                BrandCompetitionScoreResult brandCompetition = new BrandCompetitionScoreResult();

                brandCompetition.BrandName           = brandCompetitionScoreResult.BrandName;
                brandCompetition.OldCompetitionScore = brandCompetitionScoreResult.CompetitionScore;

                if (newbrandCompetitionScores != null)
                {
                    BrandCompetitionScore newBrandCompetitionScore =
                        newbrandCompetitionScores.Find(p => (p.BrandName == brandCompetition.BrandName));

                    brandCompetition.NewCompetitionScore = newBrandCompetitionScore.CompetitionScore;
                }
                else
                {
                    brandCompetition.NewCompetitionScore = brandCompetitionScoreResult.CompetitionScore;
                }

                brandCompetitionScoreResults.Add(brandCompetition);
            }

            return(brandCompetitionScoreResults);
        }
        public void ProcessRequest(HttpContext context)
        {
            List <BrandCompetitionScoreResult> brandCompetitionScoreResults = new List <BrandCompetitionScoreResult>(HotSpotWebService.GetBrandCompetitionScoreResult("M001001", "F1_0", context.Request.Params["shopbrandinfo"]));


            DataRecordArray <BrandCompetitionScoreResult> datas = new DataRecordArray <BrandCompetitionScoreResult>(brandCompetitionScoreResults);

            string dataString = JsonConvert.SerializeObject(datas);

            context.Response.ContentType = "text/plain";
            context.Response.Write(dataString);
            context.Response.End();
        }