private string GetOrderStatus(int orderStatusID, bool orderIsPlaced) { // canadean changed: allow to get the status of orders that aren't placed if (!orderIsPlaced) return "Not Placed"; if (orderStatusList == null) { OrderController orderController = new OrderController(); orderStatusList = orderController.GetOrderStatuses(); } string OrderStatusText = ""; foreach (OrderStatus orderStatus in orderStatusList) { if (orderStatus.OrderStatusID == orderStatusID) { OrderStatusText = orderStatus.OrderStatusText; break; } } return OrderStatusText; }
private void CancelOrder(int orderID) { OrderController orderController = new OrderController(); OrderInfo orderInfo = orderController.GetOrder(orderID); orderInfo.OrderStatusID = (int)OrderInfo.OrderStatusList.Cancelled; orderController.UpdateOrder(orderInfo.OrderID, orderInfo.OrderDate, orderInfo.OrderNumber, orderInfo.ShippingAddressID, orderInfo.BillingAddressID, orderInfo.Tax, orderInfo.ShippingCost, true, orderInfo.OrderStatusID, orderInfo.CustomerID); //SendOrderStatusChangeEmail(orderInfo.CustomerID, orderInfo.OrderID, GetOrderStatus(orderInfo.OrderStatusID), false, true); SendOrderStatusChangeEmail(orderInfo.CustomerID, orderInfo.OrderID, GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced), false, true); }
private void DisplayCustomerOrders() { OrderController orderController = new OrderController(); ArrayList orders = orderController.GetCustomerOrders(PortalId, customerNav.CustomerID); if (orders.Count > 0) { orderStatusList = orderController.GetOrderStatuses(); grdOrders.DataSource = orders; grdOrders.DataBind(); } else { lblError.Text = Localization.GetString("NoOrdersFound", this.LocalResourceFile); } }
protected void Page_Load(object sender, System.EventArgs e) { customerNav = new CustomerNavigation(Request.QueryString); lblError.Text = ""; //Initialize the Error Label. if (customerNav.PayPalExit != null) { switch (customerNav.PayPalExit.ToUpper()) { case "CANCEL": { customerNav.OrderID = Null.NullInteger; customerNav.PageID = "CustomerOrders"; customerNav.PayPalExit = null; //Response.Redirect(customerNav.GetNavigationUrl(), false); break; } case "RETURN": case "NOTIFY": { // Collect data, invoke success if (VerifyPayment()) { //Set order status to "Paid"... int orderID; if (!Int32.TryParse(Request.Form["invoice"], out orderID)) { } else { UpdateOrderStatus(orderID, OrderInfo.OrderStatusList.Paid); } customerNav.OrderID = Null.NullInteger; customerNav.PageID = "CustomerOrders"; customerNav.PayPalExit = null; //Response.Redirect(customerNav.GetNavigationUrl(), false); } else { TabController tabControler = new TabController(); TabInfo tabInfo = tabControler.GetTab(storeInfo.ShoppingCartPageID, storeInfo.PortalID, true); _Message = Localization.GetString("VerificationFailed", this.LocalResourceFile); lblPaymentError.Text = string.Format(_Message, tabInfo.TabName); lblPaymentError.Visible = true; customerNav.OrderID = Null.NullInteger; customerNav.PageID = "CustomerOrders"; customerNav.PayPalExit = null; //Response.Redirect(customerNav.GetNavigationUrl(), false); } break; } } } Store storeControl = parentControl as Store; if (storeControl != null) { storeControl.ParentTitle = lblParentTitle.Text; } if (ShowOrdersInStatus && OrderStatusID != Null.NullInteger) { plhGrid.Visible = true; plhForm.Visible = false; OrderController orderController = new OrderController(); ArrayList orders = orderController.GetOrders(PortalId, OrderStatusID); if (orders.Count > 0) { orderStatusList = orderController.GetOrderStatuses(); grdOrders.DataSource = orders; grdOrders.DataBind(); } else { lblError.Text = Localization.GetString("NoOrdersFound", this.LocalResourceFile); grdOrders.DataSource = null; grdOrders.DataBind(); } } else { if (customerNav.OrderID != Null.NullInteger) { plhGrid.Visible = false; //plhForm.Visible = true; if (customerNav.OrderID != 0) { lblEditTitle.Text = Localization.GetString("ViewDetails", this.LocalResourceFile); showOrderDetails(customerNav.OrderID); } } else { plhGrid.Visible = true; plhForm.Visible = false; if (customerNav.CustomerID == Null.NullInteger) { customerNav.CustomerID = UserId; } DisplayCustomerOrders(); } } }
private void btnPayViaPayPal_Click(object sender, EventArgs e) { OrderController orderController = new OrderController(); OrderInfo orderInfo = orderController.GetOrder(customerNav.OrderID); if (orderInfo.OrderStatusID == 2) { SetupPayPalFields(orderInfo); } }
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; } }
protected void btnSearch_Click(object sender, EventArgs e) { /* if (cbExport.Checked) // Export to excel option selected { //Response.Write("<!-- Going to export to excel -->"); string strFileName = "orders.xls"; int orderId = -1; int customerID = -1; int orderStatusID = -1; if (tbOrderNumber.Text.Length > 0) // Export only the given orderId { try { orderId = Convert.ToInt32(tbOrderNumber.Text); } catch (FormatException) { return; } } else if (lstCustomers.SelectedIndex > 0) // Export all the orders for a given customer { customerID = int.Parse(lstCustomers.SelectedValue); } else if (lstOrderStatus.SelectedIndex > 0) // Export all the orders with the specified status { try { orderStatusID = Convert.ToInt32(lstOrderStatus.SelectedValue); } catch (System.FormatException) { return; } } DataTable dtTemp = getOrdersData(orderId, customerID, orderStatusID); ExportToExcel(this.Context, strFileName, dtTemp); } */ if (tbOrderNumber.Text.Length > 0) { lstCustomers.ClearSelection(); lstOrderStatus.ClearSelection(); noOrdersFound.Visible = false; CustomerNavigation customerNav = new CustomerNavigation(Request.QueryString); try { customerNav.OrderID = Convert.ToInt32(tbOrderNumber.Text); } catch (FormatException) { customerNav.OrderID = Null.NullInteger; } if (customerNav.OrderID != Null.NullInteger) { OrderController orderController = new OrderController(); OrderInfo orderInfo = orderController.GetOrder(customerNav.OrderID); if (orderInfo != null) { customerNav.CustomerID = orderInfo.CustomerID; Response.Redirect(customerNav.GetNavigationUrl()); } else { customerNav.OrderID = Null.NullInteger; customerNav.CustomerID = Null.NullInteger; noOrdersFound.Visible = true; } } } else if (lstCustomers.SelectedIndex > 0) { lstOrderStatus.ClearSelection(); _nav.OrderID = Null.NullInteger; noOrdersFound.Visible = false; _nav.CustomerID = int.Parse(lstCustomers.SelectedValue); _nav.OrderID = Null.NullInteger; Response.Redirect(_nav.GetNavigationUrl()); } else if (lstOrderStatus.SelectedIndex > 0) { //_nav.CustomerID = Null.NullInteger; noOrdersFound.Visible = false; StoreControlBase ordersControl = (StoreControlBase)LoadControl(ModulePath + "CustomerOrders.ascx"); ordersControl.ParentControl = this.ParentControl; ((CustomerOrders)ordersControl).ShowOrdersInStatus = true; try { ((CustomerOrders)ordersControl).OrderStatusID = Convert.ToInt32(lstOrderStatus.SelectedValue); } catch (System.FormatException) { return; } plhOrders.Controls.Clear(); plhOrders.Controls.Add(ordersControl); plhOrders.Visible = true; } }
/// <summary> /// This event should occur each time a change is made to the cart. /// All of the Checkout controls should be updated with the new cart information and the /// order updated. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cartControl_EditComplete(object sender, EventArgs e) { OrderController orderController = new OrderController(); CartInfo cartInfo = CurrentCart.GetInfo(PortalId); if (cartInfo != null & _orderInfo != null) { _orderInfo = orderController.UpdateOrderDetails(_orderInfo.OrderID, cartInfo.CartID); } CalculateTaxandShipping(_orderInfo); updateCheckoutOrder(_orderInfo); }
private OrderInfo CreateOrder() { // Associate cart with this user CartController cartController = new CartController(); cartController.UpdateCart(CurrentCart.GetInfo(PortalId).CartID, UserId); // Create order (copies cart to create order) OrderController orderController = new OrderController(); OrderInfo orderInfo = orderController.CreateOrder(CurrentCart.GetInfo(PortalId).CartID); if (orderInfo != null) { SetOrderIdCookie(orderInfo.OrderID); } return orderInfo; }
public OrderInfo GetOrderDetails() { OrderController orderController = new OrderController(); return orderController.GetOrder(_orderInfo.OrderID); }
protected void Page_Load(object sender, System.EventArgs e) { //Response.Write("Page_Load"); // return; if (_storeInfo == null) { StoreController storeController = new StoreController(); _storeInfo = storeController.GetStoreInfo(PortalId); if (_storeInfo.CurrencySymbol != string.Empty) { LocalFormat.CurrencySymbol = _storeInfo.CurrencySymbol; } if (_storeInfo.PortalTemplates) { CssTools.AddCss(this.Page, PortalSettings.HomeDirectory + "Store", PortalId); } else { CssTools.AddCss(this.Page, this.TemplateSourceDirectory, PortalId); } } lblGatewayTitle.Visible = false; if (forceSSL()) { SSLHelper.RequestSecurePage(); } //Mail.SendMail(PortalSettings.Email, "*****@*****.**", "", "Canadean Checkout ", " ", "", "", "", "", "", ""); if (Request.QueryString["WorldPayExit"] != null) { //Mail.SendMail(PortalSettings.Email, "*****@*****.**", "", "Canadean Payment Checkout - " + Request.QueryString["WorldPayExit"], " ", "", "", "", "", "", ""); loadPaymentControl(); return; } loadCartControl(); loadAddressControl(); loadPaymentControl(); loadTaxCheckoutControl(); loadShippingCheckoutControl(); _orderInfo = GetExistingOrder(); updateCheckoutAddress(); if (Request.QueryString["PayPalExit"] == null) { if (!this.Page.IsPostBack) { if (_orderInfo == null) { _orderInfo = CreateOrder(); } //Update the order details with the most recent cart items. OrderController orderController = new OrderController(); CartInfo cartInfo = CurrentCart.GetInfo(PortalId); if (cartInfo != null & _orderInfo != null) { _orderInfo = orderController.UpdateOrderDetails(_orderInfo.OrderID, cartInfo.CartID); } } CalculateTaxandShipping(_orderInfo); updateCheckoutOrder(_orderInfo); updateStoreInfo(); } }
/// <summary> /// Calculate the final order and place it into a "waiting for payment" state. /// </summary> /// <returns>OrderInfo with the final cart, tax, and shipping totals.</returns> public OrderInfo GetFinalizedOrderInfo() { // Save the address information, so that it can be associated with the order. // // NOTE: This may just update the address with duplicate information, but it is easier than // trying to determine if a change was made the existing address. In the future the // AddressProvider may be able to supply a "Modified" property. AddressController controller = new AddressController(); int m_BillingAddressID = 0; int m_ShippingAddressID = 0; if (Null.IsNull(BillingAddress.AddressID) || BillingAddress.AddressID == -1) { BillingAddress.PortalID = this.PortalId; BillingAddress.UserID = this.UserId; m_BillingAddressID = controller.AddAddress(BillingAddress); } else { controller.UpdateAddress(BillingAddress); } if (Null.IsNull(ShippingAddress.AddressID) || ShippingAddress.AddressID == -1) { ShippingAddress.PortalID = this.PortalId; ShippingAddress.UserID = this.UserId; if (ShippingAddress.Address1.Length == 0) { m_ShippingAddressID = controller.AddAddress(BillingAddress); } else { m_ShippingAddressID = controller.AddAddress(ShippingAddress); } } else { controller.UpdateAddress(ShippingAddress); } //Now that the addresses are saved update the tax and shipping. //CalculateTaxandShipping(_orderInfo); //Save order details OrderController orderController = new OrderController(); orderController.UpdateOrder(_orderInfo.OrderID, System.DateTime.Now, "", m_ShippingAddressID, m_BillingAddressID, _orderInfo.Tax, _orderInfo.ShippingCost, true, 1, UserId); BillingAddress = controller.GetAddress(m_BillingAddressID); ShippingAddress = controller.GetAddress(m_ShippingAddressID); //throw new NotImplementedException("gfhgfH"); return _orderInfo; }
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; }
protected void Page_Load(object sender, System.EventArgs e) { _nav = new AdminNavigation(Request.QueryString); if (!IsPostBack) { OrderController orderController = new OrderController(); lstCustomers.DataTextField = "Username"; lstCustomers.DataValueField = "UserID"; lstCustomers.DataSource = orderController.GetCustomers(PortalId); lstCustomers.DataBind(); lstCustomers.Items.Insert(0, new ListItem("--- " + Localization.GetString("Select", this.LocalResourceFile) + " ---", "")); lstOrderStatus.DataTextField = "OrderStatusText"; lstOrderStatus.DataValueField = "OrderStatusID"; lstOrderStatus.DataSource = orderController.GetOrderStatuses(); lstOrderStatus.DataBind(); lstOrderStatus.Items.Insert(0, new ListItem("--- " + Localization.GetString("Select", this.LocalResourceFile) + " ---", "")); } if (_nav.CustomerID != Null.NullInteger) { lstCustomers.SelectedValue = _nav.CustomerID.ToString(); StoreControlBase ordersControl = (StoreControlBase)LoadControl(ModulePath + "CustomerOrders.ascx"); ordersControl.ParentControl = this.ParentControl; ((CustomerOrders)ordersControl).ShowOrdersInStatus = false; ((CustomerOrders)ordersControl).OrderStatusID = Null.NullInteger; plhOrders.Controls.Clear(); plhOrders.Controls.Add(ordersControl); plhOrders.Visible = true; } if (_nav.OrderID != Null.NullInteger) { tbOrderNumber.Text = _nav.OrderID.ToString(); } }
private void lnkbtnSave_Click(object sender, EventArgs e) { //Update the order status... OrderController orderController = new OrderController(); OrderInfo orderInfo = orderController.GetOrder(customerNav.OrderID); if (orderInfo != null) { orderController.UpdateOrder(orderInfo.OrderID, orderInfo.OrderDate, orderInfo.OrderNumber, orderInfo.ShippingAddressID, orderInfo.BillingAddressID, orderInfo.Tax, orderInfo.ShippingCost, true, Convert.ToInt32(ddlOrderStatus.SelectedValue), orderInfo.CustomerID); SendOrderStatusChangeEmail(orderInfo.CustomerID, orderInfo.OrderID, ddlOrderStatus.SelectedItem.Text, ddlOrderStatus.SelectedItem.Value == "2", false); customerNav.OrderID = Null.NullInteger; Response.Redirect(customerNav.GetNavigationUrl(), false); } }
/// <summary> /// Retrieve the current order from the database as is. /// </summary> /// <returns></returns> private OrderInfo GetExistingOrder() { OrderController orderController = new OrderController(); OrderInfo orderInfo = null; int orderID = GetOrderIDFromCookie(); if (orderID >= 0) { try { orderInfo = orderController.GetOrder(orderID); } catch { orderInfo = null; } } return orderInfo; }
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); }
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; }
private OrderInfo UpdateOrderStatus(int orderID, OrderInfo.OrderStatusList orderStatus) { OrderController orderController = new OrderController(); OrderInfo order = orderController.GetOrder(orderID); switch (orderStatus) { case OrderInfo.OrderStatusList.Cancelled: order.OrderStatusID = 6; break; case OrderInfo.OrderStatusList.Paid: order.OrderStatusID = 7; break; } orderController.UpdateOrder(order.OrderID, order.OrderDate, order.OrderNumber, order.ShippingAddressID, order.BillingAddressID, order.Tax, order.ShippingCost, true, order.OrderStatusID, order.CustomerID); return order; }
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 , " ", "", "", "", "", "", ""); } }