예제 #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                var    encEmail    = aesMgr.EncryptToString(dfnLoginEmail.Text);
                var    encPassword = aesMgr.EncryptToString(dfnLoginPass.Text);
                string baseUrl     = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";

                int    custId;
                string custUsername;
                bool   checkoutEligible;

                if (loginMgr.ValidateLogin(encEmail, encPassword, out custId, out custUsername, out checkoutEligible))
                {
                    regErrorBox.Visible = false;

                    Session.Add(CommonManager.GetCustIdSessionName(), custId);
                    Session.Add(CommonManager.GetCustNameSessionName(), custUsername);
                    Session.Add(CommonManager.GetCustEmailSessionName(), dfnLoginEmail.Text);
                    Session.Add(CommonManager.GetCheckoutEligibleSessionName(), checkoutEligible);

                    Response.Redirect(baseUrl + "Default.aspx");
                }
            }
            catch (Exception ex)
            {
                regErrMsg.InnerText = ex.Message;
                regErrorBox.Visible = true;
            }
        }
예제 #2
0
        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            try
            {
                var encEmail       = aesMgr.EncryptToString(Session[CommonManager.GetCustEmailSessionName()].ToString());
                var encOldPassword = aesMgr.EncryptToString(dfOldPass.Text);
                var encNewPassword = aesMgr.EncryptToString(dfNewPass.Text);

                custMgr.ResetPassword(encEmail, encNewPassword, encOldPassword);

                regSuccessBox.Visible = true;
                regErrorBox.Visible   = false;
            }
            catch (Exception ex)
            {
                regErrMsg.InnerText   = ex.Message;
                regSuccessBox.Visible = false;
                regErrorBox.Visible   = true;
            }
        }
        private void LoadCurrentDetails()
        {
            var email       = Session[CommonManager.GetCustEmailSessionName()].ToString();
            var custDetails = custMgr.GetCustomerDetails(CustomerGetType.email, 0, aesMgr.EncryptToString(email));

            if (custDetails != null)
            {
                var customer = custDetails.First();
                txtName.InnerText   = customer.name;
                txtEmail.InnerText  = email;
                txAddress.InnerHtml = customer.addressLine1 + ",<br/>" + customer.addressLine2 + ",<br/>" + customer.city;
            }
        }
예제 #4
0
        protected void btnRegCreateAccount_Click(object sender, EventArgs e)
        {
            try
            {
                var encrEmail    = aesMgr.EncryptToString(dfnRegEmail.Text);
                var encrPassword = aesMgr.EncryptToString(dfnRegPass.Text);
                var username     = dfnRegUsername.Text;

                loginMgr.RegisterUser(encrEmail, username, encrPassword);
                string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";
                emailMgr.SendActivationEmail(encrEmail, username, baseUrl);

                regSuccessBox.Visible = true;
                regErrorBox.Visible   = false;
            }
            catch (Exception ex)
            {
                regErrMsg.InnerText   = ex.Message;
                regSuccessBox.Visible = false;
                regErrorBox.Visible   = true;
            }
        }
예제 #5
0
        protected void btnResetPasswordEmail_Click(object sender, EventArgs e)
        {
            try
            {
                var    encEmail = aesMgr.EncryptToString(dfnResetEmail.Text);
                string baseUrl  = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";
                string custUsername;
                if (loginMgr.ValidateEmail(encEmail, out custUsername))
                {
                    emailMgr.SendResetPasswordEmail(emailMgr.GetEmailingCode(encEmail), custUsername, baseUrl);
                }

                regSuccessBoxEmail.Visible    = true;
                regSuccessBoxPassword.Visible = false;
                regErrorBox.Visible           = false;
            }
            catch (Exception ex)
            {
                regErrMsg.InnerText           = ex.Message;
                regSuccessBoxEmail.Visible    = false;
                regSuccessBoxPassword.Visible = false;
                regErrorBox.Visible           = true;
            }
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                var id    = Convert.ToInt32(Session[CommonManager.GetCustIdSessionName()]);
                var email = Session[CommonManager.GetCustEmailSessionName()].ToString();

                custMgr.UpdateUserData(id, aesMgr.EncryptToString(email), dfName.Value, dfTelephone.Value, dfAddLine1.Value + "|" + dfAddLine2.Value + "|" + cmbCity.Value);

                regErrorBox.Visible = false;
            }
            catch (Exception ex)
            {
                regErrMsg.InnerText = ex.Message;
                regErrorBox.Visible = true;
            }
        }
예제 #7
0
 void LoadCurrentDetails()
 {
     try
     {
         var email       = Session[CommonManager.GetCustEmailSessionName()].ToString();
         var custDetails = custMgr.GetCustomerDetails(CustomerGetType.email, 0, aesMgr.EncryptToString(email));
         if (custDetails != null)
         {
             var customer = custDetails.First();
             dfName.Value      = customer.name;
             dfAddLine1.Value  = customer.addressLine1;
             dfAddLine2.Value  = customer.addressLine2;
             cmbCity.Value     = customer.city;
             dfTelephone.Value = customer.telephoneNo;
         }
     }
     catch (Exception ex)
     {
         regErrMsg.InnerText   = ex.Message;
         regSuccessBox.Visible = false;
         regErrorBox.Visible   = true;
     }
 }