コード例 #1
0
        // This will run when the user wants to save a quote
        private void SaveQuote()
        {
            DateTime currentDate = DateTime.Now;

            // Create a quote object
            DeskQuote quoteInfo = new DeskQuote(quoteFirstName, quoteLastName, currentDate.ToString("MM/dd/yyyy H:mm tt"), userDesk.getTotalCost(), quoteMaterial, userDesk);

            // Add the quote to a list of quotes
            DeskQuote.listOfQuotes.Add(quoteInfo);

            // Now write the quote to file
            quoteInfo.convertListToJson();

            MessageBox.Show("Quote Saved");
        }
コード例 #2
0
        // Button for saving the quote to a JSON file
        private void SaveQuoteButton_Click(object sender, EventArgs e)
        {
            DateTime currentDate = DateTime.Now;

            // Create a quote object
            // TODO: Change my name into the variables.  Hardcoded for testing
            DeskQuote quoteInfo = new DeskQuote(quoteFirstName, quoteLastName, currentDate.ToString("MM/dd/yyyy H:mm tt"), userDesk.getTotalCost(), userDesk);

            // Add the quote to a list of quotes
            DeskQuote.listOfQuotes.Add(quoteInfo);

            // Try using the list
            quoteInfo.convertListToJson();


            MessageBox.Show("Quote Saved");

            // TODO:  Where should the tool go once a quote is saved?
            MainMenu mainMenuForm = new MainMenu();

            mainMenuForm.Show();

            Close();
        }