Esempio n. 1
0
        public static List <DynamicCsv> QueryUnsubscribedUsersByEmail(PaymentProviderEnum subscribed, PaymentProviderEnum unsubscribed)
        {
            var emailList = new List <DynamicCsv>();

            var tableName = "[].cc_client";

            CCSubmitConnectionString.Type = CCSubmitConnectionStringType.LocalDV;
            CCSubmitDirect db = CCSubmitDirect.Instance;
            //ForTestDirect db = ForTestDirect.Instance;

            var query = "SELECT * FROM " + tableName +
                        " WHERE payment_provider == " + (int)unsubscribed +
                        " AND times_charged = 0 " +
                        " AND email IN ( SELECT email FROM " + tableName +
                        " WHERE payment_provider = " + (int)subscribed +
                        " AND times_charged > 0 " +
                        " AND email != '' " +
                        " AND email IS NOT NULL);";

            DirectContainer dc = db.LoadContainer(query);

            if (dc.RowsCount > 0)
            {
                foreach (var row in dc.Rows)
                {
                    var dynamicCsv = new DynamicCsv()
                    {
                        Email     = row.GetString("email"),
                        FirstName = row.GetString("firstname"),
                        LastName  = row.GetString("lastname"),
                        Country   = row.GetString("country"),
                        Msisdn    = row.GetString("msisdn"),
                        Address   = row.GetString("address"),
                        City      = row.GetString("city"),
                        Zip       = row.GetString("zip")
                    };

                    emailList.Add(dynamicCsv);
                }
                return(emailList);
            }
            else
            {
                return(emailList);
            }
        }
        public List <PaymentProviderModel> GenerateProviderList()
        {
            var providersInfoList = new List <PaymentProviderModel>();

            var i = 0;

            foreach (var item in Enum.GetValues(typeof(PaymentProviderEnum)))
            {
                PaymentProviderEnum paymentProviderEnum = (PaymentProviderEnum)item;

                var provider = new PaymentProviderModel()
                {
                    ComboBoxIndex = i,
                    ProviderId    = (int)item,
                    ProviderName  = paymentProviderEnum.ToString()
                };

                providersInfoList.Add(provider);

                i++;
            }

            return(providersInfoList);
        }