예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        public static List <ContactImport> PopulateContactImport(IDataReader dr)
        {
            List <ContactImport> arr = new List <ContactImport>();

            ContactImport contactImport;

            while (dr.Read())
            {
                contactImport             = new ContactImport();
                contactImport.Email       = (string)dr["Email"];
                contactImport.FriendState = (int)dr["FriendState"];
                contactImport.InviteState = (int)dr["InviteState"];

                arr.Add(contactImport);
            }

            dr.Close();

            return(arr);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of ContactImports
        /// </summary>
        public static List<ContactImport> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<ContactImport> arr = new List<ContactImport>();

            ContactImport obj;

            while (dr.Read())
            {
                obj = new ContactImport();
                if (list.IsColumnPresent("ContactImportID")) { obj._contactImportID = (int)dr["ContactImportID"]; }
                if (list.IsColumnPresent("ImporterMemberID")) { obj._importerMemberID = (int)dr["ImporterMemberID"]; }
                if (list.IsColumnPresent("Email")) { obj._email = (string)dr["Email"]; }
                if (list.IsColumnPresent("Name")) { obj._name = (string)dr["Name"]; }
                if (list.IsColumnPresent("InviteState")) { obj._inviteState = (int)dr["InviteState"]; }
                if (list.IsColumnPresent("FriendState")) { obj._friendState = (int)dr["FriendState"]; }
                if (list.IsColumnPresent("OpenedEmailInvite")) { obj._openedEmailInvite = (bool)dr["OpenedEmailInvite"]; }
                if (list.IsColumnPresent("ClickedEmailInvite")) { obj._clickedEmailInvite = (bool)dr["ClickedEmailInvite"]; }
                if (list.IsColumnPresent("JoinedFromInvite")) { obj._joinedFromInvite = (bool)dr["JoinedFromInvite"]; }
                if (list.IsColumnPresent("BecameMemberID")) { obj._becameMemberID = (int)dr["BecameMemberID"]; }
                if (list.IsColumnPresent("ImportToken")) { obj._importToken = (string)dr["ImportToken"]; }
                if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
예제 #6
0
        protected void btnWebMailLogin_Click(object sender, System.EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(ImportEmails));

            member = (Member)Session["Member"];

            if (member == null)
            {
                Response.Redirect("/signup");
            }

            if (this.txtUserID.Text == "" || this.txtPassword.Text == "")
                return;

            Regex isNumeric = new Regex(@"^\d+$");

            //strip email address
            string Login = txtUserID.Text;

            int AtSignIndex = Login.IndexOf("@");

            if (AtSignIndex > 0)
            {
                if (emailCat.SelectedValue.ToLower() != "linkedin.com")
                {
                    Login = Login.Substring(0, AtSignIndex);
                }
            }

            DateTime start = DateTime.Now;

            contactImporter = new ContactImporter(Login, txtPassword.Text, emailCat.SelectedValue);

            contactImporter.login();

            LoginOkay = contactImporter.logged_in;

            if (LoginOkay)
            {
                try
                {
                    contactImporter.getcontacts();
                    fetch = DateTime.Now - start;
                }
                catch { }

                this.nameArray = contactImporter.nameArray;
                this.emailArray = contactImporter.emailArray;

                for (int i = 0; i < emailArray.Length; i++)
                {
                    emailArray[i] = emailArray[i].ToLower();
                }

                string ImportToken = Next2Friends.Misc.UniqueID.NewWebID();

                //insert into the db so they can be referenced by JoinEmailsWithMembers
                for (int i = 0; i < emailArray.Length; i++)
                {
                    ContactImport contact = new ContactImport();

                    contact.WebID = Next2Friends.Misc.UniqueID.NewWebID();
                    contact.ImporterMemberID = member.MemberID;
                    contact.Email = emailArray[i];
                    contact.Name = nameArray[i];
                    contact.FriendState = (int)FriendState.None;
                    contact.InviteState = (int)InviteState.None;
                    contact.ImportToken = ImportToken;
                    contact.IsInitialImport = 1;

                    contact.SaveWithCheck();
                }

                FullContacts = new List<ContactImport>();
                List<ContactImport> MemberList = new List<ContactImport>();

                //List<ContactImport> ExistingContactList = ContactImport.GetAllContactImportByMemberID(member.MemberID);

                if (emailArray.Length > 0)
                {
                    MemberList = ContactImport.JoinEmailsWithMembers(member.MemberID, emailArray, ImportToken);
                }

                List<Member> FriendList = Member.GetAllFriendsByMemberID(member.MemberID);

                for (int i = 0; i < emailArray.Length; i++)
                {
                    int friendState = (int)FriendState.None;
                    int inviteState = (int)InviteState.None;

                    ContactImport Associcate = MemberList.FirstOrDefault(f => f.Email == emailArray[i]);

                    if (Associcate != null)
                    {
                        friendState = Associcate.FriendState;
                        inviteState = Associcate.InviteState;
                    }

                    ContactImport contact = new ContactImport();

                    contact.WebID = Next2Friends.Misc.UniqueID.NewWebID();
                    contact.ImporterMemberID = member.MemberID;
                    contact.Email = emailArray[i];
                    contact.Name = nameArray[i];
                    contact.FriendState = friendState;
                    contact.InviteState = inviteState;

                    FullContacts.Add(contact);
                }

                var sortedContacts =
                    from c in FullContacts
                    where c.Email != string.Empty
                    orderby c.Name
                    select c;

                FullContacts = sortedContacts.ToList();

                Imported = true;
                ImportCount = FullContacts.Count;

                Session["Contacts"] = FullContacts;

                BuildContactList();

                ImportStage = true;

                HelperMessage = "<p style='color:#0257AE'>You may now choose your contacts to invite</p>";
                
            }
            else
            {
                BuildLetterIndexList();
                Session["Contacts"] = null;
                HelperMessage = "<p style='color:red;'>Login details are incorrect, please try again</p>";
            }
        }
예제 #7
0
        /// <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;
        }
예제 #8
0
        /// <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;
        }
예제 #9
0
        /// <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;
        }