Beispiel #1
0
        public static async Task <int?> GetCountryByCode(CCSubmitDirect db, string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                return(null);
            }

            if (_countryCodeMap == null)
            {
                await Configure(db);
            }

            foreach (var entry in _countryCodeMap)
            {
                if (entry.Key.Contains(code.ToLower()))
                {
                    return(entry.Value);
                }
            }

            DirectContainer dc = await db.LoadContainerAsync(string.Format("SELECT countryid, name, code FROM [].tm_country WHERE code='{0}';", code.ToLower()));

            if (!dc.HasValue)
            {
                return(null);
            }

            _countryNameMap.Add(dc.GetString("name").ToLower(), dc.GetInt("countryid").Value);
            _countryCodeMap.Add(dc.GetString("code").ToLower(), dc.GetInt("countryid").Value);
            db.TransactionalManager.Add("INSERT INTO [].tm_country_used (countryid)", dc.GetInt("countryid").Value);

            return(dc.GetInt("countryid").Value);
        }
        private void CollectDataForPremiumSms()
        {
            DirectContainer container = MobilePaywallDirect.Instance.LoadContainer(string.Format(@"
        SELECT sce.Keyword, sce.Shortcode FROM MobilePaywall.core.Service AS s
        LEFT OUTER JOIN MobilePaywall.core.ServiceConfigurationEntry AS sce ON s.ServiceConfigurationID=sce.ServiceConfigurationID
        WHERE s.Name='{0}'", this._name));

            if (!container.HasValue)
            {
                this._isPsms = false;
                Log.Error("SuitableService:: Could not load Keyword shortcode for service with name: " + this._name);
                return;
            }

            this._keyword   = container.GetString("Keyword");
            this._shortcode = container.GetString("Shortcode");

            if (string.IsNullOrEmpty(this._keyword))
            {
                this._isPsms = false;
                Log.Error("SuitableService:: Keyword is empty for service with name: " + this._name);
                return;
            }

            if (string.IsNullOrEmpty(this._shortcode))
            {
                this._isPsms = false;
                Log.Error("SuitableService:: Shortcode is empty for service with name: " + this._name);
                return;
            }
        }
        public static bool CheckIfEmailBlacklist(string email, CCSubmitDirect db = null)
        {
            if (db == null)
            {
                db = CCSubmitDirect.Instance;
            }

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

            if (EmailBlacklist == null)
            {
                DirectContainer dc = db.LoadContainer("SELECT email FROM livesports.ls_email_blacklist;");
                if (dc == null || !dc.HasValue)
                {
                    return(false);
                }

                EmailBlacklist = new Dictionary <string, int>();
                foreach (var row in dc.Rows)
                {
                    if (!EmailBlacklist.ContainsKey(row.GetString("email")))
                    {
                        EmailBlacklist.Add(row.GetString("email"), 1);
                    }
                }
            }

            return(EmailBlacklist.ContainsKey(email));
        }
        public ActionResult GetClickInformations(string uid)
        {
            int _uid = -1;

            if (!Int32.TryParse(uid, out _uid))
            {
                return(this.Content(""));
            }

            MobilePaywallDirect db    = MobilePaywallDirect.Instance;
            DirectContainer     cache = db.LoadContainer(@"SELECT c.ServiceName, c.CountryCode, c.MobileOperatorName, c.SessionCreated, p.PaymentStatusID, p.PaymentID
        FROM MobilePaywall.core.OLCache AS c
        LEFT OUTER JOIN MobilePaywall.core.Payment AS p ON c.PaymentID=p.PaymentID
        WHERE c.UserSessionID=" + uid);

            if (!cache.HasValue)
            {
                return(this.Content(""));
            }

            ClickInformationModel model = new ClickInformationModel();

            model.UserSessionID = uid;
            model.Logo          = string.Format("http://{0}/logo", cache.GetString("ServiceName"));
            model.Country       = string.Format("../images/_flagsx/{0}.png", cache.GetString("CountryCode"));

            return(PartialView("~/Views/Report/_ClickInformations.cshtml", model));
        }
Beispiel #5
0
        protected override async void Init()
        {
            CCSubmitDirect db = this.Database;

            _data = new Dictionary <string, CountryCacheModel>();
            DirectContainer dc = await db.LoadContainerAsync(
                @"SELECT c.countryid, c.name, c.code FROM [].tm_country AS c
          LEFT OUTER JOIN [].tm_country_used AS u ON u.countryid=c.countryid
          WHERE u.countryusedid IS NOT NULL;");

            foreach (var row in dc.Rows)
            {
                CountryCacheModel country = new CountryCacheModel()
                {
                    ID   = row.GetInt("countryid").Value,
                    Name = row.GetString("name").ToLower(),
                    Code = row.GetString("code").ToLower()
                };

                if (!_data.ContainsKey(country.Code))
                {
                    _data.Add(country.Code, country);
                }

                if (!_data.ContainsKey(country.Name))
                {
                    _data.Add(country.Name, country);
                }
            }
        }
Beispiel #6
0
        public List <WebLogTable> QueryByReferenceGuid(WebLogTableData data)
        {
            string command = "";

            #region # sql command #
            command = " SELECT " +
                      " rm.RawMessageID AS 'ID', " +
                      " rm.GroupKey AS 'Logger', " +
                      " rm.Thread, " +
                      " rm.RawMessageData AS 'Message', " +
                      " rm.Created AS 'Date'" +
                      " FROM [Cashflow].[log].[RawMessage] AS rm " +
                      " INNER JOIN [Cashflow].[core].[ActionContext] AS ac ON rm.ActionContextID = ac.ActionContextID " +
                      " INNER JOIN [Cashflow].[core].[ActionContextGroup] AS acg ON ac.ActionContextGroupID = acg.ActionContextGroupID " +
                      " WHERE acg.ActionContextGroupID = (SELECT TOP 1 acg1.ActionContextGroupID FROM [Cashflow].[log].[RawMessage] AS rm1 " +
                      " 															    INNER JOIN [Cashflow].[core].[ActionContext] AS ac1 ON rm1.ActionContextID = ac1.ActionContextID "+
                      " 								                  INNER JOIN [Cashflow].[core].[ActionContextGroup] AS acg1 ON ac1.ActionContextGroupID = acg1.ActionContextGroupID "+
                      " 																  WHERE "+
                      "                                   rm1.Created >= '" + data.From.ToString() + "' AND rm1.Created <= '" + data.To.ToString() + "' " +
                      " 																	AND rm1.RawMessageData LIKE '%"+ data.SessionID + "%') " +
                      " ORDER BY rm.Created ASC ";
            #endregion

            this._result = new List <WebLogTable>();
            DirectContainer container = CashflowDirect.Instance.LoadContainer(command);
            this._result = container.ConvertList <WebLogTable>();
            return(this._result);
        }
Beispiel #7
0
        public List <WebLogTable> QueryByIdentificationSessionGuid(WebLogTableData data)
        {
            string command = "";

            #region # sql command #
            command = " SELECT " +
                      " rm.RawMessageID AS 'ID', " +
                      " rm.GroupKey AS 'Logger', " +
                      " rm.Thread, " +
                      " rm.RawMessageData AS 'Message', " +
                      " rm.Created AS 'Date' " +
                      " FROM Cashflow.core.IdentificationSession AS ids " +
                      " LEFT OUTER JOIN Cashflow.core.ActionContext AS ac ON ids.ActionContextID=ac.ActionContextID " +
                      " LEFT OUTER JOIN Cashflow.core.ActionContextGroup AS acg ON ac.ActionContextGroupID=acg.ActionContextGroupID " +
                      " LEFT OUTER JOIN Cashflow.core.ActionContext AS ac2 ON acg.ActionContextGroupID=ac2.ActionContextGroupID " +
                      " LEFT OUTER JOIN Cashflow.log.RawMessage AS rm ON rm.ActionContextID=ac2.ActionContextID " +
                      " WHERE " +
                      " ids.IdentificationSessionGuid='" + data.SessionID + "' AND rm.RawMessageID IS NOT NULL " +
                      " ORDER BY rm.Created ASC; ";
            #endregion

            this._result = new List <WebLogTable>();
            DirectContainer container = CashflowDirect.Instance.LoadContainer(command);
            this._result = container.ConvertList <WebLogTable>();
            return(this._result);
        }
Beispiel #8
0
        public static PremiumSubscriptionModel GetModel(MobilePaywallDirect db, AndroidPremiumCustomer customer)
        {
            DirectContainer container = db.LoadContainer(string.Format(@"
        SELECT s.ServiceID, s.Name AS ServiceName, c.TwoLetterIsoCode, sce.Keyword, sce.Shortcode FROM MobilePaywall.core.TemplateServiceInfo AS i
        LEFT OUTER JOIN MobilePaywall.core.Service AS s ON i.ServiceID=s.ServiceID
        LEFT OUTER JOIN MobilePaywall.core.Country AS c ON s.FallbackCountryID=c.CountryID
        LEFT OUTER JOIN MobilePaywall.core.ServiceConfiguration AS sc ON s.ServiceConfigurationID=sc.ServiceConfigurationID
        LEFT OUTER JOIN MobilePaywall.core.ServiceConfigurationEntry AS sce ON sce.ServiceConfigurationID=sc.ServiceConfigurationID
		    LEFT OUTER JOIN MobilePaywall.core.AndroidPremiumCustomerServiceMap AS apcsm ON apcsm.ServiceID=s.ServiceID
        WHERE i.IsPremiumSms=1 AND sce.Shortcode != '' AND sce.Keyword != '' AND i.Progress IN (5) 
              AND (apcsm.AndroidPremiumCustomerID IS NULL OR apcsm.AndroidPremiumCustomerID!={0} OR (apcsm.AndroidPremiumCustomerID={0} AND apcsm.PaymentRequestID IS NULL)) AND c.CountryID={1}", customer.ID, customer.Country.ID));

            if (!container.HasValue || container.ColumnCount == 0)
            {
                return(null);
            }

            return(new PremiumSubscriptionModel()
            {
                ServiceID = container.GetString("ServiceID"),
                ServiceName = container.GetString("ServiceName"),
                TwoLetterIsoCode = container.GetString("TwoLetterIsoCode"),
                Keyword = container.GetString("Keyword"),
                Shortcode = container.GetString("Shortcode")
            });
        }
        public override void BulkCopy(DirectContainer table, string tableName)
        {
            if (this.Connect())
            {
                return;
            }

            try
            {
                using (SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(
                           this._connection,
                           SqlBulkCopyOptions.TableLock |
                           SqlBulkCopyOptions.FireTriggers |
                           SqlBulkCopyOptions.UseInternalTransaction, null))
                {
                    sqlBulkCopy.DestinationTableName = string.Format("{0}.{1}", this.DatabaseScheme, tableName);
                    sqlBulkCopy.BatchSize            = 10000;
                    foreach (var column in table.DataTable.Columns)
                    {
                        sqlBulkCopy.ColumnMappings.Add(column.ToString(), column.ToString());
                    }
                    sqlBulkCopy.WriteToServer(table.DataTable);
                }

                this.Disconnect();
            }
            catch (Exception e)
            {
                Log.Error("DIRECT_DATABASE_FATAL: on BULK COPY | ", e);
                this.OnFatalAction?.Invoke("OnBulkCopy:: " + e.ToString());
                this._lastErrorMessage = e.Message;
                return;
            }
        }
        public ActionResult GetOLInfo(string uid)
        {
            int usid = -1;

            if (!Int32.TryParse(uid, out usid))
            {
                return(this.Content("Parse error"));
            }

            UserSession us = UserSession.CreateManager().Load(usid);

            if (us == null)
            {
                return(this.Content("User session error"));
            }

            DirectContainer olContainer = (new MobilePaywallDirect()).LoadContainer(@"SELECT c.SessionCreated, c.Msisdn, c.CountryCode, c.Pxid, c.ServiceName, c.MobileOperatorName, c.IPAddress, prs.Name AS 'PaymentRequestStatus', 
              ps.Name AS 'PaymentStatus', p.Created AS 'PaymentCreated', c.PaymentContentAccessPolicyID AS 'AccessPolicy', c.TransactionID, c.Created AS 'TransactionCreated'
         FROM MobilePaywall.core.OLCache AS c
         LEFT OUTER JOIN MobilePaywall.core.PaymentRequest AS pr ON c.PaymentRequestID=pr.PaymentRequestID
         LEFT OUTER JOIN MobilePaywall.core.PaymentRequestStatus AS prs ON pr.PaymentRequestStatusID=prs.PaymentRequestStatusID
         LEFT OUTER JOIN MobilePaywall.core.Payment AS p ON c.PaymentID=p.PaymentID
         LEFT OUTER JOIN MobilePaywall.core.PaymentStatus AS ps ON p.PaymentStatusID=ps.PaymentStatusID
         WHERE c.UserSessionID=" + uid + " AND IsSubseguent=0 ORDER BY c.OLCacheID DESC");

            if (olContainer == null)
            {
                return(this.Content("No Data"));
            }

            OLCacheModel model = olContainer.Convert <OLCacheModel>();

            return(PartialView("~/Views/Report/_OLBlock.cshtml", model));
        }
Beispiel #11
0
        // basic implementation of framework
        public SnippetContainers()
        {
            CCSubmitDirect db    = new CCSubmitDirect();
            int            index = 1;
            string         q     = "SELECT * FROM [].tm_lead WHERE msisdn != '' ORDER BY leadid DESC LIMIT 5";

            foreach (var elem in db.LoadEnumerable(q))
            {
                Console.WriteLine(index + ": " + elem.GetString("leadid") + " - " + elem.GetString("email"));
                index++;
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            DirectContainer dc = db.LoadContainer(q);

            foreach (var elem in dc.Rows)
            {
                Console.WriteLine(index + ": " + elem.GetString("leadid") + " - " + elem.GetString("email"));
                index++;
            }

            db.Dispose();
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            CCSubmitDirect  db = CCSubmitDirect.Instance;
            DirectContainer dc = db.LoadContainer("SELECT leadid, country, countryid FROM [].tm_lead order by leadid desc;");

            int count = dc.RowsCount;

            foreach (var row in dc.Rows)
            {
                string country = row.GetString("country");
                if (string.IsNullOrEmpty(country) || row.GetInt("countryid").HasValue)
                {
                    continue;
                }

                int?id = LeadManager.GetCountryID(country, db);
                if (id.HasValue)
                {
                    db.Transactional.Execute("UPDATE [].tm_lead SET countryid={0} WHERE leadid={1}", id, row.GetInt("leadid").Value);
                }

                if (db.Transactional.Count >= 500)
                {
                    db.Transactional.Run();
                }
            }

            int a = 0;
        }
Beispiel #13
0
        public static List <DynamicCsv> QueryLeadsByMsisdnAndEmail(List <DynamicCsv> csvList)
        {
            var csvListToUpdate = new List <DynamicCsv>();

            var tableTypeString = "[].tm_lead";

            string msisdnParams;
            string emailParams;

            var result = CsvListToEMailAndMsisdnParams(csvList);

            msisdnParams = result.msisdns;
            emailParams  = result.emails;

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

            var query = "SELECT * FROM " + tableTypeString + " ";

            if (msisdnParams != "" && emailParams != "")
            {
                query += "WHERE (msisdn in(" + msisdnParams + ") and (email = '' or email is null)) OR (email in(" + emailParams + ") and (msisdn = '' or msisdn is null))";
            }
            else if (msisdnParams != "" && emailParams == "")
            {
                query += "WHERE (msisdn in(" + msisdnParams + ") and (email = '' or email is null))";
            }
            else if (msisdnParams == "" && emailParams != "")
            {
                query += "WHERE (email in(" + emailParams + ") and (msisdn = '' or msisdn is null))";
            }
            else
            {
                return(new List <DynamicCsv>());
            }

            DirectContainer dc = db.LoadContainer(query);

            if (dc.RowsCount > 0)
            {
                foreach (var row in dc.Rows)
                {
                    var csvItem = csvList.FirstOrDefault(record => record.Msisdn == row.GetString("msisdn") || record.Email == row.GetString("email"));

                    if (csvItem != null)
                    {
                        csvItem.SetLeadId((int)row.GetInt("leadid"));
                    }

                    csvListToUpdate.Add(csvList.FirstOrDefault());
                }
                return(csvListToUpdate);
            }
            else
            {
                return(csvListToUpdate);
            }
        }
Beispiel #14
0
        public CodeManager(FilterModel filter)
        {
            MobilePaywallDirect directInstance = MobilePaywallDirect.Instance;

            CreateSql(filter);
            this._conteiner = directInstance.LoadContainer(_sqlCommand);
            _homeModel      = new HomeModel(this._conteiner);
        }
Beispiel #15
0
        // GET: Detail
        public ActionResult ViewDetails(int id, string tableName)
        {
            MobilePaywallDirect directInstance = MobilePaywallDirect.Instance;
            string          sqlCommand         = "SELECT * FROM MobilePaywall.log." + tableName + " WHERE " + tableName + "ID=" + id;
            DirectContainer conteiner          = directInstance.LoadContainer(sqlCommand);

            WebLogInspector.Models.Home.LogResultModel model = new Models.Home.LogResultModel(conteiner.Rows.First());
            return(View(model));
        }
        public HomeModel(DirectContainer container)
        {
            LogResultModel logModel = null;

            this._rowsList = new List <LogResultModel>();
            foreach (DirectContainerRow row in container.Rows)
            {
                logModel = new LogResultModel(row);
                this._rowsList.Add(logModel);
            }
        }
Beispiel #17
0
        // SUMMARY: Get all task data
        public static IEnumerable <DeamonTaskData> GetCurrentData()
        {
            DirectContainer container = DeamonManager.Database.LoadContainer(string.Format(@"
        SELECT DeamonTaskID, Namespace, Day, Hour, Minute, LastExecution 
        FROM MobilePaywall.core.DeamonTask 
        WHERE IsActive=1 AND IsRunning=0 AND ExecuteOnlyOnDemand=0;"));

            foreach (DirectContainerRow row in container.Rows)
            {
                yield return(new DeamonTaskData(row));
            }
        }
Beispiel #18
0
        public void Process()
        {
            if (!Status.Instance.InStation)
            {
                return;
            }

            if (Status.Instance.InSpace)
            {
                return;
            }

            switch (_state)
            {
            case State.Idle:
                break;

            case State.Done:
                _done = true;

                if (OnItemHangerFinished != null)
                {
                    OnItemHangerFinished(_hangerItems);
                }
                break;

            case State.Begin:

                _hangerItems = new List <DirectItem>();

                _state = State.LoadHanger;
                break;

            case State.LoadHanger:
                if (DateTime.UtcNow.Subtract(_lastAction).TotalSeconds < 2)
                {
                    break;
                }

                _lastAction = DateTime.UtcNow;

                DirectContainer itemHanger = Cache.Instance.DirectEve.GetItemHangar();
                Cache.Instance.ItemHanger = itemHanger;
                foreach (DirectItem item in itemHanger.Items)
                {
                    Logging.Log("Inventory:Process", "Item loaded Name - " + item.Name, Logging.White);
                    _hangerItems.Add(item);
                }

                _state = State.Done;
                break;
            }
        }
        public ActionResult ClickinformationsAction_CancelPayment(string uid)
        {
            if (string.IsNullOrEmpty(uid))
            {
                return(this.Json(new { status = false, message = "There is no uid param" }));
            }

            MobilePaywallDirect db = MobilePaywallDirect.Instance;

            DirectContainer container = db.LoadContainer(string.Format(@"
        SELECT ol.PaymentID, p.PaymentStatusID FROM MobilePaywall.core.OLCache AS ol
        LEFT OUTER JOIN MobilePaywall.core.Payment AS p ON ol.PaymentID=p.PaymentID
        WHERE UserSessionID={0}", uid));

            if (!container.HasValue)
            {
                return(this.Json(new { status = false, message = "There is no entry for this UserSession" }));
            }

            int?paymentID     = container.GetInt("PaymentID");
            int?paymentStatus = container.GetInt("PaymentStatusID");

            if (!paymentID.HasValue)
            {
                return(this.Json(new { status = false, message = "This UserSession has no payment" }));
            }
            if (!paymentStatus.HasValue)
            {
                return(this.Json(new { status = false, message = "InternalError. There is no status for payment on this US" }));
            }

            if (paymentStatus.Value == 1)
            {
                return(this.Json(new { status = false, message = "Payment status is initialized. You cannot cancel this status" }));
            }
            if (paymentStatus.Value == 2)
            {
                return(this.Json(new { status = false, message = "Payment status is pending. You cannot cancel this status" }));
            }
            if (paymentStatus.Value == 4)
            {
                return(this.Json(new { status = false, message = "Payment status is failed. You cannot cancel this payment" }));
            }
            if (paymentStatus.Value == 5)
            {
                return(this.Json(new { status = false, message = "This payment is allready canceled" }));
            }

            db.Execute("UPDATE MobilePaywall.core.Payment SET PaymentStatusID=5 WHERE PaymentID=" + paymentID.Value);
            return(this.Json(new { status = true, message = "Payment is cancelled" }));
        }
Beispiel #20
0
        public override DirectContainer GetDataTableTemplate(string tableName)
        {
            DirectContainer dc = this.LoadContainer(string.Format("SELECT TOP 1 * FROM {0}.{1}.{2};", this.DatabaseName, this.DatabaseScheme, tableName));

            if (dc == null)
            {
                return(null);
            }

            dc.DataTable.TableName = tableName;
            dc.DataTable.Rows.Clear();

            return(dc);
        }
Beispiel #21
0
        public LeadEntry(int leadID, CCSubmitDirect db = null)
        {
            this._id = leadID;
            if (db == null)
            {
                this._database = CCSubmitDirect.Instance;
            }
            else
            {
                this._database = db;
            }

            this.Container = db.LoadContainer("SELECT * FROM [].tm_lead WHERE leadid=" + this._id);
        }
Beispiel #22
0
        public static DeamonTaskData GetTaskByKey(string key)
        {
            DirectContainer container = DeamonManager.Database.LoadContainer(string.Format(@"
        SELECT DeamonTaskID, Namespace, Day, Hour, Minute, LastExecution 
        FROM MobilePaywall.core.DeamonTask 
        WHERE IsActive=1 AND IsRunning=0 AND DemandKey='{0}';", key));

            if (!container.HasValue || container.RowsCount == 0)
            {
                return(null);
            }

            return(new DeamonTaskData(container[0]));
        }
Beispiel #23
0
        // SUMMARY: Sql for getting all records for the click
        public List <WebLogTable> Query(WebLogTableData data, string UseRefence)
        {
            string command = "";

            #region # sql command #
            if (UseRefence.Equals("true"))
            {
                command = " SELECT " +
                          " rm.RawMessageID AS 'ID', " +
                          " rm.GroupKey AS 'Logger', " +
                          " rm.Thread, " +
                          " rm.RawMessageData AS 'Message', " +
                          " rm.Created AS 'Date'" +
                          " FROM [Cashflow].[log].[RawMessage] AS rm " +
                          " INNER JOIN [Cashflow].[core].[ActionContext] AS ac ON rm.ActionContextID = ac.ActionContextID " +
                          " INNER JOIN [Cashflow].[core].[ActionContextGroup] AS acg ON ac.ActionContextGroupID = acg.ActionContextGroupID " +
                          " WHERE acg.ActionContextGroupID = (SELECT TOP 1 acg1.ActionContextGroupID FROM [Cashflow].[log].[RawMessage] AS rm1 " +
                          " 															    INNER JOIN [Cashflow].[core].[ActionContext] AS ac1 ON rm1.ActionContextID = ac1.ActionContextID "+
                          " 								                  INNER JOIN [Cashflow].[core].[ActionContextGroup] AS acg1 ON ac1.ActionContextGroupID = acg1.ActionContextGroupID "+
                          " 																  WHERE "+
                          "                                   rm1.Created >= '" + data.From.ToString() + "' AND rm1.Created <= '" + data.To.ToString() + "' " +
                          " 																	AND rm1.RawMessageData LIKE '%"+ data.SessionGuid + "%') " +
                          " ORDER BY rm.Created ASC ";
            }
            else
            {
                command = " SELECT " +
                          " rm.RawMessageID AS 'ID', " +
                          " rm.GroupKey AS 'Logger', " +
                          " rm.Thread, " +
                          " rm.RawMessageData AS 'Message', " +
                          " rm.Created AS 'Date' " +
                          " FROM Cashflow.core.IdentificationSession AS ids " +
                          " LEFT OUTER JOIN Cashflow.core.ActionContext AS ac ON ids.ActionContextID=ac.ActionContextID " +
                          " LEFT OUTER JOIN Cashflow.core.ActionContextGroup AS acg ON ac.ActionContextGroupID=acg.ActionContextGroupID " +
                          " LEFT OUTER JOIN Cashflow.core.ActionContext AS ac2 ON acg.ActionContextGroupID=ac2.ActionContextGroupID " +
                          " LEFT OUTER JOIN Cashflow.log.RawMessage AS rm ON rm.ActionContextID=ac2.ActionContextID " +
                          " WHERE " +
                          " ids.IdentificationSessionGuid='" + data.SessionGuid + "' " +
                          " AND rm.Created >= '" + data.From.ToString() + "' AND rm.Created <= '" + data.To.ToString() + "' " +
                          " ORDER BY rm.Created ASC; ";
            }
            #endregion

            this._result = new List <WebLogTable>();
            DirectContainer container = CashflowDirect.Instance.LoadContainer(command);
            this._result = container.ConvertList <WebLogTable>();
            return(this._result);
        }
        public static UndercoverResult Init(string clickID)
        {
            CCUndercoverAgent.Log(clickID, "CC_NEW:: Starting for : " + clickID);
            UndercoverResult result = new UndercoverResult();
            CCSubmitDirect   db     = CCSubmitDirect.Instance;
            DirectContainer  dc     = db.LoadContainer(string.Format("SELECT affid, pubid, referrer FROM livesports.cc_client WHERE clickid='{0}' ORDER BY clientid DESC LIMIT 1;", clickID));

            if (!dc.HasValue)
            {
                CCUndercoverAgent.Log(clickID, "CC_NEW:: There is no entries for clickID: " + clickID);
                return(result);
            }

            string affID = !string.IsNullOrEmpty(dc.GetString("affid")) ? dc.GetString("affid") : GetParamByName(dc.GetString("referrer"), "affiliate_id");
            string pubID = !string.IsNullOrEmpty(dc.GetString("pubid")) ? dc.GetString("pubid") : GetParamByName(dc.GetString("referrer"), "utm_campaign");

            if (string.IsNullOrEmpty(affID))
            {
                CCUndercoverAgent.Log(clickID, "CC_NEW:: There is no AffID for clickID: " + clickID);
                return(result);
            }

            DirectContainer _directContainer;

            if (!string.IsNullOrEmpty(pubID))
            {
                _directContainer = db.LoadContainer("SELECT * FROM [].cc_undercover WHERE (aff_id={0} AND pub_id={1}) OR (aff_id={0} AND pub_id IS NULL) ORDER BY pub_id DESC LIMIT 1;", int.Parse(affID), pubID);
            }
            else
            {
                _directContainer = db.LoadContainer("SELECT * FROM [].cc_undercover WHERE (aff_id={0} AND pub_id IS NULL) ORDER BY pub_id DESC LIMIT 1;", int.Parse(affID));
            }


            if (_directContainer.HasValue && _directContainer.GetDouble("tcost").HasValue)
            {
                try
                {
                    return(GetByVariableTCost(_directContainer, affID));
                }
                catch (Exception e)
                {
                    Log(clickID, "[FATAL WITH tcost] " + e.ToString());
                }
            }

            Log(clickID, "CCUndercover will go to old way, for clickID = " + clickID + ", affID=" + affID);
            return(result);
        }
Beispiel #25
0
        private static async Task Configure(CCSubmitDirect db)
        {
            _countryNameMap = new Dictionary <string, int>();
            DirectContainer dc = await db.LoadContainerAsync(
                @"SELECT c.countryid, c.name, c.code FROM [].tm_country AS c
          LEFT OUTER JOIN [].tm_country_used AS u ON u.countryid=c.countryid
          WHERE u.countryusedid IS NOT NULL;");

            _countryNameMap = new Dictionary <string, int>();
            _countryCodeMap = new Dictionary <string, int>();
            foreach (var row in dc.Rows)
            {
                _countryNameMap.Add(row.GetString("name").ToLower(), row.GetInt("countryid").Value);
                _countryCodeMap.Add(row.GetString("code").ToLower(), row.GetInt("countryid").Value);
            }
        }
Beispiel #26
0
        public ActionResult CloseAccessPolicy(string uid)
        {
            //Client client = ClientHelper.GetClient(Request);
            //if (client == null)
            //  return this.Json(new { status = false, message = "Login error" });

            int _uid = -1;

            if (!Int32.TryParse(uid, out _uid))
            {
                return(this.Json(new { status = false, message = "Parse error" }, JsonRequestBehavior.AllowGet));
            }

            MobilePaywallDirect db = MobilePaywallDirect.Instance;
            int?paymentID          = db.LoadInt("SELECT PaymentID FROM MobilePaywall.core.OLCache WHERE UserSessionID=" + uid);

            if (!paymentID.HasValue)
            {
                return(this.Json(new { status = false, message = "Payment is missing from cache" }));
            }

            DirectContainer pcapm = db.LoadContainer("SELECT PaymentContentAccessPolicyMapID FROM MobilePaywall.core.PaymentContentAccessPolicyMap WHERE PaymentID=" + paymentID.Value + " AND IsValid=1 AND ValidTo>getdate();");

            if (!pcapm.HasValue)
            {
                return(this.Json(new { status = false, message = "There are no active Access policies" }));
            }

            IPaymentContentAccessPolicyMapManager pcapManager = PaymentContentAccessPolicyMap.CreateManager();

            foreach (DirectContainerRow row in pcapm.Rows)
            {
                int?pcapmID = row.GetInt("PaymentContentAccessPolicyMapID");
                if (!pcapmID.HasValue)
                {
                    continue;
                }

                PaymentContentAccessPolicyMap map = pcapManager.Load(pcapmID.Value);
                if (map == null)
                {
                    continue;
                }
            }

            return(null);
        }
Beispiel #27
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);
            }
        }
Beispiel #28
0
        public List <WebLogTable> QueryByReferenceIntID(WebLogTableData data)
        {
            string command = "";

            #region # sql command #
            command = @"SELECT rm.RawMessageID AS 'ID',  rm.GroupKey AS 'Logger',  rm.Thread,  rm.RawMessageData AS 'Message',  rm.Created AS 'Date'  
        FROM Cashflow.core.ActionContextGroupReferenceMap AS map 
        LEFT OUTER JOIN Cashflow.core.ActionContext AS c ON map.ActionContextGroupID=c.ActionContextGroupID
        LEFT OUTER JOIN Cashflow.log.RawMessage AS rm ON rm.ActionContextID=c.ActionContextID
        WHERE map.ReferenceIntID=" + data.SessionID + "  AND rm.RawMessageID IS NOT NULL ;";
            #endregion

            this._result = new List <WebLogTable>();
            DirectContainer container = CashflowDirect.Instance.LoadContainer(command);
            this._result = container.ConvertList <WebLogTable>();
            return(this._result);
        }
Beispiel #29
0
        public static List <string> QueryMsisdnsFromTm_Lead(string msisdnParams)
        {
            var tableTypeString = "[].tm_lead";

            var listMsisdn = new List <string>();

            CCSubmitDirect  db = CCSubmitDirect.Instance;
            DirectContainer dc = db.LoadContainer("SELECT msisdn FROM " + tableTypeString + " " +
                                                  "WHERE msisdn in (" + msisdnParams + ")");

            foreach (var row in dc.Rows)
            {
                listMsisdn.Add(row.GetString("msisdn"));
            }

            return(listMsisdn);
        }
Beispiel #30
0
        public DirectContainer Load()
        {
            if (this._container != null)
            {
                return(this._container);
            }

            string query = "SELECT * FROM [databaseName].[scheme].Snapshop WHERE ReferenceID=[refID] AND Context='[context]' AND TableName='[tableName]'"
                           .Replace("[databaseName]", this._database.DatabaseName)
                           .Replace("[scheme]'", this._database.DatabaseScheme)
                           .Replace("[tableName]", this._tableName)
                           .Replace("[refID]", this._referenceID.ToString())
                           .Replace("[context]", this._context);

            this._container = this._database.LoadContainer(query);
            return(this._container);
        }