Beispiel #1
0
        private void Complete_Click(object sender, RoutedEventArgs e)
        {
            PlannerClass.DeleteNominations(PassedInContract);
            PlannerClass.UpdateContratState(PassedInContract, 1);

            PlannerPage newpage = new PlannerPage();

            this.NavigationService.Navigate(newpage);
        }
Beispiel #2
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);
            }
        }
Beispiel #4
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;
        }