예제 #1
0
파일: Form1.cs 프로젝트: nsmith677/CIS200
        //Precondition: Report -> ItemList item is activated
        //Postcondition: Item List is displayed
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder      result = new StringBuilder(); // Holds the text while the report is being built
            List <LibraryItem> items;                        //List of library items

            items = library.GetItemsList();
            result.Append(String.Format("List of Items - {0} items", library.GetItemCount()));
            result.Append(Environment.NewLine);
            result.Append(Environment.NewLine);

            foreach (LibraryItem item in items)
            {
                result.Append(item.ToString());
                result.Append(Environment.NewLine);
                result.Append(Environment.NewLine);
            }

            reportTextBox.Text = result.ToString(); //Display the result
        }
예제 #2
0
        // Precondition:  None
        // Postcondition: Displays the list of items in the library.
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            itemFormBase_TXT.Clear();
            itemFormBase_TXT.Text += $"The amount of items in the list is: {newLibrary.GetItemCount()}{Environment.NewLine}";

            //Displays every item that the library owns
            foreach (LibraryItem item in newLibrary._items)
            {
                itemFormBase_TXT.Text += $"{Environment.NewLine}{item}{Environment.NewLine}";
            }
        }
예제 #3
0
        //Precondition: item list menu item click
        //Postcondition: display items list
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            reportRichTxtBox.Clear();

            reportRichTxtBox.Text += "Number of Items: " + LibraryData.GetItemCount() + Environment.NewLine;

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

            start.Append("count:" + item.GetItemCount().ToString() + Environment.NewLine);
            mainTxt.Clear();//clear textbox prior
            foreach (LibraryBook book in item._items)
            {
                start.Append(book.ToString() + Environment.NewLine);
                mainTxt.Text = start.ToString();
            }//show all books
        }
예제 #5
0
        //Preconditions: click Report>List Items
        //Postconditions: goes through a loop to display all items stored in the library
        private void itemListSubMenuItem_Click(object sender, EventArgs e)
        {
            BookDialogBox bookDBox = new BookDialogBox();

            outputTextBox.Text = "";   //clears textbox

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

            for (int k = 0; k < theLibrary._items.Count; k++)   //loops through the library and displaying items
            {
                outputTextBox.Text += theLibrary._items[k] + System.Environment.NewLine +
                                      System.Environment.NewLine;
            }
        }
예제 #6
0
        // Precondition:  None
        // Postcondition: Displays library items.
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            outputTextBox.Clear();
            string results    = "";                  // Placeholder text
            string NL         = Environment.NewLine; // Adds a new line
            var    itemReport = new StringBuilder();

            itemReport.Append($"Items: {_lib.GetItemCount()} items {NL}");

            foreach (var item in _lib.GetItemsList())
            {
                results += $"{item}{NL}{NL}";
            }
            outputTextBox.Text = $"{itemReport}" +
                                 $"{results}{NL}";
        }
예제 #7
0
        // Precondition:  The item list menu button is clicked.
        // Postcondition: Item list is displayed in form
        //
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ItemListForm itemlistform = new ItemListForm();  // New patron list form

            itemlistform.stringholder = AppendLine("Number of Items: " + newLibrary.GetItemCount().ToString());

            //Walking through each library item and adding the patron's tostring to a stringholder
            foreach (LibraryItem i in newLibrary._items)
            {
                itemlistform.stringholder += AppendLine(i.ToString());
            }

            itemlistform.Title = itemlistform.stringholder; // Setting the patron list form property Title to the string patron holder

            itemlistform.ShowDialog();                      // Show the item list form
        }
예제 #8
0
        // Precondition:  Report, Item List menu item activated
        // Postcondition: The list of items is displayed in the reportTxt
        //                text box
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder result = new StringBuilder(); // Holds text as report being built
                                                        // StringBuilder more efficient than String

            List <LibraryItem> items;                   // List of library items

            items = lib.GetItemsList();
            result.Append(String.Format("Item List - {0} items", lib.GetItemCount()));
            result.Append(System.Environment.NewLine); // Remember, \n doesn't always work in GUIs
            result.Append(System.Environment.NewLine);

            foreach (LibraryItem item in items)
            {
                result.Append(item.ToString());
                result.Append(System.Environment.NewLine);
                result.Append(System.Environment.NewLine);
            }

            reportTxt.Text = result.ToString();

            // Put cursor at start of report
            reportTxt.SelectionStart = 0;
        }
예제 #9
0
        // Precondition:  None
        // Postcondition: Displays the list of items in the library.
        private void itemListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            mainDisplayTxt.Clear();

            mainDisplayTxt.Text += string.Format("The amount of items in the list is: {0}{1}", newLibrary.GetItemCount(), System.Environment.NewLine);

            //Displays every item that the library owns
            foreach (var item in newLibrary.items)
            {
                mainDisplayTxt.Text += string.Format("{1}{0}{1}", item, System.Environment.NewLine);
            }
        }