Exemple #1
0
        public static List <BrandCompetitionScore> CaculateBrandCompetitionScore(string shopMallNo, string floorNo, List <ShopBrandInfo> shopBrandInfos)
        {
            string sql = "select a.*,b.ShopMallAreaID,b.ShopMallAreaName,b.ShopMallBigAreaID,b.ShopMallBigAreaName,b.ShopMallCityCode,b.ShopMallCityName,b.ShopMallProvinceCode,b.ShopMallProvinceName,b.ShopMallTownCode,b.ShopMallTownName from ITMall a left join A_ShopMall b on a.ShopMallNo = b.ShopMallNo";

            sql += string.Format(" where a.ShopMallNo = '{0}' and FloorName = '{1}' order by a.SeatNo ", shopMallNo, floorNo.Substring(0, 2));

            DataSet ds = SqlHelper.ExecuteDataset(cnnstring, CommandType.Text, sql);

            List <BrandData> allBrandData = BrandData.GetAllBrandInfos();

            List <BrandCompetitionScore> brandCompetitions = new List <BrandCompetitionScore>();

            double allCount = shopBrandInfos.Count;

            foreach (BrandData brandData in allBrandData)
            {
                double brandCount = shopBrandInfos.Count(p => (p.BrandName.ToLower() == brandData.Name.ToLower()));

                brandCompetitions.Add(new BrandCompetitionScore()
                {
                    BrandName = brandData.Name, CompetitionScore = brandCount * 100d / allCount
                });
            }

            return(brandCompetitions);
        }
Exemple #2
0
        public ShopMallFloorHotspotData LoadShopMallLayoutData(string shopMallNo, string floorNo)
        {
            ShopMallFloorHotspotData shopMallFloorHotspotData = new ShopMallFloorHotspotData();

            shopMallFloorHotspotData.ShopMallNo      = shopMallNo;
            shopMallFloorHotspotData.ShopMallFloorNo = floorNo;



            shopMallFloorHotspotData.ImageUrl = GetRootUrl() + "DownloadHandler.ashx?url=" + HttpContext.Current.Server.UrlEncode(GetRootUrl() + "Images/" + string.Format("{0}_{1}-3.png", shopMallNo, floorNo));

            shopMallFloorHotspotData.Brands = BrandData.GetAllBrandInfos();

            shopMallFloorHotspotData.ShopInfos = new List <RosShopInfo>();

            string sql = "select a.*,b.ShopMallAreaID,b.ShopMallAreaName,b.ShopMallBigAreaID,b.ShopMallBigAreaName,b.ShopMallCityCode,b.ShopMallCityName,b.ShopMallProvinceCode,b.ShopMallProvinceName,b.ShopMallTownCode,b.ShopMallTownName from ITMall a left join A_ShopMall b on a.ShopMallNo = b.ShopMallNo";

            sql += string.Format(" where a.ShopMallNo = '{0}' and FloorName = '{1}' order by a.SeatNo ", shopMallNo, floorNo.Substring(0, 2));

            DataSet ds = SqlHelper.ExecuteDataset(cnnstring, CommandType.Text, sql);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string brand = ds.Tables[0].Rows[i]["Brand"].ToString();

                string shopType = ds.Tables[0].Rows[i]["ShopType"].ToString();

                string seatNO = ds.Tables[0].Rows[i]["SeatNO"].ToString();

                if (!shopMallFloorHotspotData.ShopInfos.Exists(p => (p.SeatNO.ToLower() == seatNO.ToLower())))
                {
                    RosShopInfo rosShopInfo = new RosShopInfo(ds.Tables[0].Rows[i], shopType);
                    ;
                    shopMallFloorHotspotData.ShopInfos.Add(rosShopInfo);
                }
            }

            return(shopMallFloorHotspotData);
        }