示例#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 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;
        }
示例#3
0
        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();
                }
            }
        }
示例#4
0
        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);
            }
        }
示例#5
0
        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();
            }
        }