Esempio n. 1
0
        public static async void Test()
        {
            CCSubmitDirect db   = CCSubmitDirect.Instance;
            var            lead = await LeadDM.LoadByMsisdnOrEmailAsync(db, "61405016390", "*****@*****.**");

            int a = 0;
        }
Esempio n. 2
0
        public async Task <LeadDM> TryToIdentifyLead(string msisdn, string email)
        {
            this._lead = await LeadDM.LoadByMsisdnOrEmailAsync(this.Database, msisdn, email);

            if (this._lead == null)
            {
                this._lead = await new LeadDM(this.Database)
                {
                    countryid = this.CountryID,
                    msisdn    = msisdn,
                    email     = email
                }
            }
        // Landing pages are on CCCash side
        private async Task <ActionDM> ConstructAction(CloverdaleModel model)
        {
            var countryid = await CountryCache.Instance.Get(this.Database, model.country);

            var lead = await LeadDM.LoadByMsisdnOrEmailAsync(this.Database, model.msisdn, model.email);

            if (lead == null)
            {
                lead = await new LeadDM(this.Database)
                {
                    email         = model.email,
                    first_name    = model.firstname,
                    last_name     = model.lastname,
                    msisdn        = model.msisdn,
                    address       = model.address,
                    zip           = model.zip,
                    city          = model.city,
                    countryid     = countryid,
                    actions_count = 1
                }
            }
Esempio n. 4
0
        public async void Run(ClientDM client)
        {
            string email = client.email.ToLower().Replace("à", "a");

            if (string.IsNullOrEmpty(email))
            {
                return;
            }

            if (!client.GetCountry().HasValue)
            {
                return;
            }

            LanderDM lander = null;

            if (!string.IsNullOrEmpty(client.referrer))
            {
                string[] refSplit = client.referrer.Split('/');
                if (refSplit.Length >= 3)
                {
                    string landingName = refSplit[3];
                    if (Program.Landers.ContainsKey(landingName))
                    {
                        lander = Program.Landers[landingName];
                    }
                }
            }

            int leadID = CurrentIndex;

            if (!EmailCache.ContainsKey(email) && !MsisdnCache.ContainsKey(client.msisdn))
            {
                var leadDM = new LeadDM(Program.Database)
                {
                    email         = email,
                    msisdn        = client.msisdn,
                    first_name    = client.firstname,
                    last_name     = client.lastname,
                    countryid     = client.GetCountry(),
                    address       = client.address,
                    actions_count = 1,
                    updated       = client.created,
                    created       = client.created
                };
                leadDM.ID = CurrentIndex;
                Program.Bulker.Add(new BulkModel(leadDM, 1));

                var userDM = new UserDM(Program.Database)
                {
                    leadid    = CurrentIndex,
                    countryid = client.GetCountry(),
                    created   = client.created
                };
                userDM.ID = CurrentIndex;
                Program.Bulker.Add(new BulkModel(userDM, 2));

                EmailCache.Add(email, new LeadUser()
                {
                    ID = CurrentIndex
                });
                if (!string.IsNullOrEmpty(client.msisdn))
                {
                    MsisdnCache.Add(client.msisdn, new LeadUser()
                    {
                        ID = CurrentIndex
                    });
                }

                CurrentIndex++;
            }
            else if (EmailCache.ContainsKey(email))
            {
                leadID = EmailCache[email].ID;
                EmailCache[email].actions_count++;
            }
            else if (!string.IsNullOrEmpty(client.msisdn) && MsisdnCache.ContainsKey(client.msisdn))
            {
                leadID = MsisdnCache[client.msisdn].ID;
                MsisdnCache[client.msisdn].actions_count++;
            }

            var actionDM = new ActionDM(Program.Database)
            {
                leadid                   = leadID,
                userid                   = "", // TODO: get correct userID
                trackingid               = client.clickid,
                affid                    = client.affid,
                pubid                    = client.pubid,
                landerid                 = (lander != null ? lander.ID : null),
                landertypeid             = (lander != null ? (int?)lander.landertypeid : null),
                providerid               = client.payment_provider,
                countryid                = client.GetCountry(),
                input_redirect           = true,
                input_email              = (!string.IsNullOrEmpty(client.email)),
                input_contact            = (!string.IsNullOrEmpty(client.firstname)),
                has_redirectedToProvider = true,
                has_subscription         = client.has_subscription,
                has_refund               = client.has_refund,
                has_chargeback           = client.has_chargeback,
                has_stolen               = client.is_stolen,
                times_charged            = client.times_charged,
                times_upsell             = client.times_upsell,
                updated                  = client.created,
                created                  = client.created
            };

            Program.Bulker.Add(new BulkModel(actionDM, 3));
        }