示例#1
0
        private void showOrderDetails(int orderID)
        {
            pnlOrderDetails.Visible = true;
            // Obtain Order Details from Database
            //      OrdersDB orderHistory = new OrdersDB();
            //      Commerce.OrderDetails myOrderDetails = orderHistory.GetOrderDetails(OrderID, CustomerId);
            OrderController orderController = new OrderController();
            OrderInfo order = orderController.GetOrder(orderID);

            if(order != null)
            {
                // Update labels with summary details
                lblTotal.Text = order.OrderTotal.ToString("C", LocalFormat);
                lblPostage.Text = order.ShippingCost.ToString("C", LocalFormat);
                lblTotalIncPostage.Text = order.GrandTotal.ToString("C", LocalFormat);
                lblOrderNumber.Text = order.OrderID.ToString();
                lblOrderDate.Text = order.OrderDate.ToString(_OrderDateFormat);
                lblShipDate.Text = order.ShipDate.ToShortDateString();

                UserController userController = new UserController();
                UserInfo userInfo = userController.GetUser(this.PortalId, order.CustomerID);
                lblOrderCompany.Text = "Profile: " + userInfo.Profile.GetPropertyValue("Company") + "<br>" + "Wisdom: " + DotNetNuke.Modules.Store.WebControls.CustomerAdmin.getUserCompanyName(order.CustomerID);

                //Tax
                if (order.Tax > 0)
                {
                    lblTax.Text = order.Tax.ToString("C", LocalFormat);
                    trTax.Visible = true;
                }
                else
                {
                    trTax.Visible = false;
                }

                getShipToAddress(order.ShippingAddressID);
                getBillToAddress(order.BillingAddressID);
                ArrayList orderDetails = orderController.GetOrderDetails(orderID);

                // if order was found, display it
                if (orderDetails != null)
                {
                    detailsTable.Visible = true;

                    // Bind Items to GridControl
                    grdOrderDetails.DataSource = orderDetails;
                    grdOrderDetails.DataBind();
                }
                // otherwise display an error message
                else
                {
                    lblDetailsError.Text = Localization.GetString("DetailsNotFound", this.LocalResourceFile);
                    detailsTable.Visible = false;
                }
            }

            if (order.OrderStatusID == (int)OrderInfo.OrderStatusList.AwaitingPayment
                && storeInfo.GatewayName == "PayPalProvider")
            {
                btnPayViaPayPal.Visible = true;
            }
            else
            {
                btnPayViaPayPal.Visible = false;
            }

            //Cancel button
            spanBR.Visible = false;
            if (storeInfo.AuthorizeCancel && !UserInfo.IsSuperUser)
            {
                if (order.OrderStatusID == (int)OrderInfo.OrderStatusList.AwaitingPayment
                    || order.OrderStatusID == (int)OrderInfo.OrderStatusList.AwaitingStock
                    || order.OrderStatusID == (int)OrderInfo.OrderStatusList.Paid)
                {
                    btnCancel.CommandArgument = order.OrderID.ToString();
                    btnCancel.Click += this.btnCancel_Click;
                    btnCancel.Visible = true;
                    if (btnPayViaPayPal.Visible)
                    {
                        spanBR.Visible = true;
                    }
                }
                else
                {
                    btnCancel.Visible = false;
                }
            }
            else
            {
                btnCancel.Visible = false;
            }

            //if (UserInfo.IsInRole("Administrators"))
            if (UserInfo.IsSuperUser || CheckForAdminRole() || UserInfo.IsInRole("ShopAdmin") || UserInfo.IsInRole("Webmaster"))
            {
                ddlOrderStatus.Visible = true;
                lnkbtnSave.Visible = true;
                lblOrderStatus.Visible = false;

                //Bind order status list...
                ddlOrderStatus.DataSource = orderController.GetOrderStatuses();
                ddlOrderStatus.DataTextField = "OrderStatusText";
                ddlOrderStatus.DataValueField = "OrderStatusID";
                ddlOrderStatus.DataBind();

                //Value...
                if (ddlOrderStatus.Items.FindByValue(order.OrderStatusID.ToString()) != null)
                {
                    ddlOrderStatus.Items.FindByValue(order.OrderStatusID.ToString()).Selected = true;
                }
            }
            else
            {
                /*
                ArrayList orderStatusList = orderController.GetOrderStatuses();
                string OrderStatusText = "";
                foreach (OrderStatus orderStatus in orderStatusList)
                {
                    if (orderStatus.OrderStatusID == order.OrderStatusID)
                    {
                        if (order.OrderStatusID > 1)
                        {
                            OrderStatusText = orderStatus.OrderStatusText + " - " + order.ShipDate.ToString(_OrderDateFormat);
                        }
                        else
                        {
                            OrderStatusText = orderStatus.OrderStatusText;
                        }
                        break;
                    }
                }
                */
                string OrderStatusText = "";
                OrderStatusText = GetOrderStatus(order.OrderStatusID, order.OrderIsPlaced);
                if (order.OrderStatusID > 1)
                {
                    OrderStatusText = OrderStatusText + " - " + order.ShipDate.ToString(_OrderDateFormat);
                }
                ddlOrderStatus.Visible = false;
                lnkbtnSave.Visible = false;
                lblOrderStatus.Visible = true;
                lblOrderStatus.Text = OrderStatusText;
            }
        }
示例#2
0
        private void SetupPayPalFields(OrderInfo orderInfo)
        {
            IAddressInfo shippingAddress = getShipToAddress(orderInfo.ShippingAddressID);
            IAddressInfo billingAddress = getBillToAddress(orderInfo.BillingAddressID);

            GatewayController controller = new GatewayController(Server.MapPath(ModulePath));
            GatewayInfo gateway = controller.GetGateway(storeInfo.GatewayName);

            PayPalSettings _settings = new PayPalSettings(gateway.GetSettings(PortalId));

            // Ajouté pour la localisation
            CultureInfo ci_enUS = new CultureInfo("en-US");

            //_verificationURL = _settings.UseSandbox ? _sandboxVerificationURL : _liveVerificationURL;
            //_paymentURL = _settings.UseSandbox ? _sandboxPaymentURL : _livePaymentURL;
            _verificationURL = _settings.UseSandbox ? _sandboxVerificationURL : _settings.VerificationURL;
            _paymentURL = _settings.UseSandbox ? _sandboxPaymentURL : _settings.PaymentURL;

            //Set the paypal url as form target
            pnlPayPalTransfer.Visible = true;
            pnlOrderDetails.Visible = false;
            btnGoToPayPal.PostBackUrl = _paymentURL;
            paypalimage2.ImageUrl = _settings.ButtonURL;

            string returnURL = Request.Url + "&PayPalExit=return";
            string cancelURL = Request.Url + "&PayPalExit=cancel";
            string notifyURL = Request.Url + "&PayPalExit=notify";

            AddHiddenField("cmd", "_cart");
            AddHiddenField("upload", "1");
            AddHiddenField("business", _settings.PayPalID);
            AddHiddenField("handling_cart", orderInfo.ShippingCost.ToString("0.00", ci_enUS));
            //AddHiddenField("handling_cart", orderInfo.ShippingCost.ToString("0.00"));
            AddHiddenField("charset", _settings.Charset);
            AddHiddenField("currency_code", _settings.Currency);
            AddHiddenField("invoice", orderInfo.OrderID.ToString());
            AddHiddenField("return", returnURL);
            AddHiddenField("cancel_return", cancelURL);
            AddHiddenField("notify_url", notifyURL);
            AddHiddenField("rm", "2");
            AddHiddenField("lc", _settings.Lc);
            //AddHiddenField("lc", "GB");
            _Message = Localization.GetString("PayPalReturnTo", this.LocalResourceFile);
            AddHiddenField("cbt", string.Format(_Message, PortalSettings.PortalName));
            //AddHiddenField("cbt", "Back to " + PortalSettings.PortalName);

            if (orderInfo.Tax > 0)
            {
                AddHiddenField("tax_cart", orderInfo.Tax.ToString("0.00", ci_enUS));
                //AddHiddenField("tax_cart", orderInfo.Tax.ToString("0.00"));
            }

            //Cart Contents...
            OrderController orderController = new OrderController();
            ArrayList cartItems = orderController.GetOrderDetails(orderInfo.OrderID);
            int itemNumber = 1;
            foreach (OrderDetailsInfo itemInfo in cartItems)
            {
                AddHiddenField("item_name_" + itemNumber.ToString(), itemInfo.ModelName);
                AddHiddenField("quantity_" + itemNumber.ToString(), itemInfo.Quantity.ToString());
                AddHiddenField("amount_" + itemNumber.ToString(), itemInfo.UnitCost.ToString("0.00", ci_enUS));
                //AddHiddenField("amount_" + itemNumber.ToString(), itemInfo.UnitCost.ToString("0.00"));
                itemNumber++;
            }

            //Customer Address...
            AddHiddenField("email", UserInfo.Membership.Email);
            AddHiddenField("first_name", GetFirstName(billingAddress.Name));
            AddHiddenField("last_name", GetSurname(billingAddress.Name));
            AddHiddenField("address1", billingAddress.Address1);
            AddHiddenField("address2", billingAddress.Address2);
            AddHiddenField("city", billingAddress.City);
            AddHiddenField("zip", billingAddress.PostalCode);
            AddHiddenField("country", (billingAddress.CountryCode.Equals("United Kingdom") ? "GB" : billingAddress.CountryCode));

            AddHiddenField("business_cs_email", UserInfo.Membership.Email);
            AddHiddenField("business_address1", billingAddress.Address1);
            AddHiddenField("business_address2", billingAddress.Address2);
            AddHiddenField("business_city", billingAddress.City);
            AddHiddenField("business_zip", billingAddress.PostalCode);
            AddHiddenField("business_country", billingAddress.CountryCode);
        }
示例#3
0
        private DataTable getOrdersData(int orderId, int customerId, int orderStatusId)
        {
            OrderController orderController = new OrderController();

            //Create Tempory Table
            DataTable dtTemp = new DataTable();

            //Creating Header Row
            dtTemp.Columns.Add("<b>Order Number</b>");  // 0
            dtTemp.Columns.Add("<b>Login</b>");         // 1
            dtTemp.Columns.Add("<b>Name</b>");          // 2
            dtTemp.Columns.Add("<b>Company(Profile)</b>");       // 3
            dtTemp.Columns.Add("<b>Company(Wisdom)</b>");       // 4
            dtTemp.Columns.Add("<b>Order Date</b>");    // 5
            dtTemp.Columns.Add("<b>Order Total</b>");   // 6
            dtTemp.Columns.Add("<b>Status</b>");        // 7
            dtTemp.Columns.Add("<b>Product</b>");       // 8
            dtTemp.Columns.Add("<b>Delivery</b>");      // 9
            dtTemp.Columns.Add("<b>Qty</b>");           // 10
            dtTemp.Columns.Add("<b>SubTotal</b>");      // 11

            UserController userController = new UserController();
            ArrayList orders = new ArrayList();
            DataRow drAddItem;
            if (orderId != -1)
            {
                OrderInfo orderInfo = orderController.GetOrder(orderId);
                ArrayList orderDetailsList = orderController.GetOrderDetails(orderId);

                UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID);

                foreach (OrderDetailsInfo orderDetails in orderDetailsList)
                {
                    drAddItem = dtTemp.NewRow();
                    drAddItem[0] = orderInfo.OrderID + "";
                    drAddItem[1] = userInfo.Username;
                    drAddItem[2] = userInfo.DisplayName;
                    drAddItem[3] = userInfo.Profile.GetPropertyValue("Company");
                    drAddItem[4] = getUserCompanyName(orderInfo.CustomerID);
                    drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm");
                    drAddItem[6] = orderInfo.OrderTotal + "";
                    drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced);
                    // drAddItem[7] = orderInfo.sta;

                    drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName;
                    drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod);
                    drAddItem[10] = orderDetails.Quantity;
                    drAddItem[11] = orderDetails.ProdCost;

                    dtTemp.Rows.Add(drAddItem);
                }

            }
            else if (customerId != -1)
            {
                orders = orderController.GetCustomerOrders(this.PortalId, customerId);
                foreach (OrderInfo orderInfo in orders)
                {
                    UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID);

                    ArrayList orderDetailsList = orderController.GetOrderDetails(orderInfo.OrderID);

                    foreach (OrderDetailsInfo orderDetails in orderDetailsList)
                    {
                        drAddItem = dtTemp.NewRow();
                        drAddItem[0] = orderInfo.OrderID + "";
                        drAddItem[1] = userInfo.Username;
                        drAddItem[2] = userInfo.DisplayName;
                        drAddItem[3] = userInfo.Profile.GetPropertyValue("Company");
                        drAddItem[4] = getUserCompanyName(orderInfo.CustomerID);
                        drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm");
                        drAddItem[6] = orderInfo.OrderTotal + "";
                        drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced);
                        // drAddItem[7] = orderInfo.sta;

                        drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName;
                        drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod);
                        drAddItem[10] = orderDetails.Quantity;
                        drAddItem[11] = orderDetails.ProdCost;

                        dtTemp.Rows.Add(drAddItem);
                    }

                }
            }
            else if (orderStatusId != -1)
            {
                orders = orderController.GetOrders(this.PortalId, orderStatusId);
                foreach (OrderInfo orderInfo in orders)
                {
                    UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID);

                    ArrayList orderDetailsList = orderController.GetOrderDetails(orderInfo.OrderID);

                    foreach (OrderDetailsInfo orderDetails in orderDetailsList)
                    {
                        drAddItem = dtTemp.NewRow();
                        drAddItem[0] = orderInfo.OrderID + "";
                        drAddItem[1] = userInfo.Username;
                        drAddItem[2] = userInfo.DisplayName;
                        drAddItem[3] = userInfo.Profile.GetPropertyValue("Company");
                        drAddItem[4] = getUserCompanyName(orderInfo.CustomerID);
                        drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm");
                        drAddItem[6] = orderInfo.OrderTotal + "";
                        drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced);
                        // drAddItem[7] = orderInfo.sta;

                        drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName;
                        drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod);
                        drAddItem[10] = orderDetails.Quantity;
                        drAddItem[11] = orderDetails.ProdCost;

                        dtTemp.Rows.Add(drAddItem);
                    }
                }
            }

            {
                //                Response.Write("<br>" + ((Decimal)drW["VolumeMillionLitres"]).ToString());
            }
            return dtTemp;
        }
示例#4
0
        private void paymentControl_PaymentSucceeded(object sender, EventArgs e)
        {
            // Get the order
            OrderController orderController = new OrderController();

            //CalculateTaxandShipping(_orderInfo);

            // Generate new order number
            //string orderNumber = PortalId.ToString("00#") + "-" + UserId.ToString("0000#") + "-" + _orderInfo.OrderID.ToString("0000#") + "-" + _orderInfo.OrderDate.ToString("yyyyMMdd");
            //_orderInfo.OrderNumber = orderNumber;
            //orderController.UpdateOrder(_orderInfo.OrderID, _orderInfo.OrderDate, _orderInfo.OrderNumber, _orderInfo.ShippingAddressID, _orderInfo.BillingAddressID, _orderInfo.Tax, _orderInfo.ShippingCost, UserId);

            // Update display
            lblOrderNumber.Text = Localization.GetString("lblOrderNumber", this.LocalResourceFile) + " " + _orderInfo.OrderID.ToString();
            plhCheckout.Visible = false;
            plhOrder.Visible = true;

            // Get the order details
            ArrayList orders = orderController.GetOrderDetails(_orderInfo.OrderID);
            lstOrder.DataSource = orders;
            lstOrder.DataBind();

            lblTaxTotal.Text = _orderInfo.Tax.ToString("C", LocalFormat);
            lblShippingTotal.Text = _orderInfo.ShippingCost.ToString("C", LocalFormat);
            lblTotal.Text = _orderInfo.GrandTotal.ToString("C", LocalFormat);

            if (_orderInfo.Tax > 0)
            {
                trConfirmedOrderTax.Visible = true;
            }
            else
            {
                trConfirmedOrderTax.Visible = false;
            }

            // Cleanup the cart records
            CurrentCart.ClearItems(PortalId);

            base.ModuleConfiguration.DisplayPrint = true;
        }
示例#5
0
        protected virtual void generateOrderConfirmation()
        {
            Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - Start generateOrderConfirmation", " ", "", "", "", "", "", "");

            StringBuilder emailText = new StringBuilder();
            string textLine = "";
            string storeEmail = "";
            string customerEmail = "";

            StoreInfo storeInfo = CheckoutControl.StoreData;
            IAddressInfo billingAddress = CheckoutControl.BillingAddress;
            IAddressInfo shippingAddress = CheckoutControl.ShippingAddress;

            //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 1", " ", "", "", "", "", "", "");

            OrderInfo orderInfo = CheckoutControl.OrderInfo;

            if (DotNetNuke.Common.Utilities.Null.IsNull(shippingAddress.Address1) || shippingAddress.Address1.Length == 0)
            {
                // canandean changed: load the address from the order if the address controls are empty
                if (DotNetNuke.Common.Utilities.Null.IsNull(billingAddress.Address1) || billingAddress.Address1.Length == 0)
                {
                    AddressController controller = new AddressController();

                    billingAddress = controller.GetAddress(orderInfo.BillingAddressID);
                    shippingAddress = controller.GetAddress(orderInfo.ShippingAddressID);
                }

                shippingAddress = billingAddress;
            }

            //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 2", " ", "", "", "", "", "", "");

            if (storeInfo == null)
            {
                StoreController storeController = new StoreController();
                storeInfo = storeController.GetStoreInfo(PortalId);
            }

            //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 3", " ", "", "", "", "", "", "");

            NumberFormatInfo LocalFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            if (storeInfo.CurrencySymbol != string.Empty)
            {
                LocalFormat.CurrencySymbol = storeInfo.CurrencySymbol;
            }

            //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 4", " ", "", "", "", "", "", "");

            UserController userController = new UserController();
            UserInfo userInfo = userController.GetUser(PortalId, orderInfo.CustomerID);

            //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 5", " ", "", "", "", "", "", "");

            if (storeInfo != null && orderInfo != null && userInfo != null)
            {
                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 6", " ", "", "", "", "", "", "");
                storeEmail = storeInfo.DefaultEmailAddress;
                customerEmail = userInfo.Membership.Email;

                OrderController orderController = new OrderController();
                ArrayList orderDetails = orderController.GetOrderDetails(orderInfo.OrderID);

                TabController tabControler = new TabController();
                TabInfo tabInfo = tabControler.GetTab(storeInfo.ShoppingCartPageID, storeInfo.PortalID, true);

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7", " ", "", "", "", "", "", "");

                //Order email header
                String _Message = Services.Localization.Localization.GetString("OrderEmailHeader", this.LocalResourceFile);
                textLine = String.Format(_Message, PortalSettings.PortalName, tabInfo.TabName, storeEmail);
                emailText.Append(textLine + "\r\n\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.1", " ", "", "", "", "", "", "");

                //Order number and date
                _Message = Services.Localization.Localization.GetString("OrderNumber", this.LocalResourceFile);
                emailText.Append(_Message + " " + orderInfo.OrderID.ToString());
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderDate", this.LocalResourceFile);
                String _DateFormat = Services.Localization.Localization.GetString("OrderDateFormat", this.LocalResourceFile);
                emailText.Append(_Message + " " + orderInfo.OrderDate.ToString(_DateFormat));
                emailText.Append("\r\n");
                emailText.Append("\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.2", " ", "", "", "", "", "", "");

                //Order Contents
                _Message = Services.Localization.Localization.GetString("OrderContents", this.LocalResourceFile);
                emailText.Append(_Message);
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderItems", this.LocalResourceFile);

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.2.1", " ", "", "", "", "", "", "");

                foreach (OrderDetailsInfo item in orderDetails)
                {
                    //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.2.2 " + item.ModelName, " ", "", "", "", "", "", "");

                    //textLine = String.Format(_Message, item.Quantity, item.ModelName, item.UnitCost.ToString("C", LocalFormat));
                    textLine = String.Format(_Message, item.Quantity, item.ModelName, item.ProdCost.ToString("C", LocalFormat));
                    emailText.Append(textLine + "\r\n");
                }
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderSubTotal", this.LocalResourceFile);
                emailText.Append(String.Format(_Message, orderInfo.OrderTotal.ToString("C", LocalFormat)));
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderShipping", this.LocalResourceFile);
                emailText.Append(String.Format(_Message, orderInfo.ShippingCost.ToString("C", LocalFormat)));

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.2.3", " ", "", "", "", "", "", "");

                if (orderInfo.Tax > 0)
                {
                    emailText.Append("\r\n");
                    _Message = Services.Localization.Localization.GetString("OrderTax", this.LocalResourceFile);
                    emailText.Append(String.Format(_Message, orderInfo.Tax.ToString("C", LocalFormat)));
                }
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderTotal", this.LocalResourceFile);
                emailText.Append(String.Format(_Message, orderInfo.GrandTotal.ToString("C", LocalFormat)));
                emailText.Append("\r\n");
                emailText.Append("\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.3", " ", "", "", "", "", "", "");

                // canadean changed: add information about company and VAT
                emailText.Append("Company: " + userInfo.Profile.ProfileProperties["Company"].PropertyValue);
                emailText.Append("\r\n");
                emailText.Append("VAT N.: " + userInfo.Profile.ProfileProperties["VATNo"].PropertyValue);
                emailText.Append("\r\n");
                emailText.Append("\r\n");

                //Billing Address
                _Message = Services.Localization.Localization.GetString("OrderBillingAddress", this.LocalResourceFile);

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.3.1", " ", "", "", "", "", "", "");

                emailText.Append(_Message);
                emailText.Append("\r\n");
                emailText.Append(billingAddress.Name);
                emailText.Append("\r\n");
                emailText.Append(billingAddress.Address1);

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.3.2", " ", "", "", "", "", "", "");

                if (billingAddress.Address2.Length > 0)
                {
                    emailText.Append("\r\n");
                    emailText.Append(billingAddress.Address2);
                }

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.4", " ", "", "", "", "", "", "");

                emailText.Append("\r\n");
                emailText.Append(billingAddress.City);
                emailText.Append("\r\n");
                emailText.Append(billingAddress.RegionCode);
                emailText.Append("\r\n");
                emailText.Append(billingAddress.PostalCode);
                emailText.Append("\r\n");
                emailText.Append(billingAddress.CountryCode);
                emailText.Append("\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.5", " ", "", "", "", "", "", "");

                //Shipping Address
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderShippingAddress", this.LocalResourceFile);
                emailText.Append(_Message);
                emailText.Append("\r\n");
                emailText.Append(shippingAddress.Name);
                emailText.Append("\r\n");
                emailText.Append(shippingAddress.Address1);
                emailText.Append("\r\n");
                if (shippingAddress.Address2.Length > 0)
                {
                    emailText.Append(shippingAddress.Address2);
                    emailText.Append("\r\n");
                }
                emailText.Append(shippingAddress.City);
                emailText.Append("\r\n");
                emailText.Append(shippingAddress.RegionCode);
                emailText.Append("\r\n");
                emailText.Append(shippingAddress.PostalCode);
                emailText.Append("\r\n");
                emailText.Append(shippingAddress.CountryCode);
                emailText.Append("\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.6", " ", "", "", "", "", "", "");

                //Email body footer
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderTermsOfUse", this.LocalResourceFile);
                emailText.Append(_Message);
                emailText.Append("\r\n");
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderCannotBeProcessed", this.LocalResourceFile);
                emailText.Append(_Message);
                emailText.Append("\r\n");
                emailText.Append("\r\n");
                _Message = Services.Localization.Localization.GetString("OrderThanks", this.LocalResourceFile);
                emailText.Append(_Message);
                emailText.Append("\r\n");
                emailText.Append("\r\n");
                emailText.Append("http://" + PortalSettings.PortalAlias.HTTPAlias);
                emailText.Append("\r\n");

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.7", " ", "", "", "", "", "", "");

                // send email
                SmtpClient smtpClient = new SmtpClient((string)DotNetNuke.Common.Globals.HostSettings["SMTPServer"]);
                DotNetNuke.Services.Mail.Mail mail = new DotNetNuke.Services.Mail.Mail();

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.8", " ", "", "", "", "", "", "");

                System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential((string)DotNetNuke.Common.Globals.HostSettings["SMTPUsername"], (string)DotNetNuke.Common.Globals.HostSettings["SMTPPassword"]);
                smtpClient.UseDefaultCredentials = false;
                smtpClient.Port = 25;
                smtpClient.EnableSsl = false;
                smtpClient.Credentials = networkCredential;

                //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 7.9", " ", "", "", "", "", "", "");

                MailMessage message = new MailMessage();
                try
                {
                    //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 8", " ", "", "", "", "", "", "");

                    MailAddress fromAddress = new MailAddress(storeEmail);

                    //From address will be given as a MailAddress Object
                    message.From = fromAddress;

                    // To address collection of MailAddress
                    message.To.Add(customerEmail);
                    _Message = Services.Localization.Localization.GetString("OrderSubject", this.LocalResourceFile);
                    message.Subject = String.Format(_Message, storeInfo.Name);

                    //Body can be Html or text format
                    //Specify true if it  is html message
                    message.IsBodyHtml = false;

                    message.BodyEncoding = Encoding.UTF8;

                    // Message body content
                    message.Body = emailText.ToString();

                    // Send SMTP mail
                    smtpClient.Send(message);

                    _Message = Services.Localization.Localization.GetString("OrderSubjectToAdmin", this.LocalResourceFile);
                    message.Subject = String.Format(_Message, orderInfo.OrderID);
                    message.To.Clear();
                    message.To.Add(storeEmail);
                    message.Priority = System.Net.Mail.MailPriority.High;
                    smtpClient.Send(message);
                    //Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 9", " ", "", "", "", "", "", "");

                }
                catch (Exception ex)
                {
                    Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation exception" + ex.Message + " " + ex.StackTrace, " ", "", "", "", "", "", "");

                }
                Mail.SendMail("*****@*****.**", "*****@*****.**", "", "Canadean Payment Processing - generateOrderConfirmation 10 " + orderInfo.OrderID , " ", "", "", "", "", "", "");
            }
        }