public static PricingEveryday GetSamplePricingEveryday(int id) { var result = new PricingEveryday { Id = id + 1 }; result.Identity = GetPricingIdentity(_pricingEverydayNames[id], _ownerNames[id]); var filterGroups = MockFilterGenerator.GetFilterGroupsComplete(); result.FilterGroups = new ReactiveList <FilterGroup>(filterGroups); //Price lists result.PricingModes = GetPricingModes(); foreach (PricingMode mode in result.PricingModes) { result.PriceListGroups = GetEverydayPriceListGroups(mode); } result.KeyPriceListRule = new PricingKeyPriceListRule { DollarRangeLower = 10.25M, DollarRangeUpper = 115.00M, RoundingRules = GetRoundingRules() }; result.LinkedPriceListRules = GetLinkedPriceListRules(result); var drivers = GetEverydayValueDrivers(); result.ValueDrivers = new ReactiveList <PricingEverydayValueDriver>(drivers); //Value drivers PricingEverydayValueDriver keyDriver = result.ValueDrivers.FirstOrDefault(driver => driver.IsKey); if (keyDriver != null) { PricingEverydayKeyValueDriver key = GetEverydayKeyValueDriver(keyDriver); result.KeyValueDriver = key; } var selectedNonKey = result.ValueDrivers.Where(driver => !driver.IsKey && driver.IsSelected); var linkedDrivers = GetEverydayLinkedValueDrivers(selectedNonKey); result.LinkedValueDrivers = new ObservableCollection <PricingEverydayLinkedValueDriver>(linkedDrivers); //Results result.Results = GetEverydayResults(); //Select default item for display purposes. result.SelectedFilterGroup = result.FilterGroups.FirstOrDefault(); return(result); }
//TODO: finish public static PricingEveryday Copy(this PricingEveryday source) { PricingEveryday copy = new PricingEveryday(); copy.Id = 0; copy.SearchGroupKey = source.SearchGroupKey; copy.Identity.AnalyticsId = 0; DateTime createdDate = DateTime.Now; copy.Identity.Created = createdDate; copy.Identity.Edited = createdDate; copy.Identity.Refreshed = createdDate; string copySuffix = " (Copy)"; copy.Identity.Description = source.Identity.Description + copySuffix; copy.Identity.Editor = source.Identity.Editor; copy.Identity.Name = source.Identity.Name + copySuffix; copy.Identity.Notes = source.Identity.Notes + copySuffix; copy.Identity.Active = source.Identity.Active; copy.Identity.Author = source.Identity.Author; copy.Identity.Owner = source.Identity.Owner; copy.Identity.Shared = source.Identity.Shared; foreach (FilterGroup filterGroup in source.FilterGroups) { FilterGroup filterGroupCopy = filterGroup.Copy(); copy.FilterGroups.Add(filterGroupCopy); } foreach (PricingEverydayValueDriver driver in source.ValueDrivers) { PricingEverydayValueDriver driverCopy = driver.Copy(); copy.ValueDrivers.Add(driverCopy); } foreach (PricingEverydayPriceListGroup priceListGroup in source.PriceListGroups) { PricingEverydayPriceListGroup priceListGroupCopy = priceListGroup.Copy(); copy.PriceListGroups.Add(priceListGroupCopy); } copy.IsDirty = true; return(copy); }
private static PricingEverydayKeyValueDriver GetEverydayKeyValueDriver(PricingEverydayValueDriver sourceDriver) { var keyDriver = new PricingEverydayKeyValueDriver { ValueDriverId = sourceDriver.Id }; foreach (PricingValueDriverGroup group in sourceDriver.Groups) { var keyDriverGroup = new PricingEverydayKeyValueDriverGroup { ValueDriverGroupId = group.Id, ValueDriverGroupValue = group.Value }; keyDriverGroup.OptimizationRules = GetPriceOptimizationRules(); keyDriverGroup.MarkupRules = GetMarkupRules(); keyDriver.Groups.Add(keyDriverGroup); } return(keyDriver); }
/// <summary> /// Creates a copy of an <see cref="PricingEverydayValueDriver"/>. /// </summary> public static PricingEverydayValueDriver Copy(this PricingEverydayValueDriver source) { var copy = new PricingEverydayValueDriver(); copy.Id = source.Id; copy.Key = source.Key; copy.IsSelected = source.IsSelected; copy.Name = source.Name; copy.Sort = source.Sort; copy.Title = source.Title; foreach (PricingValueDriverGroup group in source.Groups) { PricingValueDriverGroup groupCopy = group.Copy(); copy.Groups.Add(groupCopy); } return(copy); }
private static List <PricingEverydayValueDriver> GetEverydayValueDrivers() { var drivers = new List <PricingEverydayValueDriver>(); var driver = new PricingEverydayValueDriver { Id = 16, Key = 34, Name = "Markup", IsSelected = true, IsKey = false, Sort = 2 }; driver.Groups.Add(new PricingValueDriverGroup { Id = 76, Value = 1, SkuCount = 20, SalesValue = "16,020.43", MinOutlier = 1600, MaxOutlier = 99999, Sort = 1 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 77, Value = 2, SkuCount = 18, SalesValue = "7,574.79", MinOutlier = 1200, MaxOutlier = 1599, Sort = 2 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 78, Value = 3, SkuCount = 27, SalesValue = "34,898.17", MinOutlier = 800, MaxOutlier = 1199, Sort = 3 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 79, Value = 4, SkuCount = 42, SalesValue = "67,442.4", MinOutlier = 300, MaxOutlier = 799, Sort = 4 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 80, Value = 5, SkuCount = 19, SalesValue = "16,182", MinOutlier = 0, MaxOutlier = 299, Sort = 5 }); drivers.Add(driver); driver = new PricingEverydayValueDriver { Id = 17, Key = 35, Name = "Movement", IsSelected = true, IsKey = true, Sort = 3 }; driver.Groups.Add(new PricingValueDriverGroup { Id = 81, Value = 1, SkuCount = 1, SalesValue = "6,848", MinOutlier = 100, MaxOutlier = 2999, Sort = 1 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 82, Value = 2, SkuCount = 1, SalesValue = "4,010", MinOutlier = 500, MaxOutlier = 999, Sort = 2 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 83, Value = 3, SkuCount = 3, SalesValue = "17,583", MinOutlier = 200, MaxOutlier = 499, Sort = 3 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 84, Value = 4, SkuCount = 12, SalesValue = "35,942", MinOutlier = 100, MaxOutlier = 199, Sort = 4 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 85, Value = 5, SkuCount = 109, SalesValue = "77,734.23", MinOutlier = 0, MaxOutlier = 99, Sort = 5 }); drivers.Add(driver); driver = new PricingEverydayValueDriver { Id = 18, Key = 36, Name = "Days On Hand", IsSelected = true, IsKey = false, Sort = 4 }; driver.Groups.Add(new PricingValueDriverGroup { Id = 86, Value = 1, SkuCount = 58, SalesValue = "74,986", MinOutlier = 300, MaxOutlier = 365, Sort = 1 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 87, Value = 2, SkuCount = 0, SalesValue = "0", MinOutlier = 235, MaxOutlier = 299, Sort = 2 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 88, Value = 3, SkuCount = 0, SalesValue = "0", MinOutlier = 200, MaxOutlier = 234, Sort = 3 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 89, Value = 4, SkuCount = 1, SalesValue = "1,143", MinOutlier = 165, MaxOutlier = 199, Sort = 4 }); driver.Groups.Add(new PricingValueDriverGroup { Id = 90, Value = 5, SkuCount = 67, SalesValue = "65,989", MinOutlier = 0, MaxOutlier = 164, Sort = 5 }); drivers.Add(driver); return(drivers); }