Exemplo n.º 1
0
        protected void ProfileSubmitButtonClick(object sender, EventArgs e)
        {
            var client  = new EyeWebServiceClient();
            var addList = new List <Address>();

            var newUser = new user();

            if (txtHomeStreetName.Text != "")
            {
                var add = new Address
                {
                    addressType = "Home",
                    streetName  = txtHomeStreetName.Text,
                    city        = txtHomeCity.Text,
                    stateName   = txtHomeState.Text,
                    country     = txtHomeCountry.Text,
                    zipcode     = txtHomeZip.Text,
                    phoneNo     = txtHomePhoneNumber.Text
                };
                addList.Add(add);
            }

            if (txtOFCStreetName.Text != "")
            {
                var add1 = new Address
                {
                    addressType = "Office",
                    streetName  = txtOFCStreetName.Text,
                    city        = txtOFCCity.Text,
                    stateName   = txtOFCState.Text,
                    country     = txtOFCCountry.Text,
                    zipcode     = txtOFCZip.Text,
                    phoneNo     = txtOFCPhoneNumber.Text
                };
                addList.Add(add1);
            }

            if (HttpContext.Current.Session["userId"] != null)
            {
                newUser.userId = int.Parse(HttpContext.Current.Session["userId"].ToString());
            }
            newUser.firstName   = txtFName.Text;
            newUser.lastName    = txtLName.Text;
            newUser.dob         = txtDOB.Text;
            newUser.gender      = ddlGender.SelectedValue;
            newUser.userTypeId  = int.Parse(ddlUserType.SelectedValue);
            newUser.loginId     = HttpContext.Current.Session["loginId"].ToString();
            newUser.addressList = addList;

            var success = client.SetProfile(newUser);

            if (success)
            {
                HttpContext.Current.Session["userId"]     = client.GetUserId(newUser.loginId);
                HttpContext.Current.Session["userTypeId"] = newUser.userTypeId;
                IdentityHelper.RedirectToReturnUrl(
                    newUser.userTypeId == 1 ? "~/ProviderHomePage.aspx" : "~/ParentHomePage.aspx", Response);
            }
        }
Exemplo n.º 2
0
        protected void LogIn(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // Validate the user password
                var manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var signinManager = Context.GetOwinContext().GetUserManager <ApplicationSignInManager>();

                // This doen't count login failures towards account lockout
                // To enable password failures to trigger lockout, change to shouldLockout: true
                var result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, false);

                switch (result)
                {
                case SignInStatus.Success:
                    var client = new EyeWebServiceClient();
                    HttpContext.Current.Session["loginId"]    = signinManager.UserManager.FindByEmail(Email.Text).Id;
                    HttpContext.Current.Session["userId"]     = client.GetUserId(HttpContext.Current.Session["loginId"].ToString());
                    HttpContext.Current.Session["userTypeId"] = client.GetUserTypeId(int.Parse(HttpContext.Current.Session["userId"].ToString()));

                    if (int.Parse(HttpContext.Current.Session["userTypeId"].ToString()) == 1)
                    {
                        IdentityHelper.RedirectToReturnUrl("~/ProviderHomePage.aspx", Response);
                    }
                    else
                    {
                        IdentityHelper.RedirectToReturnUrl("~/ParentHomePage.aspx", Response);
                    }

                    break;

                case SignInStatus.LockedOut:
                    Response.Redirect("/Account/Lockout");
                    break;

                case SignInStatus.RequiresVerification:
                    Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}",
                                                    Request.QueryString["ReturnUrl"],
                                                    RememberMe.Checked),
                                      true);
                    break;

                case SignInStatus.Failure:
                default:
                    FailureText.Text     = "Invalid login attempt";
                    ErrorMessage.Visible = true;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        protected void LogIn(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // Validate the user password
                var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
                var signinManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();

                // This doen't count login failures towards account lockout
                // To enable password failures to trigger lockout, change to shouldLockout: true
                var result = signinManager.PasswordSignIn(Email.Text, Password.Text, RememberMe.Checked, false);

                switch (result)
                {
                        
                    case SignInStatus.Success:
                        var client = new EyeWebServiceClient();
                        HttpContext.Current.Session["loginId"] = signinManager.UserManager.FindByEmail(Email.Text).Id;
                        HttpContext.Current.Session["userId"] = client.GetUserId(HttpContext.Current.Session["loginId"].ToString());
                        HttpContext.Current.Session["userTypeId"] = client.GetUserTypeId(int.Parse(HttpContext.Current.Session["userId"].ToString()));

                        if (int.Parse(HttpContext.Current.Session["userTypeId"].ToString()) == 1)
                            IdentityHelper.RedirectToReturnUrl("~/ProviderHomePage.aspx", Response);
                        else
                            IdentityHelper.RedirectToReturnUrl("~/ParentHomePage.aspx", Response);

                        break;
                    case SignInStatus.LockedOut:
                        Response.Redirect("/Account/Lockout");
                        break;
                    case SignInStatus.RequiresVerification:
                        Response.Redirect(String.Format("/Account/TwoFactorAuthenticationSignIn?ReturnUrl={0}&RememberMe={1}", 
                                                        Request.QueryString["ReturnUrl"],
                                                        RememberMe.Checked),
                                          true);
                        break;
                    case SignInStatus.Failure:
                    default:
                        FailureText.Text = "Invalid login attempt";
                        ErrorMessage.Visible = true;
                        break;
                }
            }
        }
Exemplo n.º 4
0
        protected void ProfileSubmitButtonClick(object sender, EventArgs e)
        {
            var client = new EyeWebServiceClient();
            var addList = new List<Address>();
          
            var newUser = new user();

            if (txtHomeStreetName.Text!="")
            {
                var add = new Address
                {
                    addressType = "Home",
                    streetName = txtHomeStreetName.Text,
                    city = txtHomeCity.Text,
                    stateName = txtHomeState.Text,
                    country = txtHomeCountry.Text,
                    zipcode = txtHomeZip.Text,
                    phoneNo = txtHomePhoneNumber.Text
                };
                addList.Add(add);
            }

            if (txtOFCStreetName.Text != "")
            {
                var add1 = new Address
                {
                    addressType ="Office",
                    streetName = txtOFCStreetName.Text,
                    city = txtOFCCity.Text,
                    stateName = txtOFCState.Text,
                    country = txtOFCCountry.Text,
                    zipcode = txtOFCZip.Text,
                    phoneNo = txtOFCPhoneNumber.Text
                };
                addList.Add(add1);
            }
            if (HttpContext.Current.Session["userId"] != null)
                newUser.userId = int.Parse(HttpContext.Current.Session["userId"].ToString());

            newUser.firstName = txtFName.Text;
            newUser.lastName = txtLName.Text;
            newUser.dob = txtDOB.Text;
            newUser.gender = ddlGender.SelectedValue;
            newUser.userTypeId = int.Parse(ddlUserType.SelectedValue);
            newUser.loginId = HttpContext.Current.Session["loginId"].ToString();
            newUser.addressList = addList;

            var success = client.SetProfile(newUser);

            if (success)
            {
                HttpContext.Current.Session["userId"] = client.GetUserId(newUser.loginId);
                HttpContext.Current.Session["userTypeId"] = newUser.userTypeId;

               // IdentityHelper.RedirectToReturnUrl(
                  //  newUser.userTypeId == 1 ? "~/ProviderHomePage.aspx" : "~/ParentHomePage.aspx", Response);
                PopulateFields();
                SetVisibility(false);
            }
        }