private static List <PricingEverydayPriceListGroup> GetEverydayPriceListGroups(PricingMode mode) { var result = new List <PricingEverydayPriceListGroup>(); for (int groupIndex = 1; groupIndex <= 2; groupIndex++) { PricingEverydayPriceListGroup group = null; bool isLinkedGroup = (groupIndex > 1); int key = mode.KeyPriceListGroupKey; int linkedKey = mode.LinkedPriceListGroupKey; if (isLinkedGroup) { group = new PricingEverydayPriceListGroup { Name = "Price List Group " + groupIndex, Sort = (short)groupIndex, Key = key }; var priceLists = GetEverydayPriceLists(isLinkedGroup); group.PriceLists = new ReactiveList <PricingEverydayPriceList>(priceLists); result.Add(group); } else if (linkedKey > 0 && linkedKey != key) { group = new PricingEverydayPriceListGroup { Name = "Price List Group " + groupIndex, Sort = (short)groupIndex, Key = linkedKey }; var priceLists = GetEverydayPriceLists(isLinkedGroup); group.PriceLists = new ReactiveList <PricingEverydayPriceList>(priceLists); result.Add(group); } } 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); }
public static PricingEverydayPriceListGroup Copy(this PricingEverydayPriceListGroup source) { var copy = new PricingEverydayPriceListGroup(); copy.Key = source.Key; copy.Name = source.Name; copy.Title = source.Title; copy.Sort = source.Sort; foreach (PricingEverydayPriceList priceList in source.PriceLists) { PricingEverydayPriceList listCopy = priceList.Copy(); copy.PriceLists.Add(listCopy); } return(copy); }
private bool SelectAllPriceListsCanExecute(PricingEverydayPriceListGroup priceListGroup) { bool result = (priceListGroup != null); return(result); }