public override List<Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            // Since there is only one list we dont care about the myCoolList-value that will be passed in the listItemValue-parameter.

            var list = new List<Receiver>();

            // Downloads this webpage where each email is on one row.
            string page = NewsletterStudio.Helper.DownloadWebPage("http://localhost/email.html");

            // Spliting the list on every new line
            string[] arrEmails = page.Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);

            foreach (var email in arrEmails)
            {
                if(NewsletterStudio.Common.IsValidEmail(email))
                {
                    list.Add(new Receiver()
                    {
                        DataProviderKey = email,
                        Fullname = "",
                        Email = email
                    });
                }
            }

            return list;
        }
        public override List<Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var list = new List<Receiver>();
            IRecordsReader dr;
            dr = Application.SqlHelper.ExecuteReader("Select CustomerId, EmailAddress, Firstname, Lastname from uCommerce_Customer");

            while (dr.Read())
            {

                var dataProviderKey = dr.Get<int>("CustomerId").ToString();
                var email = dr.Get<string>("EmailAddress");
                var fullname = string.Format("{0} {1}", dr.Get<string>("Firstname"), dr.Get<string>("Lastname"));

                if (Common.IsValidEmail(email) && list.Count(x => x.Email == email) == 0)
                    list.Add(new Receiver()
                    {
                        DataProviderKey = dataProviderKey,
                        Email = email,
                        Fullname = fullname
                    });
            }
            dr.Close();

            return list;
        }
        public override List<Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var list = new List<Receiver>();
            var db = ApplicationContext.Current.DatabaseContext.Database;
            var uCommerceCustomers = db.Fetch<UCommerceCustomer>("SELECT CustomerId, EmailAddress, Firstname, Lastname FROM uCommerce_Customer");

            foreach (var customer in uCommerceCustomers)
            {
                if (Common.IsValidEmail(customer.EmailAddress) && !list.Any(x => x.Email == customer.EmailAddress))
                    list.Add(new Receiver()
                    {
                        DataProviderKey = customer.CustomerId.ToString(),
                        Email = customer.EmailAddress,
                        Fullname = string.Format("{0} {1}", customer.Firstname, customer.Lastname)
                    });
            }

            return list;
        }
        public override List<Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var listAll = new List<TeaReceiver>();
            IRecordsReader dr;

            dr = Application.SqlHelper.ExecuteReader("select Id, Firstname, Lastname, Email, DateFinalized FROM TeaCommerce_Order WHERE Email is not null AND DateFinalized != ''");

            while (dr.Read())
            {

                var dataProviderKey = dr.Get<int>("Id").ToString();
                var email = dr.Get<string>("Email");
                var fullname = string.Format("{0} {1}", dr.Get<string>("Firstname"), dr.Get<string>("Lastname"));
                var orderDate = dr.Get<DateTime>("DateFinalized");

                // Not in the list?
                if (Common.IsValidEmail(email) && listAll.Count(x => x.Email == email) == 0)
                {
                    var newReciver = new TeaReceiver()
                    {
                        DataProviderKey = dataProviderKey,
                        Email = email,
                        Fullname = fullname,
                        OrderDate = orderDate
                    };

                    listAll.Add(newReciver);
                }
            }
            dr.Close();

            // Filter list if only no order in last 3 months
            if (listItemValue == "1")
            {
                var delList = listAll.Where(x => x.OrderDate < DateTime.Now.AddMonths(-3));
                foreach (var item in delList)
                {
                    listAll.Remove(item);
                }
            }

            return (from item in listAll select new Receiver() {DataProviderKey = item.DataProviderKey, Email = item.Email, Fullname = item.Fullname}).ToList();
        }
        public override List<Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var listAll = new List<TeaReceiver>();

            var db = ApplicationContext.Current.DatabaseContext.Database;

            var listOfCustomers = db.Fetch<TeaCustomer>("select Id, Firstname, Lastname, Email, DateFinalized FROM TeaCommerce_Order WHERE Email is not null AND DateFinalized != ''");

            foreach (var customer in listOfCustomers)
            {

                // Not in the list?
                if (Common.IsValidEmail(customer.Email) && listAll.Any(x => x.Email == customer.Email))
                {
                    var newReciver = new TeaReceiver()
                    {
                        DataProviderKey = customer.Id.ToString(),
                        Email = customer.Email,
                        Fullname = string.Format("{0} {1}", customer.Firstname, customer.Lastname),
                        OrderDate = customer.DateFinalized
                    };

                    listAll.Add(newReciver);
                }
            }

            // Filter list if only no order in last 3 months
            if (listItemValue == "1")
            {
                var delList = listAll.Where(x => x.OrderDate < DateTime.Now.AddMonths(-3));
                foreach (var item in delList)
                {
                    listAll.Remove(item);
                }
            }

            return (from item in listAll select new Receiver() {DataProviderKey = item.DataProviderKey, Email = item.Email, Fullname = item.Fullname}).ToList();
        }
Beispiel #6
0
        public override List <Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var            listAll = new List <TeaReceiver>();
            IRecordsReader dr;

            dr = Application.SqlHelper.ExecuteReader("select Id, Firstname, Lastname, Email, DateFinalized FROM TeaCommerce_Order WHERE Email is not null AND DateFinalized != ''");

            while (dr.Read())
            {
                var dataProviderKey = dr.Get <int>("Id").ToString();
                var email           = dr.Get <string>("Email");
                var fullname        = string.Format("{0} {1}", dr.Get <string>("Firstname"), dr.Get <string>("Lastname"));
                var orderDate       = dr.Get <DateTime>("DateFinalized");

                // Not in the list?
                if (Common.IsValidEmail(email) && listAll.Count(x => x.Email == email) == 0)
                {
                    var newReciver = new TeaReceiver()
                    {
                        DataProviderKey = dataProviderKey,
                        Email           = email,
                        Fullname        = fullname,
                        OrderDate       = orderDate
                    };

                    listAll.Add(newReciver);
                }
            }
            dr.Close();


            // Filter list if only no order in last 3 months
            if (listItemValue == "1")
            {
                var delList = listAll.Where(x => x.OrderDate < DateTime.Now.AddMonths(-3));
                foreach (var item in delList)
                {
                    listAll.Remove(item);
                }
            }

            return((from item in listAll select new Receiver()
            {
                DataProviderKey = item.DataProviderKey, Email = item.Email, Fullname = item.Fullname
            }).ToList());
        }
Beispiel #7
0
        public override List <Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var listAll = new List <TeaReceiver>();

            var db = ApplicationContext.Current.DatabaseContext.Database;

            var listOfCustomers = db.Fetch <TeaCustomer>("select Id, Firstname, Lastname, Email, DateFinalized FROM TeaCommerce_Order WHERE Email is not null AND DateFinalized != ''");

            foreach (var customer in listOfCustomers)
            {
                // Not in the list?
                if (Common.IsValidEmail(customer.Email) && listAll.Any(x => x.Email == customer.Email))
                {
                    var newReciver = new TeaReceiver()
                    {
                        DataProviderKey = customer.Id.ToString(),
                        Email           = customer.Email,
                        Fullname        = string.Format("{0} {1}", customer.Firstname, customer.Lastname),
                        OrderDate       = customer.DateFinalized
                    };

                    listAll.Add(newReciver);
                }
            }

            // Filter list if only no order in last 3 months
            if (listItemValue == "1")
            {
                var delList = listAll.Where(x => x.OrderDate < DateTime.Now.AddMonths(-3));
                foreach (var item in delList)
                {
                    listAll.Remove(item);
                }
            }

            return((from item in listAll select new Receiver()
            {
                DataProviderKey = item.DataProviderKey, Email = item.Email, Fullname = item.Fullname
            }).ToList());
        }
Beispiel #8
0
        public override List <Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            // Since there is only one list we dont care about the myCoolList-value that will be passed in the listItemValue-parameter.

            var list = new List <Receiver>();

            // Downloads this webpage where each email is on one row.
            string page = NewsletterStudio.Helper.DownloadWebPage("http://localhost/email.html");

            // Spliting the list on every new line
            string[] arrEmails = page.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var email in arrEmails)
            {
                if (NewsletterStudio.Common.IsValidEmail(email))
                {
                    list.Add(new Receiver()
                    {
                        DataProviderKey = email,
                        Fullname        = "",
                        Email           = email
                    });
                }
            }

            return(list);
        }
        public override List <Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var list = new List <Receiver>();
            var db   = ApplicationContext.Current.DatabaseContext.Database;
            var uCommerceCustomers = db.Fetch <UCommerceCustomer>("SELECT CustomerId, EmailAddress, Firstname, Lastname FROM uCommerce_Customer");

            foreach (var customer in uCommerceCustomers)
            {
                if (Common.IsValidEmail(customer.EmailAddress) && !list.Any(x => x.Email == customer.EmailAddress))
                {
                    list.Add(new Receiver()
                    {
                        DataProviderKey = customer.CustomerId.ToString(),
                        Email           = customer.EmailAddress,
                        Fullname        = string.Format("{0} {1}", customer.Firstname, customer.Lastname)
                    });
                }
            }

            return(list);
        }
Beispiel #10
0
        public override List <Receiver> GetSubscribersForSendOut(string listItemValue, SendOutParams parameters)
        {
            var            list = new List <Receiver>();
            IRecordsReader dr;

            dr = Application.SqlHelper.ExecuteReader("Select CustomerId, EmailAddress, Firstname, Lastname from uCommerce_Customer");

            while (dr.Read())
            {
                var dataProviderKey = dr.Get <int>("CustomerId").ToString();
                var email           = dr.Get <string>("EmailAddress");
                var fullname        = string.Format("{0} {1}", dr.Get <string>("Firstname"), dr.Get <string>("Lastname"));

                if (Common.IsValidEmail(email) && list.Count(x => x.Email == email) == 0)
                {
                    list.Add(new Receiver()
                    {
                        DataProviderKey = dataProviderKey,
                        Email           = email,
                        Fullname        = fullname
                    });
                }
            }
            dr.Close();

            return(list);
        }