Example #1
0
        public static string CreateNewUser(string firstName, string lastName, string jobTitle, string email, string company, string title, string frimAum, string firmType)
        {
            string rtnVal = string.Empty;

            var proxy = new BusinessProxy();

            try
            {
                //GenerateJqueryErrorForTesting();

                string emailExistenceRtnVal = proxy.CheckEmailExistence(email);

                if (emailExistenceRtnVal != "1")
                {
                    rtnVal = proxy.CreateUser(firstName, lastName, jobTitle, email, company, GetIPAddress(), title, frimAum, firmType);
                }
                else
                {
                    // user already exists. login straight away! - no need to add the record
                    rtnVal = "1";
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(rtnVal);
        }
        public void CreateUserLocally(string firstName, string lastName, string jobTitle, string email, string firmName, string title, string firmAum, string firmType)
        {
            var proxy = new BusinessProxy();

            string emailExistenceRtnVal = proxy.CheckEmailExistence(email);

            if (emailExistenceRtnVal != "1")
            {
                string prospectId = proxy.CreateUser(firstName, lastName, jobTitle, email, firmName, GetIPAddress(), title, firmAum, firmType);

                if (prospectId != "-1")
                {
                    HttpCookie cookie = Request.Cookies["cookieastpub"];
                    string     userId = Server.HtmlEncode(cookie.Value);

                    proxy.LinkUserCookie(Guid.Parse(userId), Guid.Parse(prospectId));
                }
            }
        }
Example #3
0
        public static string CreateNewUser(string firstName, string lastName, string jobTitle, string email, string firmName, string title, string frimAum, string firmType)
        {
            string rtnVal = string.Empty;

            var proxy = new BusinessProxy();

            try
            {
                string emailExistenceRtnVal = proxy.CheckEmailExistence(email);

                if (emailExistenceRtnVal != "1")
                {
                    rtnVal = proxy.CreateUser(firstName, lastName, jobTitle, email, firmName, GetIPAddress(), title, frimAum, firmType);

                    // hubspot registration
                    CreateNewContactInHubSpot(firstName, lastName, jobTitle, email, firmName, title, frimAum, firmType);

                    // send email on client registration
                    SendEmailOnClientRegistration(email);
                }
                else
                {
                    // user already exists. login straight away! - no need to add the record
                    rtnVal = "1";
                }

                // if user is exists, add user to session
                if (rtnVal == "1")
                {
                    string jsonEntUser = proxy.GetUserDetailsByEmail(email);

                    JArray userObjects = JArray.Parse(jsonEntUser);

                    // add session
                    foreach (var userObject in userObjects)
                    {
                        HttpContext.Current.Session["UserId"] = userObject["Id"].ToString();
                        HttpContext.Current.Session["Email"]  = userObject["Email"].ToString();
                        HttpContext.Current.Session["Name"]   = userObject["FirstName"].ToString();

                        break;
                    }

                    // add cookie
                    string cookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

                    HttpCookie myCookie = new HttpCookie(cookieName);
                    myCookie.Value   = email;
                    myCookie.Expires = DateTime.Now.AddDays(365d);
                    HttpContext.Current.Response.Cookies.Add(myCookie);

                    HttpCookie newCookie = new HttpCookie(cookieName);
                    newCookie = HttpContext.Current.Request.Cookies[cookieName];
                    string cookieValue = newCookie.Value;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return(rtnVal);
        }