Beispiel #1
0
        public List <int> ExportOrders(List <int> orderIDs, string userName)
        {
            Facade.ExportOrder facExportOrder = new Facade.ExportOrder();
            List <int>         retVal         = facExportOrder.Create(orderIDs, userName);

            return(retVal);
        }
Beispiel #2
0
        //-----------------------------------------------------------------------------------------------------------

        protected void btnExport_Click(object sender, EventArgs e)
        {
            Facade.ExportOrder facExportOrder   = new Facade.ExportOrder();
            List <int>         orderIds         = new List <int>();
            List <int>         exportedOrderIds = new List <int>();
            bool noPalletValues = false;

            // Update the exported rows by changing their colours
            foreach (GridDataItem item in grdOrders.Items)
            {
                CheckBox chkOrderId = (CheckBox)item.FindControl("chkSelectOrder");
                int      orderId;
                int.TryParse(chkOrderId.Attributes["OrderID"].ToString(), out orderId);

                if (chkOrderId.Checked)
                {
                    EF.Order order = EF.DataContext.Current.OrderSet.Include("VigoOrder").FirstOrDefault(o => o.OrderId == orderId);
                    noPalletValues = (order.VigoOrder.QtrPallets == 0 &&
                                      order.VigoOrder.HalfPallets == 0 &&
                                      order.VigoOrder.FullPallets == 0 &&
                                      order.VigoOrder.OverPallets == 0) ||
                                     order.Weight == 0;

                    if (noPalletValues)
                    {
                        item.BackColor = System.Drawing.Color.LightBlue;
                    }

                    orderIds.Add(orderId);
                }
            }

            if (!noPalletValues)
            {
                exportedOrderIds = facExportOrder.Create(orderIds, this.Page.User.Identity.Name);

                this.grdOrders.DataSource = null;
                this.grdOrders.Rebind();
            }
        }
Beispiel #3
0
        protected void btnExportOrder_Click(object sender, EventArgs e)
        {
            // The following list will contain the ids of ALL the checked orders.
            List <int> orderIds = this.OrdersList;

            // The following list will only contain ids for the checked orders that
            // have been exported
            List <int> exportedOrderIds = null;

            if (orderIds.Count > 0)
            {
                Facade.ExportOrder facExportOrder = new Facade.ExportOrder();
                exportedOrderIds = facExportOrder.Create(orderIds, this.Page.User.Identity.Name);

                // Update the exported rows by changing their colours
                foreach (GridDataItem item in grdDeliveries.Items)
                {
                    int orderId;
                    int.TryParse(item.OwnerTableView.DataKeyValues[item.ItemIndex]["OrderID"].ToString(), out orderId);

                    if (exportedOrderIds.Contains(orderId))
                    {
                        item.BackColor = System.Drawing.Color.Violet;
                    }
                }

                if (orderIds.Count != exportedOrderIds.Count)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ExportPartialSuccess", "alert('It was not possible to export all of the selected orders. Note that orders that have been imported from a third party system cannot be exported.');", true);
                }
            }
            else // no orders selected
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "NoOrdersToExport", "alert('Please select the orders you wish to export by ticking the checkboxes on the left.');", true);
            }
        }
        //-----------------------------------------------------------------------------------------------------------

        protected void btnExport_Click(object sender, EventArgs e)
        {
            Facade.ExportOrder facExportOrder   = new Facade.ExportOrder();
            List <int>         orderIds         = new List <int>();
            List <int>         exportedOrderIds = new List <int>();

            // Update the exported rows by changing their colours
            foreach (GridDataItem item in grdOrders.Items)
            {
                CheckBox chkOrderId = (CheckBox)item.FindControl("chkSelectOrder");
                int      orderId;
                int.TryParse(chkOrderId.Attributes["OrderID"].ToString(), out orderId);

                if (chkOrderId.Checked)
                {
                    orderIds.Add(orderId);
                }
            }

            exportedOrderIds = facExportOrder.Create(orderIds, this.Page.User.Identity.Name);

            this.grdOrders.DataSource = null;
            this.grdOrders.Rebind();
        }