Esempio n. 1
0
 /// <summary>
 /// Constructor for model setting all model variables.
 /// </summary>
 /// <param name="cart"></param>
 /// <param name="user"></param>
 /// <param name="ship"></param>
 public BLPurchase(BLShoppingCart cart, BLUser user, BLShipping ship)
 {
     Cart     = cart;
     User     = user;
     Shipping = ship;
     Gst      = (Cart.Amount + Shipping.Cost) / 11;
 }
Esempio n. 2
0
        /// <summary>
        /// Generates summary of order to form the message body for an email to be sent to the user.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="cart"></param>
        /// <param name="shipping"></param>
        /// <returns></returns>
        public static string generateOrderSummary(string name, BLShoppingCart cart, BLShipping shipping)
        {
            string mailbody =
                "<p>"
                + "To " + name + ","
                + "</p>"
                + "<p>"
                + "Below is a summary of your recent order:"
                + "</p>"
                + "<div>"
                + "<table style=\"border-collapse: collapse; border: 1px solid black;\">"
                + "<tr>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\">Quantity</th>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\">Size</th>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\">Item</th>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\">Cost</th>"
                + "</tr>";

            // Repeat for each item in the order; forming one row in the table
            foreach (BLCartItem item in cart.Items)
            {
                mailbody +=
                    "<tr>"
                    + "<td style=\"border: 1px solid black; padding: 2px 5px;\">" + item.Quantity + "</td>"
                    + "<td style=\"border: 1px solid black; padding: 2px 5px;\">" + item.Size + "</td>"
                    + "<td style=\"border: 1px solid black; padding: 2px 5px;\">"
                    + item.Product.playFirstName
                    + " "
                    + item.Product.playLastName
                    + " - "
                    + item.Product.prodDescription
                    + "</td>"
                    + "<td style=\"border: 1px solid black; padding: 2px 5px;\">$" + item.ItemTotal + "</td>"
                    + "</tr>";
            }

            mailbody +=
                "<tr>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\"></td>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\"></td>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\">Shipping - " + shipping.Method + "</td>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\">$" + shipping.Cost + "</td>"
                + "</tr>"
                + "<tr>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\"></td>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\"></td>"
                + "<th style=\"border: 1px solid black; padding: 2px 5px;\">Total</td>"
                + "<td style=\"border: 1px solid black; padding: 2px 5px;\">$" + (cart.Amount + shipping.Cost) + "</td>"
                + "</tr>"
                + "</table>"
                + "</div>"
                + "<br/>"
                + "<p>"
                + "Kind Regards,"
                + "</p>"
                + "<p>"
                + "The JerseySure Team"
                + "</p>";

            return(mailbody);
        }