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 void SetOffer(List <KiwiclicksOfferEntry> offers) { KiwiclicksOfferEntry offer = (from o in offers where o.Name.Equals(this._entry.ExternalOfferName) select o).FirstOrDefault(); if (offer == null) { this._message = "No offer"; return; } this._offer = offer; this._isActive = false; this._offer.ConstructUrl(this.Data); this._offer.Update(this._group.Manager.KiwiclickDataabse, false); this._lastTransaction = DateTime.Now; TransactionEntry intialTransaction = this._group.Manager.TransactionManager.Get(this); if (intialTransaction != null) { this._transaction = intialTransaction; } }