Example #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);
        }
Example #2
0
        /// <summary>
        /// Get an InviteClick by WebID
        /// </summary>
        /// <param name="WebInviteClickID">The WebID associated to the Click</param>
        /// <returns>A Single InviteClick object</returns>
        public static InviteClick GetInviteClickByWebInviteClickID(string WebInviteClickID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_GetInviteClickByInviteClickID");

            db.AddInParameter(dbCommand, "WebInviteClickID", DbType.String, WebInviteClickID);

            InviteClick inviteClick = null;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                ColumnFieldList list = new ColumnFieldList(dr);

                if (dr.Read())
                {
                    inviteClick = new InviteClick();

                    if (list.IsColumnPresent("InviteClickID"))
                    {
                        inviteClick._inviteClickID = (int)dr["InviteClickID"];
                    }
                    if (list.IsColumnPresent("WebInviteClickID"))
                    {
                        inviteClick._webInviteClickID = (string)dr["WebInviteClickID"];
                    }
                    if (list.IsColumnPresent("ForwardURL"))
                    {
                        inviteClick._forwardURL = (string)dr["ForwardURL"];
                    }
                    if (list.IsColumnPresent("ContactImportID"))
                    {
                        inviteClick._contactImportID = (int)dr["ContactImportID"];
                    }
                }
                else
                {
                    throw new ArgumentException(String.Format(Properties.Resources.Argument_InvalidWebInviteClickID, WebInviteClickID));
                }

                dr.Close();
            }

            return(inviteClick);
        }
Example #3
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of InviteClicks
        /// </summary>
        public static List<InviteClick> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

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

            InviteClick obj;

            while (dr.Read())
            {
                obj = new InviteClick();
                if (list.IsColumnPresent("InviteClickID")) { obj._inviteClickID = (int)dr["InviteClickID"]; }
                if (list.IsColumnPresent("WebInviteClickID")) { obj._webInviteClickID = (string)dr["WebInviteClickID"]; }
                if (list.IsColumnPresent("ForwardURL")) { obj._forwardURL = (string)dr["ForwardURL"]; }
                if (list.IsColumnPresent("ContactImportID")) { obj._contactImportID = (int)dr["ContactImportID"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }