Exemplo n.º 1
0
        public void SaveUserTransaction(UserTransaction transaction)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddUserTransaction";

            cmd.Parameters.AddWithValue("@ProductID", transaction.ProductID);
            cmd.Parameters.AddWithValue("@FirstName", transaction.FirstName);
            cmd.Parameters.AddWithValue("@LastName", transaction.LastName);
            cmd.Parameters.AddWithValue("@Email", transaction.Email);
            cmd.Parameters.AddWithValue("@Password", transaction.Password);
            cmd.Parameters.AddWithValue("@Address", transaction.Address);
            cmd.Parameters.AddWithValue("@City", transaction.City);
            cmd.Parameters.AddWithValue("@Zip", transaction.Zip);
            cmd.Parameters.AddWithValue("@State", transaction.State);
            cmd.Parameters.AddWithValue("@Phone", transaction.Phone);
            cmd.Parameters.AddWithValue("@Amount", transaction.Amount);

            db.Execute(cmd);

            return;
        }
Exemplo n.º 2
0
    public static void SendWelcomeMailWorkShop(UserTransaction transaction, decimal amt, string ProductName)
    {
        var InfoEmail = System.Configuration.ConfigurationManager.AppSettings["InfoEmail"];
        var CustServiceEmail = System.Configuration.ConfigurationManager.AppSettings["CustServiceEmail"];

        var TestInfoEmail = System.Configuration.ConfigurationManager.AppSettings["TestInfoEmail"];
        var TestCustServiceEmail = System.Configuration.ConfigurationManager.AppSettings["TestCustServiceEmail"];

        var sb = new StringBuilder();
        sb.Append("Name: ").Append(transaction.FirstName).Append(" ").AppendLine(transaction.LastName);
        sb.Append("Email: ").AppendLine(transaction.Email);
        sb.Append("Address: ").AppendLine(transaction.Address);
        sb.Append("City: ").AppendLine(transaction.City);
        sb.Append("State: ").AppendLine(transaction.State);
        sb.Append("Zip: ").AppendLine(transaction.Zip);
        sb.Append("Phone: ").AppendLine(transaction.Phone);
        sb.Append("Amount Paid: $").AppendLine(amt.ToString());
        sb.AppendLine();
        sb.Append("WorkShop Purchased: ").AppendLine(ProductName);
        sb.AppendLine();
        sb.Append("This is confirmation of your purchase of the Workshop.");
        sb.Append("If you have any questions please e-mail at: [email protected]");

        var sbAdmin = new StringBuilder();
        sbAdmin.Append("Name: ").Append(transaction.FirstName).Append(" ").AppendLine(transaction.LastName);
        sbAdmin.Append("Email: ").AppendLine(transaction.Email);
        sbAdmin.Append("Address: ").AppendLine(transaction.Address);
        sbAdmin.Append("City: ").AppendLine(transaction.City);
        sbAdmin.Append("State: ").AppendLine(transaction.State);
        sbAdmin.Append("Zip: ").AppendLine(transaction.Zip);
        sbAdmin.Append("Phone: ").AppendLine(transaction.Phone);
        sbAdmin.Append("Amount Paid: $").AppendLine(amt.ToString());
        sbAdmin.AppendLine();
        sbAdmin.Append("Product Purchased: ").AppendLine(ProductName);

        var isTest = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IsTestMode"]);
        var IsTestEmailDelivery = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IsTestEmailDelivery"]);

        var TestString = String.Empty;
        if (isTest)
        {
            TestString = " - Testing Please Ignore";
        }

        if (IsTestEmailDelivery)
        {
            SendMail(transaction.Email, TestCustServiceEmail, "Thank you for Purchasing The Myss.com Workshop" + TestString, sb.ToString(), false);

            SendMail(TestCustServiceEmail, TestInfoEmail, "New Myss.com Workshop Customer" + TestString, sbAdmin.ToString(), false);
        }
        else
        {
            SendMail(transaction.Email, CustServiceEmail, "Thank you for Purchasing The Myss.com Workshop" + TestString, sb.ToString(), false);

            SendMail(CustServiceEmail, InfoEmail, "New Myss.com Workshop Customer" + TestString, sbAdmin.ToString(), false);
        }
    }
Exemplo n.º 3
0
        protected void RegisterButton_Click(object sender, ImageClickEventArgs e)
        {
            var id = txtProductID.Value;
                if (!string.IsNullOrEmpty(id))
                {
                    if (Helper.IsNumeric(id))
                    {
                        ProductID = Int32.Parse(id);
                        try
                        {
                            product = controller.getProduct(ProductID);
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        ProductPrice = Convert.ToInt32(product.ProductPrice);
                    }
                    else
                    {
                        Response.Redirect("http://www.myss.com/");
                    }
                }

            var amt = 0;
            try
            {
                if (controller.EmailExists(EmailTextBox.Text.Trim(), ProductID))
                {
                    lblErrorMessage.Text = "You have already signed up for this class.";
                    ClassLogin.Visible = true;

                    return;
                }
                int charge = ProductPrice;

                if (charge > 0)
                {
                    CreateCharge(out amt, charge);

                    UserTransaction transaction = new UserTransaction
                    {
                        ProductID = product.ProductID,
                        FirstName = FirstNameTextBox.Text,
                        LastName = LastNameTextBox.Text,
                        Email = EmailTextBox.Text,
                        Password = PasswordTextBox.Text,
                        Address = AddressTextBox.Text,
                        City = CityTextBox.Text,
                        Zip = ZipTextBox.Text,
                        State = State.SelectedValue,
                        Phone = PhoneNumberTextBox.Text,
                        Amount = Convert.ToDecimal(charge)
                    };

                    try
                    {

                        controller.SaveUserTransaction(transaction);

                        Util.SendWelcomeMail(transaction, product);

                        String s = "product_thankyou.aspx?id=" + ProductID;

                        Response.Redirect(s);
                    }
                    catch (Exception ex)
                    {
                        string error = ex.Message;
                        lblErrorMessage.Text = "Unable to create customer record, please contact myss.com support.  ";
                        return;
                    }
                }

            }
            catch (Exception ex)
            {
                string error = ex.Message;
                lblErrorMessage.Text = "Unable to process your credit card. Please verify the information or try another card. ";
                return;
            }
        }
Exemplo n.º 4
0
    public static void SendWelcomeMail(UserTransaction transaction, MyssProduct product)
    {
        var InfoEmail = System.Configuration.ConfigurationManager.AppSettings["InfoEmail"];
        var CustServiceEmail = System.Configuration.ConfigurationManager.AppSettings["CustServiceEmail"];

        var TestInfoEmail = System.Configuration.ConfigurationManager.AppSettings["TestInfoEmail"];
        var TestCustServiceEmail = System.Configuration.ConfigurationManager.AppSettings["TestCustServiceEmail"];

        var sb = new StringBuilder();
        sb.Append("Name: ").Append(transaction.FirstName).Append(" ").AppendLine(transaction.LastName);
        sb.Append("Email: ").AppendLine(transaction.Email);
        sb.Append("Address: ").AppendLine(transaction.Address);
        sb.Append("City: ").AppendLine(transaction.City);
        sb.Append("State: ").AppendLine(transaction.State);
        sb.Append("Zip: ").AppendLine(transaction.Zip);
        sb.Append("Phone: ").AppendLine(transaction.Phone);
        sb.Append("Amount Paid: $").AppendLine(product.ProductPrice.ToString());
        sb.AppendLine();
        sb.Append("Product Purchased: ").AppendLine(product.ProductName.ToUpper());
        sb.AppendLine();
        sb.Append("This is confirmation of your purchase of the Caroline Myss Reflection Class.");
        sb.Append("You will receive e-mail instructions to view this class 48 hours prior to the live class.");
        sb.Append("If you have any questions please e-mail at: [email protected]");

        var sbAdmin = new StringBuilder();
        sbAdmin.Append("Name: ").Append(transaction.FirstName).Append(" ").AppendLine(transaction.LastName);
        sbAdmin.Append("Email: ").AppendLine(transaction.Email);
        sbAdmin.Append("Address: ").AppendLine(transaction.Address);
        sbAdmin.Append("City: ").AppendLine(transaction.City);
        sbAdmin.Append("State: ").AppendLine(transaction.State);
        sbAdmin.Append("Zip: ").AppendLine(transaction.Zip);
        sbAdmin.Append("Phone: ").AppendLine(transaction.Phone);
        sbAdmin.Append("Amount Paid: $").AppendLine(product.ProductPrice.ToString());
        sbAdmin.AppendLine();
        sbAdmin.Append("Product Purchased: ").AppendLine(product.ProductName.ToUpper());

        var isTest = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IsTestMode"]);
        var IsTestEmailDelivery = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IsTestEmailDelivery"]);

        var TestString = String.Empty;
        if (isTest)
        {
            TestString = " - Testing Please Ignore";
        }

        if (IsTestEmailDelivery)
        {
            SendMail(transaction.Email, TestCustServiceEmail, "Welcome to Myss.com Reflections Classes" + TestString, sb.ToString(), false);

            SendMail(TestCustServiceEmail, TestInfoEmail, "New Myss.com Reflections Customer" + TestString, sbAdmin.ToString(), false);
        }
        else
        {
            SendMail(transaction.Email, CustServiceEmail, "Welcome to Myss.com Reflections Classes" + TestString, sb.ToString(), false);

            SendMail(CustServiceEmail, InfoEmail, "New Myss.com Reflections Customer" + TestString, sbAdmin.ToString(), false);
        }
    }