public void SetParent(Cobrand parent) { if (parent == null) { throw new NullReferenceException("@parent is null. Use clear parent method instead!"); } if (parent == this || parent.AllParents.Any(p => p == this)) { throw new Exception("Cannot set self as a parent or passed cobrand has this object as a parent"); } else if (parent.SelfAndChildren.Any(c => c == this)) { throw new Exception("@parent is already among children of this cobrand!"); } Parent = parent; }
public static string GetCommsGeneratedCode(Cobrand cobrand, Account account) { if (cobrand == null || !cobrand.CobrandComms.AnyAndNotNull()) { return(string.Empty); } var cobrandCommsIds = cobrand.CobrandComms.Where(x => x.Enabled).Select(y => y.CommsController.ID).ToList(); if (!cobrandCommsIds.AnyAndNotNull()) { return(string.Empty); } var accCommsCode = account.AccountComms.Where(x => x.Enabled && cobrandCommsIds.Contains(x.CommsController.ID)).Select(y => y.ReportCode).ToList(); return(!accCommsCode.AnyAndNotNull() ? string.Empty : string.Join("", accCommsCode)); }
//to sync freshly loaded cobrand with updated model. public static Cobrand SyncCobrand(Cobrand original, Cobrand updated) { original.BackgroundImgRegPath = updated.BackgroundImgRegPath; original.BookMarkIconImagePath = updated.BookMarkIconImagePath; original.CobrandType = updated.CobrandType; original.CobrandTypeInternal = updated.CobrandTypeInternal; original.CompanyName = updated.CompanyName; original.DisplayName = updated.DisplayName; original.DomainName = updated.DomainName; original.EmailSignature = updated.EmailSignature; original.EmphasiseProperty = updated.EmphasiseProperty; original.FromEmailAddress = updated.FromEmailAddress; original.FromName = updated.FromName; original.HeaderImagePath = updated.HeaderImagePath; original.HideFeaturesReg = updated.HideFeaturesReg; original.HidePricingReg = updated.HidePricingReg; original.HideRegistration = updated.HideRegistration; original.HighlightImgRegPath = updated.HighlightImgRegPath; original.HomeUrl = updated.HomeUrl; original.IconImagePath = updated.IconImagePath; original.ManageUpgrade = updated.ManageUpgrade; original.AutoUpgrade = updated.AutoUpgrade; original.SkipPlanPage = updated.SkipPlanPage; original.FormFillEnabled = updated.FormFillEnabled; original.UseSecureRedirect = updated.UseSecureRedirect; original.RequirePhoneToRegister = updated.RequirePhoneToRegister; original.ShowRetirementGapCalc = updated.ShowRetirementGapCalc; original.SubTitleReg = updated.SubTitleReg; original.SupportEmailAddress = updated.SupportEmailAddress; original.Token = updated.Token; original.WhiteHeader = updated.WhiteHeader; original.CobrandAdsEnabled = updated.CobrandAdsEnabled; original.IsActive = updated.IsActive; original.KeepAddressPrivate = updated.KeepAddressPrivate; original.UserPreferencePromptFrequencyInternal = updated.UserPreferencePromptFrequencyInternal; original.PaymentRedirectUrl = updated.PaymentRedirectUrl; original.CobrandStatus = updated.CobrandStatus; original.CobrandStatusInternal = updated.CobrandStatusInternal; original.MagicTags = updated.MagicTags.IsNullOrEmpty() ? null : updated.MagicTags; original.CobrandSettings.DataFeeds.MyobDataFeedEnabled = updated.CobrandSettings.DataFeeds.MyobDataFeedEnabled; original.CobrandSettings.DataFeeds.XeroDataFeedEnabled = updated.CobrandSettings.DataFeeds.XeroDataFeedEnabled; original.CobrandSettings.DataFeeds.ClassDataFeedEnabled = updated.CobrandSettings.DataFeeds.ClassDataFeedEnabled; original.CobrandSettings.DataFeeds.BglDataFeedEnabled = updated.CobrandSettings.DataFeeds.BglDataFeedEnabled; original.CobrandSettings.DataFeeds.ImplementedPortfoliosDataFeedEnabled = updated.CobrandSettings.DataFeeds.ImplementedPortfoliosDataFeedEnabled; original.CobrandSettings.DataFeeds.Hub24DataFeedEnabled = updated.CobrandSettings.DataFeeds.Hub24DataFeedEnabled; original.CobrandSettings.DataFeeds.ManagedAccountsFeedEnabled = updated.CobrandSettings.DataFeeds.ManagedAccountsFeedEnabled; original.CobrandSettings.DataFeeds.NetWealthFeedEnabled = updated.CobrandSettings.DataFeeds.NetWealthFeedEnabled; original.CobrandSettings.DataFeeds.MasonStevensFeedEnabled = updated.CobrandSettings.DataFeeds.MasonStevensFeedEnabled; original.CobrandSettings.DataFeeds.MacquarieWrapFeedEnabled = updated.CobrandSettings.DataFeeds.MacquarieWrapFeedEnabled; original.CobrandSettings.DataFeeds.MacquarieCashFeedEnabled = updated.CobrandSettings.DataFeeds.MacquarieCashFeedEnabled; original.CobrandSettings.DataFeeds.PraemiumFeedEnabled = updated.CobrandSettings.DataFeeds.PraemiumFeedEnabled; original.CobrandSettings.DataFeeds.XPlanFeedEnabled = updated.CobrandSettings.DataFeeds.XPlanFeedEnabled; original.CobrandSettings.DataFeeds.IoofLtsFeedEnabled = updated.CobrandSettings.DataFeeds.IoofLtsFeedEnabled; original.CobrandSettings.DataFeeds.IoofMaxFeedEnabled = updated.CobrandSettings.DataFeeds.IoofMaxFeedEnabled; original.CobrandSettings.DataFeeds.IoofTasFeedEnabled = updated.CobrandSettings.DataFeeds.IoofTasFeedEnabled; original.CobrandSettings.DataFeeds.MasonStevensRetailFeedEnabled = updated.CobrandSettings.DataFeeds.MasonStevensRetailFeedEnabled; original.CobrandSettings.DataFeeds.SharesightFeedEnabled = updated.CobrandSettings.DataFeeds.SharesightFeedEnabled; original.CobrandSettings.DataFeeds.WealthO2FeedEnabled = updated.CobrandSettings.DataFeeds.WealthO2FeedEnabled; original.CobrandSettings.IsCertifiedBookkeeper = updated.CobrandSettings.IsCertifiedBookkeeper; original.CobrandSettings.CobrandAuthKey = updated.CobrandSettings.CobrandAuthKey; //original.Plan = updated.Plan; if (original.Subscription == null) { original.Subscription = updated.Subscription; } else { original.Subscription.Plan = updated.Subscription.Plan; original.Subscription.PlanStartDate = updated.Subscription.PlanStartDate; } original.CobrandSettings.MobileApps = updated.CobrandSettings.MobileApps; original.CobrandSettings.IsEnterprise = updated.CobrandSettings.IsEnterprise; original.CobrandSettings.IsKidsAppEnabled = updated.CobrandSettings.IsKidsAppEnabled; original.CobrandSettings.WillSettings.IsWillGenerationAllowed = updated.CobrandSettings.WillSettings.IsWillGenerationAllowed; original.CobrandSettings.GobbillSetting.IsGobbillEnabled = updated.CobrandSettings.GobbillSetting.IsGobbillEnabled; //original.DesktopSiteUrl = updated.DesktopSiteUrl; //original.MobileSiteUrl = updated.MobileSiteUrl; //original.NotificationBaseUrl = updated.NotificationBaseUrl; //original.AdviserBilling = null; //original.Accounts = updated.Accounts; //original.AdviserBilling = updated.AdviserBilling; //original.AllParents = updated.AllParents; //original.Children = updated.Children; //original.CobrandBranches = updated.CobrandBranches; //original.FeatureTypes = updated.FeatureTypes; //original.Features = updated.Features; //original.Parent = updated.Parent; //original.SelfAndChildren = updated.SelfAndChildren; return(original); }