示例#1
0
        protected void grdOrders_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderInfo order = (OrderInfo)e.Item.DataItem;

                //Order Date
                Label lblOrderDateText = (Label)e.Item.FindControl("lblOrderDateText");
                lblOrderDateText.Text = order.OrderDate.ToString(_orderDateFormat);

                //Order Status
                Label lblOrderStatusText = (Label)e.Item.FindControl("lblOrderStatusText");
                lblOrderStatusText.Text = GetOrderStatus(order.OrderStatusID);

                //Order Total
                Label lblOrderTotalText = (Label)e.Item.FindControl("lblOrderTotalText");
                lblOrderTotalText.Text = order.GrandTotal.ToString("C", _localFormat);

                //Ship Date (Status Date)
                Label lblShipDateText = (Label)e.Item.FindControl("lblShipDateText");
                if (order.OrderStatusID > 1)
                {
                    lblShipDateText.Text = order.ShipDate.ToString(_orderDateFormat);
                }
                else
                {
                    lblShipDateText.Text = "";
                }

                //Edit-Details link
                HyperLink lnkEdit = (HyperLink)e.Item.FindControl("lnkEdit");
                if (lnkEdit != null)
                {
                    _customerNav.OrderID    = order.OrderID;
                    _customerNav.CustomerID = order.CustomerID;
                    lnkEdit.NavigateUrl     = _customerNav.GetNavigationUrl();
                }

                //Cancel link
                if (_canManageOrders || StoreSettings.AuthorizeCancel)
                {
                    LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel");
                    if (lnkCancel != null)
                    {
                        if (order.OrderStatusID == (int)OrderInfo.OrderStatusList.AwaitingPayment ||
                            order.OrderStatusID == (int)OrderInfo.OrderStatusList.AwaitingStock ||
                            order.OrderStatusID == (int)OrderInfo.OrderStatusList.Paid)
                        {
                            lnkCancel.CommandArgument = order.OrderID.ToString();
                            lnkCancel.Click          += lnkCancel_Click;
                            lnkCancel.Enabled         = true;
                        }
                        else
                        {
                            lnkCancel.Enabled = false;
                        }
                    }
                }
            }
        }
示例#2
0
        protected void btnPayNow_Click(object sender, EventArgs e)
        {
            int orderID;

            if (Int32.TryParse(((Button)sender).CommandArgument, out orderID))
            {
                // Get order details
                List <OrderDetailInfo> details = _orderController.GetOrderDetails(orderID);
                if (details != null)
                {
                    bool secureCookies = StoreSettings.SecureCookie;
                    // Populate cart with order details
                    foreach (OrderDetailInfo detail in details)
                    {
                        CurrentCart.AddItem(PortalId, secureCookies, detail.ProductID, detail.Quantity);
                    }
                    // Set cookie and redirect to checkout page
                    SetOrderIdCookie(orderID);
                    _customerNav = new CustomerNavigation
                    {
                        PageID = "checkout"
                    };
                    Response.Redirect(_customerNav.GetNavigationUrl(), true);
                }
            }
        }
示例#3
0
 protected void btnDownloads_Click(object sender, EventArgs e)
 {
     _nav = new CustomerNavigation {
         PageID = "CustomerDownloads"
     };
     Response.Redirect(_nav.GetNavigationUrl(), true);
 }
示例#4
0
        private void CheckState(int itemsCount)
        {
            if (itemsCount <= 0)
            {
                lblCheckout.Text         = Localization.GetString("AddItemsToCheckout", LocalResourceFile);
                pCheckoutMessage.Visible = false;
            }
            else
            {
                // Check if the checkout mode screen have to be displayed
                bool   canCheckout     = true;
                string checkoutMessage = "";
                switch (StoreSettings.CheckoutMode)
                {
                case CheckoutType.Registred:
                    if (IsLogged == false)
                    {
                        checkoutMessage  = Localization.GetString("RegistrationRequired", LocalResourceFile);
                        lblCheckout.Text = Localization.GetString("LoginToCheckout", LocalResourceFile);
                        canCheckout      = false;
                    }
                    break;

                case CheckoutType.UserChoice:
                    if (IsLogged == false)
                    {
                        checkoutMessage  = Localization.GetString("RegistrationUserChoice", LocalResourceFile);
                        lblCheckout.Text = Localization.GetString("btnCheckout", LocalResourceFile);
                        canCheckout      = false;
                    }
                    break;

                case CheckoutType.Anonymous:
                    lblCheckout.Text = Localization.GetString("btnCheckout", LocalResourceFile);
                    break;

                default:
                    break;
                }
                if (canCheckout == false)
                {
                    lblCheckoutMode.Text     = checkoutMessage;
                    pCheckoutMessage.Visible = true;
                }
                else
                {
                    CustomerNavigation nav = new CustomerNavigation
                    {
                        PageID = "Checkout"
                    };
                    Response.Redirect(nav.GetNavigationUrl(), true);
                }
            }
        }
示例#5
0
        private string OrderNavigation()
        {
            CustomerNavigation nav = new CustomerNavigation
            {
                TabID      = TabId,
                PageID     = "CustomerOrders",
                CustomerID = Order.CustomerID,
                OrderID    = Order.OrderID
            };

            return(nav.GetNavigationUrl());
        }
示例#6
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            if (_itemsCount <= 0)
            {
                Response.Redirect(Globals.NavigateURL(StoreSettings.StorePageID), true);
            }
            else if (StoreSettings.CheckoutMode == CheckoutType.Registred && IsLogged == false)
            {
                string returnURL      = Request.RawUrl;
                int    posReturnParam = returnURL.IndexOf("?returnurl=");
                if (posReturnParam != Null.NullInteger)
                {
                    returnURL = returnURL.Substring(0, posReturnParam);
                }
                returnURL = "returnurl=" + HttpUtility.UrlEncode(returnURL);

                if (PortalSettings.LoginTabId != Null.NullInteger && string.IsNullOrEmpty(Request.QueryString["override"]))
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.LoginTabId, "", new string[] { returnURL }), true);
                }
                else
                {
                    int targetTabId = PortalSettings.HomeTabId;
                    if (targetTabId == Null.NullInteger)
                    {
                        targetTabId = TabId;
                    }
                    Response.Redirect(Globals.NavigateURL(targetTabId, "login", new string[] { returnURL }), true);
                }
            }
            else
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    CustomerNavigation nav = new CustomerNavigation
                    {
                        PageID = "Checkout"
                    };
                    Response.Redirect(nav.GetNavigationUrl(), true);
                }
            }
        }
示例#7
0
 private void editControl_EditComplete(object sender, EventArgs e)
 {
     _accountNav.AddressID = Null.NullString;
     Response.Redirect(_accountNav.GetNavigationUrl(), true);
 }
示例#8
0
        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;
            }
        }
示例#9
0
 private void accountControl_EditComplete(object sender, EventArgs e)
 {
     Response.Redirect(_nav.GetNavigationUrl(), true);
 }