Exemplo n.º 1
0
        /*This method construct the HTML */
        public String HTMLBODY(int OrderID, String DTSNumber, String Imgfile, String bottomBanner)
        {
            String output            = String.Empty;
            String OrderOwner        = String.Empty;
            String PaymentTerms      = String.Empty;
            String OrderAccountOwner = String.Empty;

            List <DeltoneItem> orderlist = new List <DeltoneItem>();

            orderlist         = getOrderedList(OrderID);
            OrderOwner        = orderDAL.getContactPersonForOrder(OrderID);
            PaymentTerms      = orderDAL.getPaymentTerms(OrderID);
            OrderAccountOwner = orderDAL.getOrderCreatedBy(OrderID);
            var typeOfCall = orderDAL.getTypeOfCall(OrderID);

            output = "<!DOCTYPE HTML PUBLIC ' -//W3C//DTD HTML 3.2//EN'><html >";
            output = output + "<body style='font-family:Calibri;'><table align='center' cellpadding='0' cellspacing='0' width='100%'><tr><td><table align='center' cellpadding='0' cellspacing='0' width='780px' height='85px'>";
            output = output + "<tr><td>" + Imgfile + "</td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>";
            output = output + "Dear  " + OrderOwner + "</td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>";

            if (typeOfCall == "Exchange")
            {
                output = output + "Thanks for contacting Deltone Solutions.  <br />";
                output = output + "<br /> Please find below the exchange order you placed with us today. A credit may be applicable to this order once the credit is approved. </td></tr>";
            }
            else
            {
                output = output + "Thanks for the order you placed with us today.  <br />";
            }
            if (PaymentTerms == "1")
            {
                output = output + "<br /> We will dispatch the following goods and process your payment on the credit card provided.</td></tr>";
            }
            else
            {
                output = output + "<br /> We will dispatch the following goods on a " + PaymentTerms + " day account.</td></tr>";
            }


            output = output + "<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>";
            output = output + "<tr><td><table style='width:720px;'><tr>";
            output = output + "<td style='width:320px;text-align:left;font-family:Calibri;'><span style:'color:blue;font-family:Calibri;'>";
            output = output + "Model - Deltone Brand</span></td><td style='width:200px;text-align:center;font-family:Calibri;'>";
            output = output + "Quantity</td><td style='width:200px;text-align:center;font-family:Calibri;'>";

            //output = output + "Unit Price Inc.GST</td></tr><tr><td><hr></td><td><hr></td><td><hr></td></tr>";
            //output = output + "Total Price inc. GST</td></tr><tr><td><hr></td><td><hr></td><td><hr></td></tr>";
            //output= "<table><tr><td colspan='2'>" + Imgfile + "</td></tr><tr><td colspan='2'>THANK YOU FOR ORDERING WITH DELTONE SOLUTIONS.</td></tr><tr><td><b>ORDER NO:</b></td><td>"  + DTSNumber  + "</td></tr><tr><td  colspan='2'>ORDER SUMMERY</td></tr></table>";

            output = output + "Unit Price Inc.GST</td><td style='width:200px;text-align:center;font-family:Calibri;'>";
            output = output + "Total Price inc. GST</td></tr><tr><td style='width:200px;text-align:center;font-family:Calibri;'><hr></td><td><hr></td><td><hr></td><td><hr></td></tr>";

            //output = output + "<table><thead><tr><td>DESCRIPTION</td><td>QUANTITY</td><td>UNIT AMOUNT</td></tr></thead><tbody>";
            float  UnitPriceFloat     = 0;
            String ConvertedUnitPrice = String.Empty;

            // Create the Ordered Table
            foreach (DeltoneItem item in orderlist)
            {
                output = output + "<tr><td style='width:320px;text-align:left;font-family:Calibri;'>" + item.ItemDescription + "</td>";
                output = output + "<td style='width:200px;text-align:center;font-family:Calibri;'>" + item.Qty + "</td>";

                decimal theUnitPrice = item.UnitPrice;
                decimal totalPrice   = theUnitPrice * item.Qty;

                var unitPriceFormat = String.Format("{0:C2}", item.UnitPrice);

                var totaPriceFormat = String.Format("{0:C2}", totalPrice);
                //float theUnitPrice = item.UnitPrice;
                //float exGSTUnitPrice = theUnitPrice - ((theUnitPrice * 10) / 100);

                output = output + "<td style='width:200px;text-align:center;font-family:Calibri;'>" + unitPriceFormat + "</td>";
                output = output + "<td style='width:200px;text-align:center;font-family:Calibri;'>" + totaPriceFormat + "</td></tr>";
            }
            output = output + "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
            String ShippingCost = String.Empty;

            ShippingCost = orderDAL.getCustomerShippingCost(OrderID);

            String OrderTotal = String.Empty;

            OrderTotal = orderDAL.getOrderTotal(OrderID);

            String Urgency     = orderDAL.getOrderUrgency(OrderID);
            String UrgencyText = String.Empty;
            String FooterText  = String.Empty;

            if (Urgency == "Standard")
            {
                UrgencyText = "in 2-4 business days";
                FooterText  = "within the next 2-4 days";
            }
            else if (Urgency == "Urgent")
            {
                UrgencyText = "in 1-2 business days";
                FooterText  = "within the next 2-4 days";
            }
            else if (Urgency == "End of Month")
            {
                UrgencyText = "at the end of the month";
                FooterText  = "at the end of the month";
            }
            else
            {
                UrgencyText = "in 2-4 business days";
                FooterText  = "within the next 2-4 days";
            }


            //output = output + "<tr><td style='width:320px;text-align:left;font-family:Calibri;'>DELIVERY & HANDLING</td><td style='width:200px;text-align:center;font-family:Calibri;'>&nbsp;</td><td style='width:200px;text-align:center;font-family:Calibri;'>" + ShippingCost + "</td></tr>";

            //output = output + "<tr><td><hr></td><td><hr></td><td><hr></td></tr>";
            //output = output + "<tr><td>&nbsp;</td><td style='width:200px;text-align:center;font-family:Calibri;'>TOTAL</td><td style='width:200px;text-align:center;font-family:Calibri;'>" + OrderTotal + "</td></tr>";


            output = output + "<tr><td style='width:320px;text-align:left;font-family:Calibri;'>DELIVERY & HANDLING</td><td style='width:200px;text-align:center;font-family:Calibri;'>&nbsp;</td><td style='width:200px;text-align:center;font-family:Calibri;'>&nbsp;</td><td style='width:200px;text-align:center;font-family:Calibri;'>" + ShippingCost + "</td></tr>";
            output = output + "<tr><td><hr></td><td><hr></td><td><hr></td><td><hr></td></tr>";
            output = output + "<tr><td>&nbsp;</td><td>&nbsp;</td><td style='width:200px;text-align:center;font-family:Calibri;'>TOTAL INC.GST</td><td style='width:200px;text-align:center;font-family:Calibri;'>" + OrderTotal + "</td></tr>";

            output = output + "</table></td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>Your order should arrive " + UrgencyText + " to the address below. </td></tr>";

            String CompanyID = String.Empty;

            CompanyID = orderDAL.getCompanyIDFromOrder(OrderID);

            String CompanyName = String.Empty;

            CompanyName = companyDAL.getCompanyNameByID(CompanyID);

            String ContactID = String.Empty;

            ContactID = orderDAL.getContactPersonID(OrderID);

            String ContactAddressLine1 = String.Empty;

            ContactAddressLine1 = contactDAL.getContactAddressLine1(ContactID);

            String ContactAddressLine2 = String.Empty;

            ContactAddressLine2 = contactDAL.getContactSubStaPost(ContactID);

            output = output + "<tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'><strong>" + CompanyName + "<br/>Attn: " + OrderOwner + "<br/>" + ContactAddressLine1 + "<br/>" + ContactAddressLine2;

            if (PaymentTerms == "1")
            {
                output = output + "</strong></td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>An invoice and payment receipt will be emailed to you shortly. Please don’t hesitate to contact us if you have any questions or queries. </td></tr><tr><td>&nbsp;</td></tr>";
            }
            else
            {
                output = output + "</strong></td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>An invoice will be emailed and posted to you " + FooterText + ". Please don’t hesitate to contact us if you have any questions or queries. </td></tr><tr><td>&nbsp;</td></tr>";
            }

            output = output + "<tr><td style='font-family:Calibri;'>Kind Regards</td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>" + OrderAccountOwner + "</td></tr><tr><td style='font-family:Calibri;'><strong>1300 787 783</strong></td></tr><tr><td>&nbsp;</td></tr><tr><td style='font-family:Calibri;'>" + bottomBanner + "</td></tr></table></td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table></body></html>";
            //output = output + "</tbody></table>";
            //End Creating Order Table
            return(output);
        }