예제 #1
0
        //Precondition: patron list menu item click
        //Postcondition: display patrons information
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            reportRichTxtBox.Clear();

            reportRichTxtBox.Text += "Number of Patrons: " + LibraryData.GetPatronCount() + Environment.NewLine;

            foreach (LibraryPatron i in LibraryData.GetPatronsList())
            {
                reportRichTxtBox.Text += Environment.NewLine + i + Environment.NewLine;
            }
        }
예제 #2
0
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {                                              //precondition: none
            //postcondition: printed to message box
            StringBuilder start = new StringBuilder(); //string builder to hold string

            start.Append("count:" + item.GetPatronCount().ToString() + Environment.NewLine);
            mainTxt.Clear();//clear textbox prior
            foreach (LibraryPatron patron in item._patrons)
            {
                start.Append(patron.ToString() + Environment.NewLine);
                mainTxt.Text = start.ToString();
            }
            //show all patrons
        }
예제 #3
0
        //Preconditions: click Report>List Patrons
        //Postconditions: goes through a loop to display all the patrons in the library
        private void patronListSubMenuItem_Click(object sender, EventArgs e)
        {
            PatronDialogBox patronDBox = new PatronDialogBox(); //create object for PatronDialogBox

            outputTextBox.Text = "";                            //Clears the textbox

            outputTextBox.Text = "Count of Patrons: " + theLibrary.GetPatronCount() + System.Environment.NewLine +
                                 System.Environment.NewLine;

            for (int k = 0; k < theLibrary._patrons.Count; k++)     //loops through the library and displays patrons
            {
                outputTextBox.Text += theLibrary._patrons[k] +
                                      System.Environment.NewLine + System.Environment.NewLine;
            }
        }
예제 #4
0
        // Precondition:  None
        // Postcondition: Displays list of patrons.
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            outputTextBox.Clear();
            string results      = "";                  // Placeholder text
            var    patronReport = new StringBuilder(); //stringbuilder that holds the count
            string NL           = Environment.NewLine; // Adds a new line

            patronReport.Append($"Patrons: {_lib.GetPatronCount()} Patrons{NL}");

            foreach (var patron in _lib.GetPatronsList())
            {
                results += $"Patron Name: {patron.PatronName} Patron ID:{patron.PatronID}{NL}";
            }
            outputTextBox.Text = patronReport + results;
        }
예제 #5
0
        // Precondition:  The patron list menu button is clicked.
        // Postcondition: Patron list is displayed in form
        //
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PatronListForm patronlist = new PatronListForm();  // New patron list form

            // Text string added to patron holder describing the number of patrons
            patronlist.patronholder = AppendLine("Number of Patrons: " + newLibrary.GetPatronCount().ToString());

            //Walking through each library patron and adding each item's tostring to the string patron holder
            foreach (LibraryPatron i in newLibrary._patrons)
            {
                patronlist.patronholder += AppendLine(i.ToString());
            }

            patronlist.Title = patronlist.patronholder; // Setting the patron list form property Title to the string patron holder

            patronlist.ShowDialog();                    // Show the new patron list form
        }
예제 #6
0
파일: Form1.cs 프로젝트: nsmith677/CIS200
        //Precondition: Report -> PatronList item is activated
        //Postcondition: Patron List is displayed
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder        result = new StringBuilder(); // Holds the text while the report is being built
            List <LibraryPatron> patrons;                      //List of library patrons

            patrons = library.GetPatronsList();
            result.Append(String.Format("List of Patrons - {0} patrons", library.GetPatronCount()));
            result.Append(Environment.NewLine);
            result.Append(Environment.NewLine);

            foreach (LibraryPatron lp in patrons)
            {
                result.Append(lp.ToString());
                result.Append(Environment.NewLine);
                result.Append(Environment.NewLine);
            }

            reportTextBox.Text = result.ToString(); //Display the result
        }
예제 #7
0
        // Precondition:  Report, Patron List menu item activated
        // Postcondition: The list of patrons is displayed in the reportTxt
        //                text box
        private void patronListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder result = new StringBuilder(); // Holds text as report being built
                                                        // StringBuilder more efficient than String
            List <LibraryPatron> patrons;               // List of patrons

            patrons = lib.GetPatronsList();
            result.Append(String.Format("Patron List - {0} patrons", lib.GetPatronCount()));
            result.Append(System.Environment.NewLine); // Remember, \n doesn't always work in GUIs
            result.Append(System.Environment.NewLine);

            foreach (LibraryPatron p in patrons)
            {
                result.Append(p.ToString());
                result.Append(System.Environment.NewLine);
                result.Append(System.Environment.NewLine);
            }

            reportTxt.Text = result.ToString();

            // Put cursor at start of report
            reportTxt.SelectionStart = 0;
        }