Example #1
0
    protected void btnSendPasswordByEmail_Click(object sender, EventArgs e)
    {
        var customer = CustomerService.GetCustomerByEmail(txtEmail.Text);

        if (!customer.RegistredUser)
        {
            MultiView1.SetActiveView(ViewEmailSendError);
            return;
        }

        string strLink  = AdvantShop.Configuration.SettingsMain.SiteUrl + "/FogotPassword.aspx?Email=" + customer.EMail + "&RecoveryCode=" + ValidationHelper.DeleteSigns(SecurityHelper.GetPasswordHash(customer.Password));
        var    clsParam = new ClsMailParamOnPwdRepair
        {
            Email        = customer.EMail,
            RecoveryCode =
                ValidationHelper.DeleteSigns(
                    SecurityHelper.GetPasswordHash(customer.Password)),
            Link = strLink
        };

        string message = SendMail.BuildMail(clsParam);

        SendMail.SendMailNow(customer.EMail, Resources.Resource.Client_FogotPassword_PasswordRecovery, message, true);

        MultiView1.ActiveViewIndex = 1;
    }
Example #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");
    }
Example #3
0
    protected void btnSubscribe_Click(object sender, EventArgs e)
    {
        try
        {
            if (SubscribeService.IsExistInSubscribeEmails(txtEmail.Text))
            {
                //MultiView1.SetActiveView(ViewEmailSend);
                //lblError.Visible = true;
                ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_Subscribe_EmailAlreadyReg);
                return;
            }

            if (SubscribeService.IsExistInCustomerEmails(txtEmail.Text))
            {
                //MultiView1.SetActiveView(ViewEmailSend);
                //lblError.Visible = true;
                ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_Subscribe_EmailAlreadyReg);
                return;
            }

            string strActivateCode   = DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + DateTime.Now.Second.ToString();
            string strDeactivateCode = DateTime.Now.Millisecond.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString();

            SubscribeService.SubscribeInsertEmail(txtEmail.Text, strActivateCode, strDeactivateCode);
            string strLink  = "<a href=\'" + AdvantShop.Configuration.SettingsMain.SiteUrl + "/subscribe.aspx?ID=" + strActivateCode + "\'>" + AdvantShop.Configuration.SettingsMain.SiteUrl + "/subscribe.aspx?ID=" + strActivateCode + "</a>";
            var    clsParam = new ClsMailParamOnSubscribeActivate {
                Link = strLink
            };
            string message = SendMail.BuildMail(clsParam);


            SendMail.SendMailNow(txtEmail.Text, Resources.Resource.Client_Subscribe_NewSubscribe, message, true);

            MultiView1.SetActiveView(ViewEmailSend);
            //--------------------------

            txtEmail.Text   = string.Empty;
            lblInfo.Visible = true;
            lblInfo.Text    = Resources.Resource.Client_Subscribe_RegSuccess + @" <br /><br />" +
                              Resources.Resource.Client_Subscribe_Instruction;
            //ShowMessage(Notify.NotifyType.Notice, Resources.Resource.Client_Subscribe_RegSuccess + @" <br /><br />" + Resources.Resource.Client_Subscribe_Instruction);
            //lblInfo.ForeColor = System.Drawing.Color.Black;
        }
        catch (Exception ex)
        {
            AdvantShop.Diagnostics.Debug.LogError(ex);
            //lblError.Visible = true;
            ShowMessage(Notify.NotifyType.Error, ex.Message + @" at Subscribe");
        }
    }
        public static void SendCertificateMails(GiftCertificate certificate)
        {
            string htmlMessage = SendMail.BuildMail(new ClsMailParamOnSendCertificate
            {
                CertificateCode = certificate.CertificateCode,
                FromName        = certificate.FromName,
                ToName          = certificate.ToName,
                Message         = certificate.CertificateMessage,
                Sum             = CatalogService.GetStringPrice(certificate.Sum)
            });

            SendMail.SendMailNow(certificate.Email, Resources.Resource.Admin_GiftCertificate_Certificate,
                                 htmlMessage, true);
            SendMail.SendMailNow(certificate.FromEmail,
                                 Resources.Resource.Admin_GiftCertificate_CertificateSend + " " + certificate.Email, htmlMessage,
                                 true);
        }
Example #5
0
        public static void SendFailureMessage(int orderByRequestId)
        {
            var orderByRequest = GetOrderByRequest(orderByRequestId);

            var clsParam = new ClsMailParamOnSendFailureByRequest
            {
                OrderByRequestId = orderByRequest.OrderByRequestId.ToString(),
                UserName         = orderByRequest.UserName,
                ArtNo            = orderByRequest.ArtNo,
                ProductName      = orderByRequest.ProductName,
                Quantity         = orderByRequest.Quantity.ToString()
            };

            string message = SendMail.BuildMail(clsParam);

            SendMail.SendMailNow(orderByRequest.Email, Resources.Resource.Admin_OrderByRequest_ImpossibleOrder, message, true);
        }
    protected void btnDeactivate_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtEmailAdress.Text))
        {
            ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_SubscribeDeactivate_NoEmail);
            return;
        }

        try
        {
            if (!SubscribeService.IsExistInSubscribeEmails(txtEmailAdress.Text))
            {
                ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_SubscribeDeactivate_EmailNotFound);
                return;
            }

            if (!string.IsNullOrEmpty(txtDeactivateReason.Text))
            {
                SubscribeService.SubscribeInsertDeactivateReason(txtDeactivateReason.Text);
            }

            var strDeactivateCode = SubscribeService.SubscribeGetDectivateCodeByEmail(txtEmailAdress.Text);

            string strLink = "<a href=\'" + SettingsMain.SiteUrl + "/subscribedeactivate.aspx?id=" + strDeactivateCode + "\'>" + SettingsMain.SiteUrl + "/subscribedeactivate.aspx?id=" + strDeactivateCode + "</a>";

            var clsParam = new ClsMailParamOnSubscribeDeactivate {
                Link = strLink
            };

            string message = SendMail.BuildMail(clsParam);

            SendMail.SendMailNow(txtEmailAdress.Text, Resources.Resource.Client_SubscribeDeactivate_DeactivateNews, message, true);

            MultiView1.SetActiveView(viewMessage);
            lblInfo.Text    = Resources.Resource.Client_SubscribeDeactivate_EmailSent;
            lblInfo.Visible = true;
        }
        catch (Exception ex)
        {
            AdvantShop.Diagnostics.Debug.LogError(ex);
            ShowMessage(Notify.NotifyType.Error, ex.Message + @" at Subscribe Diactivate");
        }
    }
Example #7
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        bool boolIsValidPast = true;

        boolIsValidPast = txtSenderName.Text.IsNotEmpty() && txtMessage.Text.IsNotEmpty() &&
                          txtEmail.Text.IsNotEmpty() && AdvantShop.Helpers.ValidationHelper.IsValidEmail(txtEmail.Text);

        if (!boolIsValidPast)
        {
            ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_Feedback_WrongData);
            validShield.TryNew();
            return;
        }

        if (!validShield.IsValid())
        {
            ShowMessage(Notify.NotifyType.Error, Resources.Resource.Client_Feedback_WrongCaptcha);
            validShield.TryNew();
            return;
        }

        try
        {
            var clsParam = new ClsMailParamOnFeedback
            {
                ShopUrl        = SettingsMain.SiteUrl,
                ShopName       = SettingsMain.ShopName,
                UserName       = HttpUtility.HtmlEncode(txtSenderName.Text),
                UserEmail      = HttpUtility.HtmlEncode(txtEmail.Text),
                UserPhone      = HttpUtility.HtmlEncode(txtPhone.Text),
                SubjectMessage = Resource.Client_Feedback_Header,
                TextMessage    = HttpUtility.HtmlEncode(txtMessage.Text)
            };

            string message = SendMail.BuildMail(clsParam);
            SendMail.SendMailNow(SettingsMail.EmailForFeedback, Resource.Client_Feedback_Header + " // " + SettingsMain.SiteUrl, message, true);
            MultiView1.SetActiveView(ViewEmailSend);
        }
        catch (Exception ex)
        {
            AdvantShop.Diagnostics.Debug.LogError(ex);
        }
    }
Example #8
0
        public static void SendConfirmationMessage(int orderByRequestId)
        {
            var orderByRequest = GetOrderByRequest(orderByRequestId);
            var code           = CreateCode(orderByRequestId);

            var clsParam = new ClsMailParamOnSendLinkByRequest
            {
                OrderByRequestId = orderByRequest.OrderByRequestId.ToString(),
                UserName         = orderByRequest.UserName,
                ArtNo            = orderByRequest.ArtNo,
                ProductName      = orderByRequest.ProductName,
                Quantity         = orderByRequest.Quantity.ToString(),
                Code             = code
            };

            string message = SendMail.BuildMail(clsParam);

            SendMail.SendMailNow(orderByRequest.Email, Resources.Resource.Admin_OrderByRequest_OrderLink, message, true);
        }
Example #9
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");
        }
    }
Example #10
0
    private Order DoCreateOrder()
    {
        var shoppingCart = ShoppingCartService.CurrentShoppingCart;

        if (shoppingCart.GetHashCode() != PageData.OrderConfirmationData.CheckSum || !shoppingCart.HasItems)
        {
            Redirect("shoppingcart.aspx");
            return(null);
        }

        if (PageData.OrderConfirmationData.UserType == EnUserType.JustRegistredUser)
        {
            RegistrationNow();
        }


        var ord = CreateOrder(shoppingCart);

        var    paymentMethod = PaymentService.GetPaymentMethod(ord.PaymentMethodId);
        string email         = PageData.OrderConfirmationData.Customer.EMail;

        string htmlOrderTable = OrderService.GenerateHtmlOrderTable(ord.OrderItems, CurrencyService.CurrentCurrency,
                                                                    shoppingCart.TotalPrice,
                                                                    shoppingCart.DiscountPercentOnTotalPrice,
                                                                    ord.Coupon, ord.Certificate,
                                                                    shoppingCart.TotalDiscount,
                                                                    ord.ShippingCost,
                                                                    PageData.OrderConfirmationData.TaxesTotal,
                                                                    PageData.OrderConfirmationData.BillingContact,
                                                                    PageData.OrderConfirmationData.ShippingContact);

        // declare class to collect info about what was buy
        var googleAnalystic = new GoogleAnalyticsString();
        var trans           = new GoogleAnalyticsTrans
        {
            OrderId     = ord.OrderID.ToString(),
            Affiliation = SettingsMain.ShopName,
            Total       = shoppingCart.TotalPrice.ToString("F2", System.Globalization.CultureInfo.InvariantCulture),
            Tax         = (PageData.OrderConfirmationData.TaxesTotal).ToString("F2", System.Globalization.CultureInfo.InvariantCulture),
            Shipping    = ord.ShippingCost.ToString("F2", System.Globalization.CultureInfo.InvariantCulture),
            City        = string.Empty,
            State       = string.Empty,
            Country     = string.Empty,
        };

        googleAnalystic.Trans = trans;
        googleAnalystic.Items = GetListItemForGoogleAnalytics(shoppingCart, ord.OrderID.ToString());
        ltGaECommerce.Text    = googleAnalystic.GetGoogleAnalyticsEComerceString();


        // Build a new mail
        var customerSb = new StringBuilder();

        customerSb.AppendFormat(Resource.Client_Registration_Name + ": {0}<br/>", PageData.OrderConfirmationData.Customer.FirstName);
        customerSb.AppendFormat(Resource.Client_Registration_Surname + ": {0}<br/>", PageData.OrderConfirmationData.Customer.LastName);
        customerSb.AppendFormat(Resource.Client_Registration_Phone + ": {0}<br/>", PageData.OrderConfirmationData.Customer.Phone);
        customerSb.AppendFormat(Resource.Client_Registration_Country + ": {0}<br/>", PageData.OrderConfirmationData.ShippingContact.Country);
        customerSb.AppendFormat(Resource.Client_Registration_State + ": {0}<br/>", PageData.OrderConfirmationData.ShippingContact.RegionName);
        customerSb.AppendFormat(Resource.Client_Registration_City + ": {0}<br/>", PageData.OrderConfirmationData.ShippingContact.City);
        customerSb.AppendFormat(Resource.Client_Registration_Zip + ": {0}<br/>", PageData.OrderConfirmationData.ShippingContact.Zip);
        customerSb.AppendFormat(Resource.Client_Registration_Address + ": {0}<br/>", string.IsNullOrEmpty(PageData.OrderConfirmationData.ShippingContact.Address) ? Resource.Client_OrderConfirmation_NotDefined : PageData.OrderConfirmationData.ShippingContact.Address);
        customerSb.AppendFormat("Email: {0}<br/>", PageData.OrderConfirmationData.Customer.EMail);


        string htmlMessage = SendMail.BuildMail(new ClsMailParamOnNewOrder
        {
            CustomerContacts    = customerSb.ToString(),
            PaymentType         = PageData.OrderConfirmationData.SelectPaymentName,
            ShippingMethod      = PageData.OrderConfirmationData.SelectShippingName,
            CurrentCurrencyCode = CurrencyService.CurrentCurrency.Iso3,
            TotalPrice          = ord.Sum.ToString(),
            Comments            = ord.CustomerComment,
            Email      = email,
            OrderTable = htmlOrderTable,
            OrderID    = ord.OrderID.ToString(),
            Number     = ord.Number
        });

        if (!CustomerSession.CurrentCustomer.IsVirtual)
        {
            if (paymentMethod != null)
            {
                SendMail.SendMailNow(email, Resource.Client_OrderConfirmation_ReceivedOrder + " " + ord.OrderID,
                                     htmlMessage, true);
                SendMail.SendMailNow(SettingsMail.EmailForOrders,
                                     Resource.Client_OrderConfirmation_ReceivedOrder + " " + ord.OrderID, htmlMessage,
                                     true);
            }
            else
            {
                htmlMessage += " ERROR: \'" + "\'";
                SendMail.SendMailNow(SettingsMail.EmailForOrders,
                                     Resource.Client_OrderConfirmation_OrderError + " " + ord.OrderID, htmlMessage, true);
            }
        }

        var certificate = shoppingCart.Certificate;

        if (certificate != null)
        {
            certificate.OrderNumber = ord.Number;
            certificate.Used        = true;
            certificate.Enable      = true;

            GiftCertificateService.DeleteCustomerCertificate(certificate.CertificateId);
            GiftCertificateService.UpdateCertificateById(certificate);
        }

        var coupon = shoppingCart.Coupon;

        if (coupon != null && shoppingCart.TotalPrice >= coupon.MinimalOrderPrice)
        {
            coupon.ActualUses += 1;
            CouponService.UpdateCoupon(coupon);
            CouponService.DeleteCustomerCoupon(coupon.CouponID);
        }

        ShoppingCartService.ClearShoppingCart(ShoppingCartType.ShoppingCart, PageData.OrderConfirmationData.Customer.Id);
        ShoppingCartService.ClearShoppingCart(ShoppingCartType.ShoppingCart, CustomerSession.CustomerId);
        return(ord);
    }
Example #11
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        bool boolIsValidPast = true;

        boolIsValidPast &= IsValidText(txtName.Text);
        boolIsValidPast &= IsValidText(txtEmail.Text);
        boolIsValidPast &= IsValidText(txtPhone.Text);

        int quantity = 0;

        if (!Int32.TryParse(txtAmount.Text, out quantity) || (quantity < 1))
        {
            boolIsValidPast = false;
        }

        if (!ValidationHelper.IsValidEmail(txtEmail.Text.Trim()))
        {
            boolIsValidPast = false;
        }

        if (!CaptchaControl1.IsValid())
        {
            CaptchaControl1.TryNew();
            boolIsValidPast = false;
        }

        if (boolIsValidPast == false)
        {
            ShowMessage(Notify.NotifyType.Error, Resource.Client_Feedback_WrongData);
            return;
        }

        try
        {
            var orderByRequest = new OrderByRequest
            {
                ProductId   = product.ID,
                ProductName = product.Name,
                ArtNo       = product.ArtNo,
                Quantity    = quantity,
                UserName    = txtName.Text,
                Email       = txtEmail.Text,
                Phone       = txtPhone.Text,
                Comment     = txtComment.Text,
                IsComplete  = false,
                RequestDate = DateTime.Now
            };

            OrderByRequestService.AddOrderByRequest(orderByRequest);

            var clsParam = new ClsMailParamOnOrderByRequest
            {
                OrderByRequestId = orderByRequest.OrderByRequestId.ToString(CultureInfo.InvariantCulture),
                ArtNo            = product.ArtNo,
                ProductName      = product.Name,
                Quantity         = quantity.ToString(CultureInfo.InvariantCulture),
                UserName         = txtName.Text,
                Email            = txtEmail.Text,
                Phone            = txtPhone.Text,
                Comment          = txtComment.Text
            };

            string message = SendMail.BuildMail(clsParam);

            SendMail.SendMailNow(txtEmail.Text, Resource.Client_OrderByRequest_PreOrder, message, true);
            SendMail.SendMailNow(SettingsMail.EmailForOrders, Resource.Client_OrderByRequest_PreOrder, message, true);

            lblMessage.Text = Resource.Client_Feedback_MessageSent;
            MultiView1.SetActiveView(ViewResult);
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
            ShowMessage(Notify.NotifyType.Error, Resource.Client_Feedback_MessageError);
            MultiView1.SetActiveView(ViewResult);
        }
    }