public static async void Test() { CCSubmitDirect db = CCSubmitDirect.Instance; var lead = await LeadDM.LoadByMsisdnOrEmailAsync(db, "61405016390", "*****@*****.**"); int a = 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); } } }
static void Main(string[] args) { var db = new CCSubmitDirect(); var creator = new MysqlModelsGenerator(db); creator.GenerateFile("tm_admin", "Admin", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_action_account", "ActionAccount", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_admin", "Admin", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_admin_session", "AdminSession", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_country", "Country", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_country_used", "CountryUsed", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_email_blacklist", "EmailBlacklist", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_lander", "Lander", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_landertype", "LanderType", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_lead", "Lead", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_lead_history", "LeadHistory", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_prelander", "Prelander", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_prelandertype", "PrelanderType", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_provider", "Provider", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_session", "Session", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_session_data", "SessionData", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_session_request", "SessionRequest", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_session_type", "SessionType", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_test", "Test", @"D:\github\CCMonkeys\_rest\output"); //creator.GenerateFile("tm_user", "User", @"D:\github\CCMonkeys\_rest\output"); }
public ActionResult RedirectionToLander(ControllerRedirectionModel input) { CCSubmitDirect db = CCSubmitDirect.Instance; int? actionID = ActionManager.ExecuteAction(new ActionModel() { Database = db, ActionID = input.LeadActionID, AffID = input.affid, PubID = input.pubid, PrelanderType = input.type, prelander = input.prelander, LanderName = input.landerName, Service = input.Service, Event = ActionModelEvent.InputEmail, ClickID = input.lxid, ipAddress = Request.UserHostAddress, }); db.Transactional.Run(); if (!actionID.HasValue) { return(this.Error("aid error")); } return(this.Success("success", actionID.Value)); }
public static int?GetPrelanderTypeID(string type, CCSubmitDirect db = null) { if (db == null) { db = CCSubmitDirect.Instance; } if (string.IsNullOrEmpty(type)) { return(null); } int?prelandertypeid = null; if (!CCSubmitCacheManager.PrelanderTypes.ContainsKey(type)) { prelandertypeid = db.LoadInt("SELECT prelandertypeid FROM [].tm_prelandertype WHERE name={0}", type); if (!prelandertypeid.HasValue) { prelandertypeid = db.Execute("INSERT INTO [].tm_prelandertype (name)", type); } if (!prelandertypeid.HasValue) { return(null); } CCSubmitCacheManager.PrelanderTypes.Add(type, prelandertypeid.Value); } else { prelandertypeid = CCSubmitCacheManager.PrelanderTypes[type]; } return(prelandertypeid); }
public ActionResult Subscribe(ControllerSubscribeModel input) { CCSubmitDirect db = CCSubmitDirect.Instance; (new LegacySubscribe(db, this.Request, input)).Run(); if (input.LeadActionID == -1) { return(this.Error("aid error")); } ActionManager.ExecuteAction(new ActionModel() { Database = db, Service = ActionModel.Convert(input.pp), Event = ActionModelEvent.InputContact, ActionID = input.LeadActionID, FirstName = input.firstname, LastName = input.lastname, Msisdn = input.msisdn, Country = input.country, Zip = input.zip }); db.Transactional.Run(); return(this.Success("success", input.LeadActionID)); }
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; }
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 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); }
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); } }
public static LeadEntry ManageLeadFromAction(ActionModel model) { CCSubmitDirect db = model.Database; if (db == null) { db = CCSubmitDirect.Instance; } int? leadid = db.LoadInt("SELECT leadID FROM [].tm_lead_action WHERE actionid=" + model.ActionID); LeadEntry leadEntry = null; if (leadid.HasValue) { // this action has valid lead, so we update values leadEntry = new LeadEntry(leadid.Value, db); leadEntry.CheckValue("first_name", model.FirstName); leadEntry.CheckValue("last_name", model.LastName); leadEntry.CheckValue("msisdn", model.Msisdn); leadEntry.CheckValue("email", model.Email); leadEntry.CheckValue("address", model.Address); leadEntry.CheckValue("zip", model.Zip); leadEntry.CheckValue("country", model.Country); leadEntry.CheckValue("city", model.City); } else { // this action does not have valid lead, so we need to create/find new one // we try to find it by email, msisdn leadid = LeadManager.GetLeadID(model.Msisdn, model.Email, db); if (leadid.HasValue) { // if we find it, we try to update values leadEntry = new LeadEntry(leadid.Value, db); leadEntry.CheckValue("first_name", model.FirstName); leadEntry.CheckValue("last_name", model.LastName); leadEntry.CheckValue("address", model.Address); leadEntry.CheckValue("email", model.Email); leadEntry.CheckValue("zip", model.Zip); leadEntry.CheckValue("country", model.Country); leadEntry.CheckValue("city", model.City); leadEntry.CheckValue("msisdn", model.Msisdn); leadEntry.UpdateSql += "actions_count=actions_count+1,"; } else { // if not, we create new one leadid = CreateLead(model.Msisdn, model.Email, model.FirstName, model.LastName, model.Country, model.Address, model.City, model.Zip, model.device_model, model.carrier, model.device_mf, model.device_os, 1); leadEntry = new LeadEntry(leadid.Value, db); } db.Transactional.Execute("UPDATE [].tm_lead_action SET leadid={0} WHERE actionid={1}", leadid.Value, model.ActionID); } leadEntry.FinishUpdateSql(); return(leadEntry); }
public static int?GetActionID(string clickid, CCSubmitDirect db = null) { if (db == null) { db = CCSubmitDirect.Instance; } return(db.LoadInt("SELECT actionid FROM [].tm_lead_action WHERE clickid={0}", clickid)); }
public static (bool isSuccess, int numOfRows) InsertCsvData(List <string[]> csvArrayList) { CCSubmitDirect db = CCSubmitDirect.Instance; string query = ""; query += db.Construct("INSERT INTO [].tm_lead (msisdn, email, first_name, last_name, country, address, city, zip, device, operator)", csvArrayList); var numOfRows = db.Execute(query); return(numOfRows > 0 ? true : false, numOfRows != null ? (int)numOfRows : 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); }
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); }
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); } }
public int?GetAffiliateCurrentTransactions(string affiliateID) { CCSubmitDirect ccdb = CCSubmitDirect.Instance; DateTime startDate = DateTime.Today.AddHours(-2); string startDateQuery = string.Format("{0}-{1}-{2} {3}:00:00", startDate.Year, startDate.Month, startDate.Day, startDate.Hour); DateTime endDate = startDate.AddDays(1); string endDateQuery = string.Format("{0}-{1}-{2} {3}:00:00", endDate.Year, endDate.Month, endDate.Day, endDate.Hour); string query = string.Format("SELECT COUNT(*) FROM [].tm_action WHERE affid={0} AND created>=\"{1}\" AND created<=\"{2}\" AND (has_subscription=1 OR (has_subscription=0 AND times_charged=1)) ORDER BY actionid;", affiliateID, startDateQuery, endDateQuery); int?result = ccdb.LoadInt(query); Console.WriteLine(affiliateID + " - " + result.Value); return(result); }
public static (bool isSuccess, int numOfRows) InsertCsvData(List <DynamicCsv> csvParamsList) { //CCSubmitDirect db = CCSubmitDirect.Instance; CCSubmitConnectionString.Type = CCSubmitConnectionStringType.LocalDV; CCSubmitDirect db = CCSubmitDirect.Instance; string query = ""; query += "INSERT INTO [].tm_lead (msisdn, email, first_name, last_name, country, address, city, zip, device, operator, device_mf, device_os, updated) VALUES" + ConstructParamsCustom(csvParamsList); var result = db.Execute(query); var numOfRows = result.NumberOfRowsAffected; return(numOfRows > 0 ? true : false, numOfRows != null ? (int)numOfRows : 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); }
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 static int?GetLeadID(string msisdn, string email, CCSubmitDirect db = null) { if (string.IsNullOrEmpty(msisdn) && string.IsNullOrEmpty(email)) { return(null); } if (db == null) { db = CCSubmitDirect.Instance; } if (!string.IsNullOrEmpty(msisdn) && !string.IsNullOrEmpty(email)) { string query = string.Format(" (msisdn='{0}' AND email='{1}') OR (msisdn=null AND email='{1}') OR (msisdn='{0}' AND email=null)", msisdn, email); int? id = db.LoadInt(string.Format("SELECT leadid FROM [].tm_lead WHERE {0}", query)); if (id.HasValue) { return(id); } } if (!string.IsNullOrEmpty(msisdn)) { string query = string.Format(" msisdn='{0}'", msisdn); int? id = db.LoadInt(string.Format("SELECT leadid FROM [].tm_lead WHERE {0}", query)); if (id.HasValue) { return(id); } } if (!string.IsNullOrEmpty(email)) { string query = string.Format(" email='{0}'", email); int? id = db.LoadInt(string.Format("SELECT leadid FROM [].tm_lead WHERE {0}", query)); if (id.HasValue) { return(id); } } return(null); }
public async static Task <SessionDataDM> GetSessionDataAsync(CCSubmitDirect database, string ip, string useragent) { var result = await GetAsync(ip, useragent); return(new SessionDataDM(database) { guid = Guid.NewGuid().ToString(), countryCode = result.countryCode, countryName = result.country, region = result.region, city = result.city, ISP = result.AS, latitude = result.lat, longitude = result.lon, timezone = result.timezone, zipCode = result.zip }); }
public ActionResult CreateUser(ControllerCreateUserModel input) { CCSubmitDirect db = CCSubmitDirect.Instance; if (string.IsNullOrEmpty(input.email)) { return(this.Error("no_email")); } if (CCSubmitCacheManager.CheckIfEmailBlacklist(input.email)) { return(this.Error("email_blacklist")); } // Legacy update (new LegacyCreateUser(db, this.Request, input)).Run(); int?actionID = ActionManager.ExecuteAction(new ActionModel() { Database = db, ActionID = input.LeadActionID, AffID = input.affid, PubID = input.pubid, PrelanderType = input.type, prelander = input.prelander, LanderName = input.landerName, LanderUrl = Request.UrlReferrer != null ? Request.UrlReferrer.AbsolutePath : string.Empty, Service = input.Service, Event = ActionModelEvent.InputEmail, ClickID = input.lxid, ipAddress = Request.UserHostAddress, Email = input.email }); db.Transactional.Run(); if (!actionID.HasValue) { return(this.Error("aid error")); } return(this.Success("success", actionID.Value)); }
public static void OnRequestLoad(ServerSocketBase server, string key, string socket_uid, string rawDataInput) { DirectSocketResponse response = new DirectSocketResponse(); try { DirectSocketInputModel input = JsonConvert.DeserializeObject <DirectSocketInputModel>(rawDataInput); response.Ticket = input.ticket; string query = ""; if (!string.IsNullOrEmpty(input.query)) { query = input.query.Trim(); } else { query = string.Format($"SELECT {input.SelectQuery}{input.FromQuery}{input.WhereQuery}{input.OrderByQuery}{input.LimitQuery}"); } CCSubmitDirect db = CCSubmitDirect.Instance; if (input.query.ToLower().StartsWith("insert")) { response.Data = db.Execute(query); } else if (input.query.ToLower().StartsWith("update")) { response.Data = db.Execute(query); } else { response.Data = db.Load(query).RawData; } } catch (Exception e) { response.Success = false; response.Message = e.ToString(); } finally { server.SendAsync(socket_uid, JsonConvert.SerializeObject(response)); } }
public static UndercoverResult Init(ActionDM action, PostbackDM postback) { postback.Log("CC_NEW:: Starting for : " + action.trackingid); UndercoverResult result = new UndercoverResult(); CCSubmitDirect db = CCSubmitDirect.Instance; string affID = action.affid; string pubID = action.pubid; if (string.IsNullOrEmpty(affID)) { postback.Log("CC_NEW:: There is no AffID for clickID: " + action.trackingid); return(result); } DirectContainer _directContainer; if (!string.IsNullOrEmpty(pubID)) { _directContainer = db.LoadContainer("SELECT * FROM [].cc_undercover WHERE (affid={0} AND pubid={1}) OR (affid={0} AND pubid IS NULL) ORDER BY pubid DESC LIMIT 1;", int.Parse(affID), pubID); } else { _directContainer = db.LoadContainer("SELECT * FROM [].cc_undercover WHERE (affid={0} AND pubid IS NULL) ORDER BY pubid DESC LIMIT 1;", affID); } if (_directContainer.HasValue && _directContainer.GetDouble("tcost").HasValue) { try { return(GetByVariableTCost(_directContainer, action, postback)); } catch (Exception e) { postback.Log("[FATAL WITH tcost] " + e.ToString()); } } postback.Log("CCUndercover will go to old way, for clickID = " + action.trackingid + ", affID=" + affID); return(result); }
public ActionResult EndFlow(ControllerEndFlowModel input) { CCSubmitDirect db = CCSubmitDirect.Instance; if (input.LeadActionID == -1) { return(this.Error("aid error")); } ActionManager.ExecuteAction(new ActionModel() { Database = db, Event = ActionModelEvent.EndFlow, ActionID = input.LeadActionID, ProviderRedirection = input.provider_redirection }); db.Transactional.Run(); return(this.Success("success", input.LeadActionID)); }
public static int?Create(ActionModel input) { CCSubmitDirect db = input.Database; // check prelander type int?prelandertypeid = CCSubmitCacheManager.GetPrelanderTypeID(input.PrelanderType); if (!prelandertypeid.HasValue) { return(null); } // check prelander int?prelanderid = CCSubmitCacheManager.GetPrelanderID(input.prelander, prelandertypeid.Value); if (!prelanderid.HasValue) { return(null); } // get lead id int?leadid = null; if (!string.IsNullOrEmpty(input.Msisdn) || !string.IsNullOrEmpty(input.Email)) { leadid = LeadManager.GetLeadID(input.Msisdn, input.Email, db); if (!leadid.HasValue) { leadid = LeadManager.CreateLead(input.Msisdn, input.Email, input.FirstName, input.LastName, input.Country, input.Address, input.City, input.Zip, input.device_model, input.carrier, input.device_mf, input.device_os, 1, db); } else { db.Transactional.Execute("UPDATE [].tm_lead SET actions_count=actions_count+1 WHERE leadid={0};", leadid.Value); } } int?actionid = db.Execute("INSERT INTO [].tm_lead_action (leadid, prelandertypeid, prelanderid, host, request, referrer, ip, updated)", leadid, prelandertypeid.Value, prelanderid.Value, input.host, input.request, input.referrer, input.ipAddress, DirectTime.Now); return(actionid); }
// SUMMARY: Initial redirection from prelander public ActionResult Redirection(ControllerRedirectModel input) { if (string.IsNullOrEmpty(input.host) || string.IsNullOrEmpty(input.request)) { return(this.Content("error")); } string redirect = "https://" + input.host + input.request; CCSubmitDirect db = CCSubmitDirect.Instance; int?aid = ActionManager.ExecuteAction(new ActionModel() { Database = db, ActionID = -1, Event = ActionModelEvent.Default, Msisdn = input.msisdn, Email = input.email, prelander = input.prelander, PrelanderType = input.type, device_mf = input.device_mf, device_model = input.device_model, device_os = input.device_os, carrier = input.carrier, isp = input.isp, countryCode = input.countryCode, ipAddress = input.ipAddress, host = input.host, request = input.request, referrer = input.referrer }); if (!aid.HasValue) { return(this.Result(false, "error", null)); } db.Transactional.Run(); return(this.Redirect(redirect + "&aid=" + aid.Value)); }
public async Task <int?> Get(CCSubmitDirect db, string input) { input = input.ToLower(); if (string.IsNullOrEmpty(input)) { return(null); } if (_data.ContainsKey(input)) { return(_data[input].ID); } DirectContainer dc = await db.LoadContainerAsync(string.Format("SELECT countryid, name, code FROM [].tm_country WHERE name LIKE '%{0}%' OR code='{0}';", input)); if (!dc.HasValue) { return(null); } CountryCacheModel country = new CountryCacheModel() { ID = dc.GetInt("countryid").Value, Name = dc.GetString("name").ToLower(), Code = dc.GetString("code").ToLower() }; if (!_data.ContainsKey(country.Code)) { _data.Add(country.Code, country); } if (!_data.ContainsKey(country.Name)) { _data.Add(country.Name, country); } db.TransactionalManager.Add("INSERT INTO [].tm_country_used (countryid)", dc.GetInt("countryid").Value); return(dc.GetInt("countryid").Value); }
public static SessionDataDM GetSessionData(CCSubmitDirect database, string ip, string useragent) { return(null); //var result = Get(ip, useragent); //return new SessionDataDM(database) //{ // countryCode = result.countryCode, // countryName = result.countryName, // IDDCode = result.IDDCode, // region = result.region, // city = result.city, // elevation = result.elevation, // zipCode = result.zipCode, // areaCode = result.areaCode, // timezone = result.timezone, // ISP = result.ISP, // domainName = result.domainName, // weatherStationCode = result.weatherStationCode, // weatherStationName = result.weatherStationName, // mobileBrand = result.mobileBrand, // MCC = result.MCC, // MNC = result.MNC, // ipVersion = result.ipVersion, // latitude = result.latitude, // longitude = result.longitude, // deviceType = result.deviceType, // hardwareVendor = result.hardwareVendor, // hardwareFamily = result.hardwareFamily, // hardwareModel = result.hardwareModel, // hardwareName = result.hardwareName, // platformName = result.platformName, // platformVersion = result.platformVersion, // browserName = result.browserName, // browserVersion = result.browserVersion, // screenPixelsWidth = result.screenPixelsWidth, // screenPixelsHeight = result.screenPixelsHeight //}; }