/// <summary> /// call this when a user lands on the Referal Page /// </summary> /// <param name="context"></param> public static bool ProcessReferalFromInviteClickID(HttpContext context) { try { string WebInviteClickID = (string)context.Items["encryptedparams"]; InviteClick inviteClick = InviteClick.GetInviteClickByWebInviteClickID(WebInviteClickID); Referral Refer = new Referral(); Refer.ContactImportID = inviteClick.ContactImportID; Refer.ForwardURL = inviteClick.ForwardURL; Refer.ReferralType = (int)ReferrerType.ContactImportID; Refer.Save(); ContactImport contactImport = new ContactImport(inviteClick.ContactImportID); contactImport.ClickedEmailInvite = true; contactImport.Save(); context.Session["Referral"] = Refer; context.Response.Redirect(Refer.ForwardURL); return(true); } catch { } return(false); }
/// <summary> /// once the user has signed up, this methods determines if the user is a referal and updates the Referral table /// </summary> /// <param name="context"></param> /// <param name="MemberID"></param> public static int ProcessSignupFromReferral(HttpContext context, int MemberID) { try { Referral Refer = (Referral)context.Session["Referral"]; if (Refer != null) { Refer.BecameMemberID = MemberID; Refer.Save(); if (Refer.ReferralType == (int)ReferrerType.ContactImportID) { ContactImport contactImport = new ContactImport(Refer.ContactImportID); contactImport.BecameMemberID = MemberID; contactImport.Save(); return(Refer.ContactImportID); } } } catch { } return(0); }
/// <summary> /// call this when a user lands on the Referal Page /// </summary> /// <param name="context"></param> public static bool ProcessReferal(HttpContext context) { string DecryptString = (string)context.Items["encryptedparams"]; DecryptString = DecryptString.Replace("xxyyxx12345", @"/"); DecryptString = DecryptString.Replace("12345xxyyxx", @"\"); //DecryptString = System.Web.HttpUtility.UrlDecode(DecryptString); Referral Refer = null; //try //{ DecryptString = RijndaelEncryption.Decrypt(DecryptString); string[] Parts = DecryptString.Split(new char[] { ':' }); ReferrerType RType = (ReferrerType)Int32.Parse(Parts[0]); int ID = Int32.Parse(Parts[1]); string ForwardURL = Parts[2]; Refer = new Referral(); Refer.ReferralType = (int)RType; if (Refer.ReferralType == (int)ReferrerType.CampaignID) { Refer.CampaignID = ID; Refer.ReferrerMemberID = 0; Refer.ContactImportID = 0; } else if (Refer.ReferralType == (int)ReferrerType.MemberID) { Refer.CampaignID = 0; Refer.ReferrerMemberID = ID; Refer.ContactImportID = 0; } else if (Refer.ReferralType == (int)ReferrerType.ContactImportID) { Refer.CampaignID = 0; Refer.ReferrerMemberID = 0; Refer.ContactImportID = ID; } Refer.Save(); Refer.ForwardURL = ForwardURL; context.Session["Referral"] = Refer; context.Response.Redirect(Refer.ForwardURL); return true; //} //catch { } //return false; }
/// <summary> /// call this when a user lands on the Referal Page /// </summary> /// <param name="context"></param> public static bool ProcessReferal(HttpContext context) { string DecryptString = (string)context.Items["encryptedparams"]; DecryptString = DecryptString.Replace("xxyyxx12345", @"/"); DecryptString = DecryptString.Replace("12345xxyyxx", @"\"); //DecryptString = System.Web.HttpUtility.UrlDecode(DecryptString); Referral Refer = null; //try //{ DecryptString = RijndaelEncryption.Decrypt(DecryptString); string[] Parts = DecryptString.Split(new char[] { ':' }); ReferrerType RType = (ReferrerType)Int32.Parse(Parts[0]); int ID = Int32.Parse(Parts[1]); string ForwardURL = Parts[2]; Refer = new Referral(); Refer.ReferralType = (int)RType; if (Refer.ReferralType == (int)ReferrerType.CampaignID) { Refer.CampaignID = ID; Refer.ReferrerMemberID = 0; Refer.ContactImportID = 0; } else if (Refer.ReferralType == (int)ReferrerType.MemberID) { Refer.CampaignID = 0; Refer.ReferrerMemberID = ID; Refer.ContactImportID = 0; } else if (Refer.ReferralType == (int)ReferrerType.ContactImportID) { Refer.CampaignID = 0; Refer.ReferrerMemberID = 0; Refer.ContactImportID = ID; } Refer.Save(); Refer.ForwardURL = ForwardURL; context.Session["Referral"] = Refer; context.Response.Redirect(Refer.ForwardURL); return(true); //} //catch { } //return false; }
/// <summary> /// once the user has signed up, this methods determines if the user is a referal and updates the Referral table /// </summary> /// <param name="context"></param> /// <param name="MemberID"></param> public static string GetEmailReferrer(HttpContext context) { try { Referral Refer = (Referral)context.Session["Referral"]; if (Refer != null) { ContactImport contactImport = new ContactImport(Refer.ContactImportID); if (contactImport != null) { Member ReferrerMember = new Member(contactImport.ImporterMemberID); return(ReferrerMember.Email); } } } catch { } return(string.Empty); }
/// <summary> /// Takes an prepopulated IDataReader and creates an array of Referrals /// </summary> public static List<Referral> PopulateObject(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<Referral> arr = new List<Referral>(); Referral obj; while (dr.Read()) { obj = new Referral(); if (list.IsColumnPresent("ReferralID")) { obj._referralID = (int)dr["ReferralID"]; } if (list.IsColumnPresent("ReferralType")) { obj._referralType = (int)dr["ReferralType"]; } if (list.IsColumnPresent("BecameMemberID")) { obj._becameMemberID = (int)dr["BecameMemberID"]; } if (list.IsColumnPresent("ReferrerMemberID")) { obj._referrerMemberID = (int)dr["ReferrerMemberID"]; } if (list.IsColumnPresent("ContactImportID")) { obj._contactImportID = (int)dr["ContactImportID"]; } if (list.IsColumnPresent("CampaignID")) { obj._campaignID = (int)dr["CampaignID"]; } if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; } arr.Add(obj); } dr.Close(); return arr; }
/// <summary> /// call this when a user lands on the Referal Page /// </summary> /// <param name="context"></param> public static bool ProcessReferalFromInviteClickID(HttpContext context) { try { string WebInviteClickID = (string)context.Items["encryptedparams"]; InviteClick inviteClick = InviteClick.GetInviteClickByWebInviteClickID(WebInviteClickID); Referral Refer = new Referral(); Refer.ContactImportID = inviteClick.ContactImportID; Refer.ForwardURL = inviteClick.ForwardURL; Refer.ReferralType = (int)ReferrerType.ContactImportID; Refer.Save(); ContactImport contactImport = new ContactImport(inviteClick.ContactImportID); contactImport.ClickedEmailInvite = true; contactImport.Save(); context.Session["Referral"] = Refer; context.Response.Redirect(Refer.ForwardURL); return true; } catch { } return false; }