Example #1
0
        List <StoreProductSale> CreateStoreItems(CustomerViewModel customerVM)
        {
            var cities = new HashSet <string>();
            var result = new List <StoreProductSale>();

            if (customerVM.Entity.CustomerStores == null)
            {
                return(result);
            }
            foreach (CustomerStore s in customerVM.Entity.CustomerStores)
            {
                var city = s.Address.City;
                if (!cities.Contains(city))
                {
                    cities.Add(city);
                    decimal totalSales = customerVM.GetOrdersTotal(s, customerVM.Minimum, customerVM.Maximum);
                    if (totalSales != 0M)
                    {
                        var     item          = new StoreProductSale(s);
                        decimal opportunities = customerVM.GetQuotesTotal(s, customerVM.Minimum, customerVM.Maximum);
                        item.Total   = totalSales;
                        item.MapItem = CreateHomeOfficeItem(string.Format("TOTAL SALES{3}<color=47,81,165><b><size=+4>{0:c}</color></size></b>{3}TOTAL OPPORTUNITIES{3}<color=206,113,0><b><size=+4>{1:c}</color></size></b>{3}{2}", totalSales, opportunities, s.City, "<br>"), new GeoPoint(s.Address.Latitude, s.Address.Longitude));
                        result.Add(item);
                    }
                }
            }
            return(result);
        }
Example #2
0
        private List <StoreProductSale> CreateStoreItems(List <StoreQuoteInfo> quote)
        {
            var cities = new HashSet <string>();
            var result = new List <StoreProductSale>();

            foreach (StoreQuoteInfo s in quote)
            {
                var city = s.Store.City;
                if (!cities.Contains(city))
                {
                    if (s.Opportunities != 0M)
                    {
                        cities.Add(city);
                        var item = new StoreProductSale(s.Store);
                        item.Total   = s.Opportunities;
                        item.MapItem = CreateHomeOfficeItem(string.Format("TOTAL OPPORTUNITIES{2}<color=206,113,0><b><size=+4>{0:c}</color></size></b>{2}{1}", s.Opportunities, s.Store.City, "<br>"), new GeoPoint(s.Store.Address.Latitude, s.Store.Address.Longitude));
                        result.Add(item);
                    }
                }
            }
            return(result);
        }