예제 #1
0
        public void RefreshPossibleTickets()
        {
            string query = "Select * from FC_TripTicket where Is_Complete = 0 and CurrentLocation = \"" + PassedInContract.Origin + "\" and not Size_in_Palettes = 0;";

            FC_TripTicket        t                = new FC_TripTicket();
            List <FC_TripTicket> OtherTickets     = t.ObjToTable(SQL.Select(t, query));
            List <FC_TripTicket> ValidatedTickets = new List <FC_TripTicket>();

            foreach (FC_TripTicket x in OtherTickets)
            {
                List <FC_LocalContract> ContractsForTicket = PlannerClass.ContractsPerTicket_Populate(x);

                bool matchfound = false;

                foreach (FC_LocalContract y in ContractsForTicket)
                {
                    if (y.FC_LocalContractID == PassedInContract.FC_LocalContractID)
                    {
                        matchfound = true;
                    }

                    if (y.Van_type != PassedInContract.Van_type)
                    {
                        matchfound = true;
                    }
                }

                if (!matchfound)
                {
                    ValidatedTickets.Add(x);
                }
            }

            PossibleTickets.ItemsSource = ValidatedTickets;
        }
예제 #2
0
        private void RefreshNomCarriers()
        {
            List <CarrierWithDepot_View> PotentialDepots = PlannerClass.GetNomCarriers_withDepot(PassedInContract);
            List <CarrierWithDepot_View> OutDepots       = new List <CarrierWithDepot_View>();

            foreach (CarrierWithDepot_View x in PotentialDepots)
            {
                if (PassedInContract.Job_type == 0)
                {
                    if (x.FTL_Availibility > 0)
                    {
                        OutDepots.Add(x);
                    }
                }
                else
                {
                    if (x.LTL_Availibility > 0)
                    {
                        OutDepots.Add(x);
                    }
                }
            }

            NominatedCarrierDG.ItemsSource = OutDepots;
        }
예제 #3
0
 private void RefeshPendingTickets_Click(object sender, RoutedEventArgs e)
 {
     PlannerClass.PendingTickets.Clear();
     PlannerClass.PendingTickets  = PlannerClass.TicketsWithStatus_Populate(0);//0 is pending
     DGPendingTickets.ItemsSource = null;
     DGPendingTickets.ItemsSource = PlannerClass.PendingTickets;
 }
예제 #4
0
 private void RefreshConfirmed_Click(object sender, RoutedEventArgs e)
 {
     PlannerClass.ToBeConfirmedContracts.Clear();
     PlannerClass.ToBeConfirmedContracts = PlannerClass.ContractsByStatus_Populate(2);
     DGConfirmCompletion.ItemsSource     = null;
     DGConfirmCompletion.ItemsSource     = PlannerClass.ToBeConfirmedContracts;
 }
예제 #5
0
        private void DG5_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PlannerClass.ContractsPerTicket.Clear();

            foreach (FC_TripTicket_WProgress c in DG5.SelectedItems)
            {
                PlannerClass.ContractsPerTicket = PlannerClass.ContractsPerTicket_Populate(c.instance);

                foreach (FC_LocalContract x in PlannerClass.ContractsPerTicket)
                {
                    string query = "select * from FC_TripTicketLine where FC_TripTicketID = " + c.instance.FC_TripTicketID.ToString() + " and FC_LocalContractID =  " + x.FC_LocalContractID.ToString() + " ;";

                    FC_TripTicketLine        t             = new FC_TripTicketLine();
                    List <FC_TripTicketLine> theTicketLine = t.ObjToTable(SQL.Select(t, query));

                    x.Quantity = theTicketLine[0].PalletsOnTicket;
                }

                PlannerClass.RoutSegsPerTicket_Populate(c.instance);
            }

            DG6.ItemsSource = null;
            DG6.ItemsSource = PlannerClass.ContractsPerTicket;
            DG7.ItemsSource = null;
            DG7.ItemsSource = PlannerClass.RouteSegsPerTicket;
        }
예제 #6
0
 private void RefreshActiveContracts_Click(object sender, RoutedEventArgs e)
 {
     PlannerClass.ActiveContracts.Clear();
     PlannerClass.ActiveContracts   = PlannerClass.ContractsByStatus_Populate(1);
     DGActiveContracts.ItemsSource  = null;
     DGActiveContracts.ItemsSource  = PlannerClass.ActiveContracts;
     DGConnectedTickets.ItemsSource = null;
 }
예제 #7
0
        private void Complete_Click(object sender, RoutedEventArgs e)
        {
            PlannerClass.DeleteNominations(PassedInContract);
            PlannerClass.UpdateContratState(PassedInContract, 1);

            PlannerPage newpage = new PlannerPage();

            this.NavigationService.Navigate(newpage);
        }
예제 #8
0
        private void InvoiceDG_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (InvoiceDG.SelectedItem != null)
            {
                FC_Invoice SelectedInvoice = (FC_Invoice)InvoiceDG.SelectedItem;

                ContractsPreInvouce.ItemsSource = PlannerClass.GetContracts_PreInvoice(SelectedInvoice);
            }
        }
예제 #9
0
 private void DGActiveContracts_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     foreach (FC_LocalContract c in DGActiveContracts.SelectedItems)
     {
         PlannerClass.ConnectedTickets_Populate(c);
     }
     DGConnectedTickets.ItemsSource = null;
     DGConnectedTickets.ItemsSource = PlannerClass.ConnectedTickets;
 }
예제 #10
0
        private void DGCustomers_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BuyerClass.ContractsForCustomer.Clear();
            foreach (Cust_Price c in DGCustomers.SelectedItems)
            {
                BuyerClass.ContractsForCustomer = PlannerClass.ContractsByName_Populate(c.Client_Name);
            }

            DGContractsForCustomer.ItemsSource = BuyerClass.ContractsForCustomer;
        }
예제 #11
0
        private void StartSelectedTicket_Click(object sender, RoutedEventArgs e)
        {
            foreach (FC_TripTicket x in PlannerClass.PendingTickets)
            {
                PlannerClass.UpdateTicketState(x, 1);
                x.Is_Complete = 1;
            }

            RefeshPendingTickets_Click(null, null);
        }
예제 #12
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            foreach (FC_LocalContract c in DGConfirmCompletion.SelectedItems)
            {
                PlannerClass.UpdateContratState(c, 3);
            }

            PlannerClass.ConfirmedContracts.Clear();
            PlannerClass.ConfirmedContracts = PlannerClass.ContractsByStatus_Populate(2);
            DGConfirmCompletion.ItemsSource = null;
            DGConfirmCompletion.ItemsSource = PlannerClass.ConfirmedContracts;
        }
        private void ConfirmInvoice_Click(object sender, RoutedEventArgs e)
        {
            if (BuyerClass.SelectedForInvoice != null && BuyerClass.SelectedForInvoice.Count > 0)
            {
                FC_Invoice invTemp = PlannerClass.GenerateInvoice(BuyerClass.SelectedForInvoice[0]);
                PlannerClass.InsertInvoice(invTemp, BuyerClass.SelectedForInvoice[0]);
                PlannerClass.UpdateContratState(BuyerClass.SelectedForInvoice[0], 4);

                BuyerClass.SelectedForInvoice.Remove(BuyerClass.SelectedForInvoice[0]);

                foreach (FC_LocalContract c in BuyerClass.SelectedForInvoice)
                {
                    PlannerClass.AddContractToInvoices(invTemp, c);
                    PlannerClass.UpdateContratState(c, 4);
                }


                InvoiceForFileSystem fsIn = new InvoiceForFileSystem(invTemp);


                try
                {
                    string invoiceDir = Directory.GetCurrentDirectory() + "\\Invoices";

                    FileInfo fi = new FileInfo(invoiceDir);
                    if (fi.Exists == false)
                    {
                        Directory.CreateDirectory(invoiceDir);
                    }

                    string filePath = "\\invoice_" + fsIn.FC_InvoiceID + ".txt";

                    /// Open the filestream to append to the file.
                    FileStream   fileStream = new FileStream(invoiceDir + filePath, FileMode.Create, FileAccess.Write);
                    StreamWriter fileWriter = new StreamWriter(fileStream);

                    /// Add each log entry from the working list to the file as a BSV
                    fileWriter.WriteLine(fsIn.ToString());
                    fileWriter.Flush();

                    /// Close the file
                    fileWriter.Close(); fileStream.Close();
                }
                /// If an exception is thrown here, catch it
                catch (Exception ex)
                {
                    TMSLogger.LogIt("|" + "/InvoiceSelection.xaml.cs" + "|" + "InvoiceSelection" + "|" + "ConfirmInvoice_Click" + "|" + ex.GetType().ToString() + "|" + ex.Message + "|");
                }
                BuyerPage newpage = new BuyerPage();
                this.NavigationService.Navigate(newpage);
            }
        }
예제 #14
0
        private void SetOrderToComplete_Click(object sender, RoutedEventArgs e)
        {
            foreach (FC_LocalContract c in DGActiveContracts.SelectedItems)
            {
                PlannerClass.UpdateContratState(c, 2);
            }

            PlannerClass.ActiveContracts.Clear();
            PlannerClass.ActiveContracts   = PlannerClass.ContractsByStatus_Populate(1);
            DGActiveContracts.ItemsSource  = null;
            DGActiveContracts.ItemsSource  = PlannerClass.ActiveContracts;
            DGConnectedTickets.ItemsSource = null;
        }
예제 #15
0
        public AttatchTicketPage(object data) : this()
        {
            FC_LocalContract ReadInContract = (FC_LocalContract)data;

            PassedInContract = ReadInContract;

            List <FC_TripTicket> ContractsTickets = PlannerClass.CreateTicketsFromContract(ReadInContract);

            AllTickets.ItemsSource = ContractsTickets;

            RefreshNomCarriers();
            RefreshPossibleTickets();
        }
예제 #16
0
        private void RefreshActiveTickets_Click(object sender, RoutedEventArgs e)
        {
            progresses.Clear();
            PlannerClass.ActiveTickets.Clear();
            PlannerClass.ActiveTickets = PlannerClass.TicketsWithStatus_Populate(1);

            foreach (FC_TripTicket c in PlannerClass.ActiveTickets)
            {
                FC_TripTicket_WProgress temp = new FC_TripTicket_WProgress(c);
                temp.GetTicketProgress(temp.instance);
                progresses.Add(temp);
            }
            DG5.ItemsSource = null;
            DG5.ItemsSource = progresses;
        }
예제 #17
0
        public void PlannerClass_MinimumSurfaceInterval_AllValues()
        {
            TimeSpan zeroHours  = new TimeSpan(0, 0, 0);
            TimeSpan oneHour    = new TimeSpan(1, 0, 0);
            TimeSpan threeHours = new TimeSpan(3, 0, 0);

            Assert.AreEqual(zeroHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('A'), "Unexpected value for 'A'");
            Assert.AreEqual(zeroHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('1'), "Unexpected value for '1'");
            Assert.AreEqual(zeroHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz(' '), "Unexpected value for ' '");
            Assert.AreEqual(zeroHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('_'), "Unexpected value for '_'");

            Assert.AreEqual(oneHour, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('W'), "Unexpected value for 'W'");
            Assert.AreEqual(oneHour, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('X'), "Unexpected value for 'X'");
            Assert.AreEqual(threeHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('Y'), "Unexpected value for 'Y'");
            Assert.AreEqual(threeHours, PlannerClass.AdjustMinimumSurfaceIntervalForRuleWxyz('Z'), "Unexpected value for 'Z'");
        }
예제 #18
0
 private void LoadContracts_Click(object sender, RoutedEventArgs e)
 {
     NomContractList.ItemsSource = PlannerClass.GetNominatedContracts();
     NomContractList.Items.Refresh();
 }
예제 #19
0
 private void VeiwTwoWeekButton_Click(object sender, RoutedEventArgs e)
 {
     InvoiceDG.ItemsSource           = PlannerClass.TwoWeekInvoices();
     ContractsPreInvouce.ItemsSource = null;
 }
예제 #20
0
 private void ViewAllButton_Click(object sender, RoutedEventArgs e)
 {
     InvoiceDG.ItemsSource           = PlannerClass.GetAllInvoices();
     ContractsPreInvouce.ItemsSource = null;
 }
예제 #21
0
파일: Program.cs 프로젝트: donsonLiu/ERDPML
 private static void Main(string[] args)
 {
     PlannerClass plannerClass = PlannerClass.Instance;
 }
예제 #22
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            List <FC_TripTicket> ticketsFromScreen = new List <FC_TripTicket>();

            if (SelectedTicket != null)
            {
                if (this.NominatedCarrierDG.SelectedItem != null && SelectedTicket != null)
                {
                    CarrierWithDepot_View t          = (CarrierWithDepot_View)NominatedCarrierDG.SelectedCells[0].Item;
                    FC_Carrier            selCarrier = new FC_Carrier(t.FC_CarrierID, t.Carrier_Name);

                    CreateTripInfo tripInfo = new CreateTripInfo(PassedInContract, selCarrier, SelectedTicket);

                    int AvalType = t.LTL_Availibility - 1;

                    if (SelectedTicket.Size_in_Palettes == 0)
                    {
                        AvalType = t.FTL_Availibility - 1;
                    }

                    SQL.UpdateDepotAvalibility(t.FC_CarrierID, t.CityName, SelectedTicket.Size_in_Palettes, AvalType);

                    ticketsFromScreen = new List <FC_TripTicket>();

                    foreach (FC_TripTicket x in AllTickets.Items)
                    {
                        if (x.FC_TripTicketID != SelectedTicket.FC_TripTicketID)
                        {
                            ticketsFromScreen.Add(x);
                        }
                    }

                    AllTickets.ItemsSource = ticketsFromScreen;

                    if (ticketsFromScreen.Count == 0)
                    {
                        Complete.IsEnabled     = true;
                        ExitMessage.Visibility = Visibility.Hidden;
                    }
                }
                else if (this.PossibleTickets.SelectedItem != null)
                {
                    FC_TripTicket ExcistingTicket = (FC_TripTicket)this.PossibleTickets.SelectedItem;

                    int PalletesAddedToTicket = PlannerClass.AddContractToTicket(ExcistingTicket, SelectedTicket, PassedInContract);

                    if (PalletesAddedToTicket != -1)
                    {
                        SelectedTicket.Size_in_Palettes -= PalletesAddedToTicket;

                        foreach (FC_TripTicket x in AllTickets.Items)
                        {
                            if (x.FC_TripTicketID == SelectedTicket.FC_TripTicketID)
                            {
                                x.Size_in_Palettes = SelectedTicket.Size_in_Palettes;

                                if (x.Size_in_Palettes > 0)
                                {
                                    ticketsFromScreen.Add(x);
                                }
                            }
                        }

                        AllTickets.ItemsSource = ticketsFromScreen;

                        if (ticketsFromScreen.Count == 0)
                        {
                            Complete.IsEnabled     = true;
                            ExitMessage.Visibility = Visibility.Hidden;
                        }
                    }
                }
            }

            this.NominatedCarrierDG.UnselectAll();
            this.PossibleTickets.UnselectAll();

            RefreshNomCarriers();
            RefreshPossibleTickets();
        }