public override void Restart() { this.Groups = new List <AutomationGroup>(); this.TransactionManager.Reset(); List <AutomationGroupEntry> automationGroupList = AutomationGroupEntry.LoadMany(this.MobilePaywallDatabase); List <AutomationEntry> automationList = AutomationEntry.Load(this.MobilePaywallDatabase, (from agl in automationGroupList where agl.IsActive select agl).ToList()); List <KiwiclicksOfferEntry> offers = KiwiclicksOfferEntry.LoadMany(this.KiwiclickDataabse, automationList); this.Messages.Add(new AutomatizationToSkypeMessage("*Automation Groups* Loaded")); foreach (AutomationGroupEntry entry in automationGroupList) { if (!entry.IsActive) { continue; } List <AutomationEntry> groupEntryAutomations = (from ae in automationList where ae.AutomationGroupID == entry.ID select ae).ToList(); List <KiwiclicksOfferEntry> groupOffers = (from gea in groupEntryAutomations from o in offers where gea.ExternalOfferName.Equals(o.Name) select o).ToList(); if (groupEntryAutomations == null || groupEntryAutomations.Count == 0) { continue; } this.Groups.Add(new AutomationGroup(this, entry, groupEntryAutomations, groupOffers)); } this.TransactionManager.Call(); }
public AutomationGroup(AutomatizationManagerBase parent, AutomationGroupEntry entry, List <AutomationEntry> automations, List <KiwiclicksOfferEntry> offers) { this._manager = parent; this._entry = entry; this._automations = new List <Automation>(); foreach (AutomationEntry ae in automations) { this._automations.Add(new Automation(this, ae)); if (ae.ID > this._maxID) { this._maxID = ae.ID; } } this.SetOffers(offers); }