Exemplo n.º 1
0
        protected void ButtonMerge_Click(object sender, EventArgs e)
        {
            if (MultiView1.ActiveViewIndex == 0) //summary view
            {
                if (siteCodesToMerge.Count > 1)
                {
                    //merge the selected delivery points
                    int mainSiteCode = siteCodesToMerge[0];
                    siteCodesToMerge.RemoveAt(0);

                    int returnValue = RoutingController.MergeDeliveryPointsManually(RoutingHistoryId.Value, mainSiteCode, siteCodesToMerge);

                    switch (returnValue)
                    {
                    case 0:
                        siteCodesToMerge.Clear();
                        GridViewMergedPoints.DataBind();
                        break;

                    case -1:
                        DisplayMessage("Items from different delivery warehouse cannot be selected from merging.");
                        break;

                    case -2:
                    case -3:
                        DisplayMessage("Failed to Merge Items.");
                        break;
                    }
                }
                else
                {
                    DisplayMessage("You must select 2 or more items to merge.");
                }
            }
            else //detail view
            {
                ReturnToSummaryView();
            }
        }
Exemplo n.º 2
0
        protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            try
            {
                if (e.CurrentStepIndex == (int)StepsEnum.Define_Criteria &&
                    e.NextStepIndex == (int)StepsEnum.Refine_Shipments)
                {
                    if (ListBoxRegions.SelectedValue == "")
                    {
                        DisplayMessage("Please Select a Region.");
                        RoutingHistoryId = null;
                        e.Cancel         = true;
                        return;
                    }
                    else
                    {
                        try
                        {
                            RoutingHistoryId = RoutingController.SetOptrakLocks(User.Identity.Name, ListBoxRegions.SelectedValue, (RoutingController.PeriodEnum)RadioButtonListPeriod.SelectedIndex);

                            if (RoutingHistoryId == -2)
                            {
                                //there are no shipments matching the criteria to lock so display message to user
                                DisplayMessage("No shipments were found to Route.");
                                RoutingHistoryId = null;
                                e.Cancel         = true;
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            ExceptionPolicy.HandleException(ex, "User Interface");
                        }


                        if (RoutingHistoryId == null)
                        {
                            DisplayMessage(
                                "There was a problem locking the Shipments which match the specified criteria for Routing.",
                                DiscoveryMessageType.Error);
                            e.Cancel = true;
                        }
                        else
                        {
                            GridViewShipmentsToRefine.Sort("ShipmentName,pafpostcode,estimateddeliverydate",
                                                           SortDirection.Ascending);
                        }
                    }
                }

                else if (e.CurrentStepIndex == (int)StepsEnum.Refine_Shipments &&
                         e.NextStepIndex == (int)StepsEnum.Merge_Delivery_Points)
                {
                    List <TDCShipment> shipmentsToRemoveFromRouting = new List <TDCShipment>();

                    foreach (int shipmentId in ShipmentIdsToRemoveFromRouting)
                    {
                        TDCShipment tdcShipment = new TDCShipment();
                        tdcShipment.Id     = shipmentId;
                        tdcShipment.Status = Shipment.StatusEnum.Routing;
                        shipmentsToRemoveFromRouting.Add(tdcShipment);
                    }
                    e.Cancel = !RemoveItemsFromRouting(shipmentsToRemoveFromRouting);
                    if (!e.Cancel)
                    {
                        //merge their delivery points using Customer Name and PAF postcode
                        bool mergeWorked = false;
                        try
                        {
                            mergeWorked = RoutingController.MergeDeliveryPointsAutomatically(RoutingHistoryId.Value);
                        }
                        catch (Exception ex)
                        {
                            ExceptionPolicy.HandleException(ex, "User Interface");
                        }
                        if (!mergeWorked)
                        {
                            DisplayMessage("Merging of Delivery points failed.");
                            e.Cancel = true;
                        }

                        MultiView1.ActiveViewIndex = 0;
                        GridViewMergedPoints.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "User Interface"))
                {
                    DisplayMessage(ex);
                }
            }
        }
Exemplo n.º 3
0
 private void ReturnToSummaryView()
 {
     MultiView1.ActiveViewIndex = 0;
     GridViewMergedPoints.DataBind();
     ButtonMerge.Text = "Merge Selected Items";
 }