示例#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);
        }