예제 #1
0
 protected void btnChangeAdminPassword_Click(object sender, EventArgs e)
 {
     if (rfvPassword.IsValid && cvPasswords.IsValid)
     {
         CustomerService.ChangePassword("835d82df-aaa6-4d54-a870-8d353e541af9", txtPassword.Text, false);
         AuthorizeService.AuthorizeTheUser("admin", txtPassword.Text, false);
     }
 }
예제 #2
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (!DataValidation())
        {
            return;
        }

        lblMessage.Visible = false;

        CustomerService.InsertNewCustomer(new Customer
        {
            CustomerGroupId   = CustomerGroupService.DefaultCustomerGroup,
            Password          = HttpUtility.HtmlEncode(txtPassword.Text),
            FirstName         = HttpUtility.HtmlEncode(txtFirstName.Text),
            LastName          = HttpUtility.HtmlEncode(txtLastName.Text),
            Phone             = HttpUtility.HtmlEncode(txtPhone.Text),
            SubscribedForNews = chkSubscribed4News.Checked,
            EMail             = HttpUtility.HtmlEncode(txtEmail.Text),
            CustomerRole      = Role.User
        });

        AuthorizeService.AuthorizeTheUser(txtEmail.Text, txtPassword.Text, false);

        //------------------------------------------

        var clsParam = new ClsMailParamOnRegistration
        {
            FirstName = HttpUtility.HtmlEncode(txtFirstName.Text),
            LastName  = HttpUtility.HtmlEncode(txtLastName.Text),
            RegDate   = AdvantShop.Localization.Culture.ConvertDate(DateTime.Now),
            Password  = HttpUtility.HtmlEncode(txtPassword.Text),
            Subsrcibe = chkSubscribed4News.Checked
                                               ? Resource.Client_Registration_Yes
                                               : Resource.Client_Registration_No,
            ShopURL = SettingsMain.SiteUrl
        };

        string message = SendMail.BuildMail(clsParam);

        if (CustomerSession.CurrentCustomer.IsVirtual)
        {
            ShowMessage(Notify.NotifyType.Error, Resource.Client_Registration_Whom + txtEmail.Text + '\r' + Resource.Client_Registration_Text + message);
        }
        else
        {
            SendMail.SendMailNow(txtEmail.Text,
                                 SettingsMain.SiteUrl + " - " +
                                 string.Format(Resource.Client_Registration_RegSuccessful, txtEmail.Text),
                                 message, true);
            SendMail.SendMailNow(SettingsMail.EmailForRegReport,
                                 SettingsMain.SiteUrl + " - " +
                                 string.Format(Resource.Client_Registration_RegSuccessful, txtEmail.Text),
                                 message, true);
        }

        Response.Redirect("myaccount.aspx");
    }
 protected void btnChangePassword_Click(object sender, EventArgs e)
 {
     if (ValidateFormData())
     {
         CustomerService.ChangePassword(CustomerSession.CurrentCustomer.Id.ToString(), txtNewPassword.Text, false);
         var customer = CustomerSession.CurrentCustomer;
         AuthorizeService.AuthorizeTheUser(customer.EMail, customer.Password, true);
         ((AdvantShopPage)this.Page).ShowMessage(Notify.NotifyType.Notice, Resource.Client_MyAccount_PasswordSaved);
         txtNewPassword.Text        = string.Empty;
         txtNewPasswordConfirm.Text = string.Empty;
     }
     //Response.Redirect("myaccount.aspx#tabid=changepassword");
 }
예제 #4
0
 protected void lbLoginAsAdmin_Click(object sender, EventArgs e)
 {
     if (Demo.IsDemoEnabled || Trial.IsTrialEnabled)
     {
         CustomerSession.CreateAnonymousCustomerGuid();
         AuthorizeService.DeleteCookie();
         var customer = CustomerService.GetCustomerByEmail("admin");
         if (customer != null)
         {
             AuthorizeService.AuthorizeTheUser(customer.EMail, customer.Password, true);
             Response.Redirect("~/Admin/default.aspx");
         }
     }
 }
예제 #5
0
    protected void btnAuthGO_Click(object sender, EventArgs e)
    {
        if (!ValidateFormData())
        {
            return;
        }

        if (!AuthorizeService.AuthorizeTheUser(txtAuthLogin.Text, txtAuthPWD.Text, false))
        {
            ((AdvantShopPage)this.Page).ShowMessage(Notify.NotifyType.Error, Resource.Client_MasterPage_WrongPassword);
            txtAuthPWD.Text = string.Empty;
        }
        else
        {
            OnNextStep(new ZeroStepNextEventArgs {
                UserType = EnUserType.RegistredUser
            });
        }
    }
예제 #6
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtEmail.Text.Trim()) || string.IsNullOrEmpty(txtPassword.Text.Trim()) || !AuthorizeService.AuthorizeTheUser(txtEmail.Text, txtPassword.Text, false))
     {
         ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_MasterPage_WrongPassword);
     }
     else
     {
         Response.Redirect("~/");
     }
 }
예제 #7
0
    private void RegistrationNow()
    {
        try
        {
            if (CustomerService.CheckCustomerExist(PageData.OrderConfirmationData.Customer.EMail))
            {
                ShowMessage(Notify.NotifyType.Error, Resource.Client_Registration_CustomerExist);
            }


            Guid id = CustomerService.InsertNewCustomer(new Customer
            {
                CustomerGroupId   = CustomerGroupService.DefaultCustomerGroup,
                Password          = PageData.OrderConfirmationData.Customer.Password,
                FirstName         = PageData.OrderConfirmationData.Customer.FirstName,
                LastName          = PageData.OrderConfirmationData.Customer.LastName,
                Phone             = PageData.OrderConfirmationData.Customer.Phone,
                SubscribedForNews = false,
                EMail             = PageData.OrderConfirmationData.Customer.EMail,
                CustomerRole      = Role.User
            });

            if (id == Guid.Empty)
            {
                return;
            }
            PageData.OrderConfirmationData.Customer.Id = id;

            AuthorizeService.AuthorizeTheUser(PageData.OrderConfirmationData.Customer.EMail, PageData.OrderConfirmationData.Customer.Password, false);

            // Shipping contact -----------------------------
            var newContact = PageData.OrderConfirmationData.ShippingContact;
            CustomerService.AddContact(newContact, PageData.OrderConfirmationData.Customer.Id);

            // Billing contact ---------------------------
            if (!PageData.OrderConfirmationData.BillingIsShipping)
            {
                newContact = PageData.OrderConfirmationData.BillingContact;
                CustomerService.AddContact(newContact, PageData.OrderConfirmationData.Customer.Id);
            }

            //------------------------------------------

            var clsParam = new ClsMailParamOnRegistration
            {
                FirstName = PageData.OrderConfirmationData.Customer.FirstName,
                LastName  = PageData.OrderConfirmationData.Customer.LastName,
                RegDate   = AdvantShop.Localization.Culture.ConvertDate(DateTime.Now),
                Password  = PageData.OrderConfirmationData.Customer.Password,
                Subsrcibe = Resource.Client_Registration_No,
                ShopURL   = SettingsMain.SiteUrl
            };


            string message = SendMail.BuildMail(clsParam);

            if (CustomerSession.CurrentCustomer.IsVirtual)
            {
                ShowMessage(Notify.NotifyType.Notice, Resource.Client_Registration_Whom + PageData.OrderConfirmationData.Customer.EMail + '\r' + Resource.Client_Registration_Text + message);
            }
            else
            {
                SendMail.SendMailNow(PageData.OrderConfirmationData.Customer.EMail, SettingsMain.SiteUrl + " - " + string.Format(Resource.Client_Registration_RegSuccessful, PageData.OrderConfirmationData.Customer.EMail), message, true);
                SendMail.SendMailNow(SettingsMail.EmailForRegReport, SettingsMain.SiteUrl + " - " + string.Format(Resource.Client_Registration_RegSuccessful, PageData.OrderConfirmationData.Customer.EMail), message, true);
            }

            //------------------------------------------
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
            ShowMessage(Notify.NotifyType.Error, ex.Message + " at registration");
        }
    }