Exemple #1
0
        public AutomatizationManagerBase()
        {
            this._message = new List <AutomatizationToSkypeMessage>();
            this._mobilePaywallDatabase = new MobilePaywallDatabase();
            this._kiwiclicksDatabase    = new KiwiclicksDatabase();
            this._transactionManager    = new TransactionManager(this);

            this._running = true;
            this.Restart();
        }
Exemple #2
0
        public void Update(KiwiclicksDatabase database, bool isActive)
        {
            this._isActive = isActive;

            string inactive = !this._isActive ? "0" : "1";
            string command  = KiwiclicksOfferEntry.SqlCommandUpdate.
                              Replace(KiwiclicksOfferEntry.SqlIDWildcard, this._id.ToString()).
                              Replace(KiwiclicksOfferEntry.SqlInactiveWildcard, inactive).
                              Replace(KiwiclicksOfferEntry.SqlUrlWildcard, this._url);

            database.Execute(command);
        }
Exemple #3
0
        // SUMMARY: Load all
        public static List <KiwiclicksOfferEntry> LoadMany(KiwiclicksDatabase database, List <AutomationEntry> automations)
        {
            List <KiwiclicksOfferEntry> result = new List <KiwiclicksOfferEntry>();

            if (automations == null || automations.Count == 0)
            {
                return(result);
            }

            string names = "";

            foreach (AutomationEntry ae in automations)
            {
                if (ae.IsActive && !string.IsNullOrEmpty(ae.ExternalOfferName))
                {
                    if (names != "")
                    {
                        names += ",";
                    }
                    names += string.Format("'{0}'", ae.ExternalOfferName);
                }
            }

            string    command = KiwiclicksOfferEntry.SqlCommandMany.Replace(KiwiclicksOfferEntry.SqlNameWildcard, names);
            DataTable table   = database.Load(command);

            if (table == null)
            {
                return(result);
            }

            foreach (DataRow row in table.Rows)
            {
                KiwiclicksOfferEntry entry = new KiwiclicksOfferEntry();
                entry.ID       = Int32.Parse(row[(int)KiwiclicksOfferEntry.Columns.ID].ToString());
                entry.Name     = row[(int)KiwiclicksOfferEntry.Columns.Name].ToString();
                entry.Url      = row[(int)KiwiclicksOfferEntry.Columns.OfferUrl].ToString();
                entry.IsActive = row[(int)KiwiclicksOfferEntry.Columns.OfferInactive].ToString().Equals("0");
                result.Add(entry);
            }

            return(result);
        }