Esempio n. 1
0
        public static void LineDelete(Book[] myBooks)
        {
            Console.WriteLine("Enter the ISBN of a book you'd like to remove from inventory (book file): ");
            int choice = int.Parse(Console.ReadLine());

            int indexFound = BookUtility.BinarySearch(myBooks, choice);

            string path2 = "books.txt";

            File.WriteAllText(path2, String.Empty);
            TextWriter tW2 = new StreamWriter(path2, true);

            tW2.Close();
            myBooks.ToString();
            using (StreamWriter sW = File.AppendText("books.txt"))
                for (int i = 0; i < indexFound; i++)
                {
                    sW.WriteLine(myBooks[i].GetISBN() + "#" + myBooks[i].GetTitle() + "#" + myBooks[i].GetAuthor() + "#" + myBooks[i].GetGenre() + "#" + myBooks[i].GetListeningTime() + "#" + myBooks[i].GetStatus() + "#" + myBooks[i].GetBookCount());
                }
            using (StreamWriter outFile = File.AppendText("books.txt"))
                for (int j = indexFound + 1; j < GetCount(); j++)
                {
                    outFile.WriteLine(myBooks[j].GetISBN() + "#" + myBooks[j].GetTitle() + "#" + myBooks[j].GetAuthor() + "#" + myBooks[j].GetGenre() + "#" + myBooks[j].GetListeningTime() + "#" + myBooks[j].GetStatus() + "#" + myBooks[j].GetBookCount());
                }

            Console.WriteLine("Updated book file:\n");
            for (int i = 0; i < indexFound; i++)
            {
                Console.WriteLine(myBooks[i].GetISBN() + "#" + myBooks[i].GetTitle() + "#" + myBooks[i].GetAuthor() + "#" + myBooks[i].GetGenre() + "#" + myBooks[i].GetListeningTime() + "#" + myBooks[i].GetStatus() + "#" + myBooks[i].GetBookCount());
            }
            for (int j = indexFound + 1; j < GetCount(); j++)
            {
                Console.WriteLine(myBooks[j].GetISBN() + "#" + myBooks[j].GetTitle() + "#" + myBooks[j].GetAuthor() + "#" + myBooks[j].GetGenre() + "#" + myBooks[j].GetListeningTime() + "#" + myBooks[j].GetStatus() + "#" + myBooks[j].GetBookCount());
            }
        }
Esempio n. 2
0
        public static void BookReturn(Transactions[] myTransactions, Book[] myBooks)
        {
            //return book
            Console.WriteLine("\nEnter the ISBN of the book to be returned: ");
            //search user return ISBN in transaction file
            int tempTranISBN = int.Parse(Console.ReadLine());

            Console.WriteLine("\nEnter the customer's email: ");
            string tempEmail = Console.ReadLine();

            //nested for loop to search whole array, checking email with i and ISBN with j
            for (int i = 0; i < Transactions.GetTranCount(); i++)
            {
                for (int j = 0; j < Transactions.GetTranCount(); j++)
                {
                    //check if user input email equals any email on the array
                    if (tempEmail == myTransactions[i].GetCustomerEmail())
                    {
                        //if the email is found, check if the user ISBN equals that instance
                        if (tempTranISBN == myTransactions[j].GetTranISBN())
                        {
                            //if the email found and ISBN found match each other's instances, replace the return date
                            if (i == j)
                            {
                                //find the isbn instance in the transaction file and replace the N/A with the current date (date of return)
                                string newReturnDate = DateTime.Now.ToString("MM/dd/yyyy");
                                myTransactions[i].SetReturnDate(newReturnDate);

                                //take the ISBN of the book returned and search it in the book array, if found, increase the count of copies (since one was returned)
                                int tempISBN   = myTransactions[i].GetTranISBN();
                                int indexFound = BookUtility.BinarySearch(myBooks, tempISBN);
                                int copiesAdd  = myBooks[indexFound].GetBookCount() + 1;
                                myBooks[indexFound].SetBookCount(copiesAdd);

                                if (myBooks[indexFound].GetBookCount() > 0)
                                {
                                    string status = "Available";
                                    myBooks[indexFound].SetStatus(status);
                                }
                            }
                        }
                    }
                }
            }
            //clear text file and resend updated info
            string path5 = "transactions.txt";

            File.WriteAllText(path5, String.Empty);
            TextWriter tW5 = new StreamWriter(path5, true);

            tW5.Close();
            ToFile(myTransactions);
        }
Esempio n. 3
0
        public static void SortAndSend(Book[] myBooks)
        {
            BookUtility.SelectionSort(myBooks);
            PrintBooks(myBooks);
            // clear and re-send sorted and edited array (update the text file)
            string path = "books.txt";

            File.WriteAllText(path, String.Empty);
            TextWriter tW = new StreamWriter(path, true);

            tW.Close();
            ToFile(myBooks);
        }
Esempio n. 4
0
        public static Book[] GetBookData()
        {
            BookFile data = new BookFile("books.txt");

            Book[] myBooks = data.ReadBookData();

            Console.WriteLine("Enter book ISBN (-1 to stop): \n");
            int ISBN = int.Parse(Console.ReadLine());

            while (ISBN != -1)
            {
                int indexFound = BookUtility.BinarySearch(myBooks, ISBN);
                Console.WriteLine(indexFound);
                if (indexFound == -1)
                {
                    int bookCount = 1;

                    Console.Write("Enter the title: \n");
                    string title = Console.ReadLine();

                    Console.Write("Enter the author: \n");
                    string author = Console.ReadLine();

                    Console.Write("Enter the genre: \n");
                    string genre = Console.ReadLine();

                    Console.Write("Enter the listening time: \n");
                    double listeningTime = double.Parse(Console.ReadLine());

                    string status = "Available";

                    Book newBook = new Book(ISBN, title, author, genre, listeningTime, status, bookCount);
                    myBooks[GetCount()] = newBook;
                    IncrCount();

                    Console.Write("Enter book ISBN (- 1 to stop): \n");
                    ISBN = int.Parse(Console.ReadLine());
                }
                else
                {
                    int copies = myBooks[indexFound].GetBookCount() + 1;
                    myBooks[indexFound].SetBookCount(copies);
                    ISBN = -1;
                }
            }


            return(myBooks);
        }
Esempio n. 5
0
        public static Transactions[] GetTransactionData(Book[] myBooks)
        {
            Transactions[] myTransactions = new Transactions[200];

            Console.WriteLine("Enter the ISBN of the book to be marked as rented (-1 to stop):\n ");
            int tranISBN = int.Parse(Console.ReadLine());

            while (tranISBN != -1)
            {
                int indexFound = BookUtility.BinarySearch(myBooks, tranISBN);
                if (myBooks[indexFound].GetBookCount() > 0)
                {
                    int copies1 = myBooks[indexFound].GetBookCount() - 1;
                    myBooks[indexFound].SetBookCount(copies1);
                    if (myBooks[indexFound].GetBookCount() == 0)
                    {
                        string status = "Rented";
                        myBooks[indexFound].SetStatus(status);
                    }
                    Console.WriteLine("Enter the customer's name:\n");
                    string customerName = Console.ReadLine();

                    Console.WriteLine("Enter the customer's email:\n");
                    string customerEmail = Console.ReadLine();

                    Random rnd    = new Random();
                    int    rentID = rnd.Next();

                    string rentDate   = DateTime.Now.ToString("M/d/yyyy");
                    string returnDate = "N/A";

                    Transactions newTransactions = new Transactions(rentID, tranISBN, customerName, customerEmail, rentDate, returnDate);
                    myTransactions[Transactions.GetTranCount()] = newTransactions;
                    Transactions.IncrTranCount();

                    Console.WriteLine("Enter the ISBN of the book to be rented (-1 to stop):\n ");
                    tranISBN = int.Parse(Console.ReadLine());
                }
                else
                {
                    Console.WriteLine("\nERROR... There are no available copies of this book\n");
                    GetTransactionData(myBooks);
                }
            }
            return(myTransactions);
        }
Esempio n. 6
0
        public static Transactions[] GetTransactionData(Book[] myBooks)
        {
            //creates transaction array to input books to be marked as rented
            Transactions[] myTransactions = new Transactions[200];

            //show available books
            Console.WriteLine("\nBooks available for rent:\n\n");
            for (int i = 0; i < Book.GetCount(); i++)
            {
                if (myBooks[i].GetStatus() == "Available")
                {
                    Console.WriteLine(myBooks[i]);
                }
            }
            Console.WriteLine("\nPress enter to continue... ");
            Console.ReadLine();

            //get ISBN from user to identify boook being rented
            Console.WriteLine("Enter the ISBN of the book to be marked as rented (-1 to stop):\n ");
            int tranISBN = int.Parse(Console.ReadLine());

            while (tranISBN != -1)
            {
                //search book array for ISBN
                int indexFound = BookUtility.BinarySearch(myBooks, tranISBN);
                //if the number of book copies is greater than 0 (there are still books available under this ISBN)
                if (myBooks[indexFound].GetBookCount() > 0)
                {
                    //subract one from the number of book copies (one has been rented)
                    int copies1 = myBooks[indexFound].GetBookCount() - 1;
                    myBooks[indexFound].SetBookCount(copies1);
                    //if the copy count now equals zero, mark the status under the book file as rented ie. there are none left
                    if (myBooks[indexFound].GetBookCount() == 0)
                    {
                        string status = "Rented";
                        myBooks[indexFound].SetStatus(status);
                    }
                    //get rest of renter's info
                    Console.Clear();
                    Console.WriteLine("\nEnter the customer's name:\n");
                    string customerName = Console.ReadLine();

                    Console.WriteLine("\nEnter the customer's email:\n");
                    string customerEmail = Console.ReadLine();

                    //rent ID randomized
                    Random rnd    = new Random();
                    int    rentID = rnd.Next();

                    //rent date set to current date, return date set to N/A (per Dr. Saifee's instruction)
                    string rentDate   = DateTime.Now.ToString("MM/dd/yyyy");
                    string returnDate = "N/A";

                    Transactions newTransactions = new Transactions(rentID, tranISBN, customerName, customerEmail, rentDate, returnDate);
                    myTransactions[Transactions.GetTranCount()] = newTransactions;
                    Transactions.IncrTranCount();

                    Console.Clear();
                    Console.WriteLine("Enter the ISBN of the book to be rented (-1 to stop):\n ");
                    tranISBN = int.Parse(Console.ReadLine());
                }
                //if user tries to rent a book that there are no available copies of, error message is presented
                else
                {
                    Console.WriteLine("\nERROR... There are no available copies of this book\n");
                    GetTransactionData(myBooks);
                }
                Console.WriteLine("\nBooks rented. Press enter to continue");
                Console.ReadLine();
            }
            return(myTransactions);
        }
Esempio n. 7
0
        public static void Edit(Book[] myBooks)
        {
            // edit function
            Console.WriteLine("Enter the ISBN of the book you would like to edit: ");
            int tempISBN = int.Parse(Console.ReadLine());
            //searching ISBN
            int indexFound = BookUtility.BinarySearch(myBooks, tempISBN);

            Console.WriteLine("Please enter:\n'Title' to edit the title\n'Author' to edit the author\n'Genre' to edit the genre\n'Listening Time' to edit the listening time\n'Copy Count' to chnage the number of available copies");
            string answer = Console.ReadLine().ToLower();

            if (answer == "title")
            {
                Console.WriteLine("\nEnter a new title:");
                string newTitle = Console.ReadLine();
                myBooks[indexFound].SetTitle(newTitle);
            }
            else if (answer == "author")
            {
                Console.WriteLine("\nEnter a new author:");
                string newAuthor = Console.ReadLine();
                myBooks[indexFound].SetAuthor(newAuthor);
            }
            else if (answer == "genre")
            {
                Console.WriteLine("\nEnter a new genre:");
                string newGenre = Console.ReadLine();
                myBooks[indexFound].SetGenre(newGenre);
            }
            else if (answer == "listening time")
            {
                Console.WriteLine("\nEnter a new listening time:");
                double newLT = double.Parse(Console.ReadLine());
                myBooks[indexFound].SetListeningTime(newLT);
            }
            else if (answer == "copy count")
            {
                Console.WriteLine("Enter 'add' to add a copy of the book or 'subtract' to subtract a copy");
                string copy = Console.ReadLine().ToLower();
                if (copy == "add")
                {
                    int copiesAdd = myBooks[indexFound].GetBookCount() + 1;
                    myBooks[indexFound].SetBookCount(copiesAdd);
                    Console.WriteLine("\nBook count is currently: " + myBooks[indexFound].GetBookCount());
                }
                else if (copy == "subtract")
                {
                    int copies = myBooks[indexFound].GetBookCount() - 1;
                    myBooks[indexFound].SetBookCount(copies);
                    Console.WriteLine("\nBook count is currently: " + myBooks[indexFound].GetBookCount());
                }
            }

            // clear and re-send sorted and edited array (update the text file)
            string path2 = "books.txt";

            File.WriteAllText(path2, String.Empty);
            TextWriter tW2 = new StreamWriter(path2, true);

            tW2.Close();
            ToFile(myBooks);
        }
Esempio n. 8
0
        //Method gets books from user to be added to book file
        public static Book[] GetBookData()
        {
            //read existing data from book file into array
            BookFile data = new BookFile("books.txt");

            Book[] myBooks = data.ReadBookData();

            Console.WriteLine("\nEnter book ISBN (-1 to stop): \n");
            int ISBN = int.Parse(Console.ReadLine());

            while (ISBN != -1)
            {
                //binary search checks to see if the book already exists, if not, it continues to get user info on the book
                int indexFound = BookUtility.BinarySearch(myBooks, ISBN);
                if (indexFound == -1)
                {
                    int bookCount = 1;

                    Console.Write("\nEnter the title: \n");
                    string title = Console.ReadLine();

                    Console.Write("\nEnter the author: \n");
                    string author = Console.ReadLine();

                    Console.Write("\nEnter the genre: \n");
                    string genre = Console.ReadLine();

                    Console.Write("\nEnter the listening time: \n");
                    double listeningTime = double.Parse(Console.ReadLine());

                    string status = "Available";

                    Book newBook = new Book(ISBN, title, author, genre, listeningTime, status, bookCount);
                    myBooks[GetCount()] = newBook;
                    IncrCount();

                    Console.Clear();
                    Console.Write("\nEnter book ISBN (- 1 to stop): \n");
                    ISBN = int.Parse(Console.ReadLine());
                }
                //if the book ISBN already exists, program will increase the number of copies by one
                else
                {
                    int copies = myBooks[indexFound].GetBookCount() + 1;
                    myBooks[indexFound].SetBookCount(copies);
                    //exits the GetBookData method
                    ISBN = -1;

                    string status = "Available";
                    myBooks[indexFound].SetStatus(status);

                    Console.Clear();
                    Console.WriteLine("This ISBN already exists... a copy has been added");
                    Console.WriteLine("\nPress enter to continue...");
                    Console.ReadLine();
                }
            }
            Console.Clear();
            Console.WriteLine("\nBook(s) inputed");
            Console.WriteLine("\nPress enter to continue...");
            Console.ReadLine();


            return(myBooks);
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            string selection = "";

            while (selection != "exit")
            {
                selection = GetSelection();
                BookFile       data           = new BookFile("books.txt");
                Book[]         myBooks        = data.ReadBookData();
                BookUtility    bookUtility    = new BookUtility(myBooks);
                BookFile       bookFile       = new BookFile("books.txt");
                TranFile       tranFile       = new TranFile("transactions.txt");
                Transactions[] myTransactions = new Transactions[200];
                TranUtility    tranUtility    = new TranUtility(myTransactions);
                BookReport     bookReport     = new BookReport(myTransactions);

                //check the user selection and take them to the appropriate methods
                if (selection == "add")
                {
                    Console.Clear();
                    myBooks = Book.GetBookData();
                    //everytime a book is added, the array gets sorted (to prepare for any binary searches), and then the book text file is cleared and the sorted info is inputed
                    Book.SortAndSend(myBooks);
                }
                if (selection == "edit book")
                {
                    Console.Clear();
                    Book.Edit(myBooks);
                }
                if (selection == "view")
                {
                    Console.Clear();
                    Console.WriteLine("\nBooks available for rent:\n\n");
                    for (int i = 0; i < Book.GetCount(); i++)
                    {
                        if (myBooks[i].GetStatus() == "Available")
                        {
                            Console.WriteLine(myBooks[i]);
                        }
                    }
                    Console.WriteLine("\nPress enter to continue...");
                    Console.ReadLine();
                }
                if (selection == "rent")
                {
                    //Lets the user input which book ISBN is to be rented
                    Console.Clear();
                    myTransactions = Transactions.GetTransactionData(myBooks);
                    Transactions.PrintRent(myTransactions);
                    //Marks the book as rented in the book text file
                    string rentPath = "books.txt";
                    File.WriteAllText(rentPath, String.Empty);
                    TextWriter twP = new StreamWriter(rentPath, true);
                    twP.Close();
                    Book.ToFile(myBooks);

                    //write what is in the transactions array to the text file, read the text file and send back to array, sort the array
                    Transactions.ToFile(myTransactions);
                    myTransactions = tranFile.ReadTranData();
                    tranUtility.SelectionSort(myTransactions);
                    Transactions.PrintRent(myTransactions);
                    //clear and re-send sorted and edited array (update the text file)
                    string tranPath = "transactions.txt";
                    File.WriteAllText(tranPath, String.Empty);
                    TextWriter tWTran = new StreamWriter(tranPath, true);
                    tWTran.Close();
                    Transactions.ToFile(myTransactions);
                }
                if (selection == "return")
                {
                    Console.Clear();
                    //reading book file into array for use in book count returning
                    myBooks = bookFile.ReadBookData();
                    //reading transaction file data into array for use
                    myTransactions = tranFile.ReadTranData();
                    //show user books that can be returned
                    Console.WriteLine("Book log:\n");
                    Transactions.PrintRent(myTransactions);

                    Transactions.BookReturn(myTransactions, myBooks);

                    //once the book is returned, send the  updated array to the text file
                    string path2 = "books.txt";
                    File.WriteAllText(path2, String.Empty);
                    TextWriter tW2 = new StreamWriter(path2, true);
                    tW2.Close();
                    Book.ToFile(myBooks);

                    Console.WriteLine("\nBook returned.");
                    Console.WriteLine("\nPress enter to continue... ");
                    Console.ReadLine();
                }
                if (selection == "total")
                {
                    //reading transaction file data into array for use
                    myTransactions = tranFile.ReadTranData();

                    bookReport.TotalReport(myTransactions);
                }
                if (selection == "individual")
                {
                    Console.Clear();
                    //reading transaction file data into array for use
                    myTransactions = tranFile.ReadTranData();
                    //sort by name before calling IndividualReport method
                    tranUtility.SelectionSort(myTransactions);
                    //calls method report
                    BookReport.IndividualReport(myTransactions);

                    Console.WriteLine("\nPress enter to continue... ");
                    Console.ReadLine();
                }
                if (selection == "historical")
                {
                    myTransactions = tranFile.ReadTranData();
                    TranUtility.SelectionSortHist(myTransactions);
                    Console.Clear();
                    Console.WriteLine("Here is the historical list: ");
                    Console.WriteLine("");

                    bookReport.CustDateSort(myTransactions);
                    Transactions.PrintRent(myTransactions);
                    bookReport.Write(myTransactions);
                }
                if (selection == "delete")
                {
                    Console.Clear();
                    Book.LineDelete(myBooks);
                    Console.WriteLine("\nPress enter to continue...");
                    Console.ReadLine();
                }
                if (selection == "genre")
                {
                    Console.Clear();
                    myBooks = bookFile.ReadBookData();
                    BookUtility.SelectionSortGenre(myBooks);
                    bookReport.GenreReport(myBooks);
                    Console.WriteLine("\nPress enter to continue...");
                    Console.ReadLine();
                }
                if (selection == "edit transaction")
                {
                    Console.Clear();
                    myTransactions = tranFile.ReadTranData();
                    TranUtility.SelectionSortID(myTransactions);
                    Transactions.Edit(myTransactions);
                }
            }
            Console.Clear();
            Console.WriteLine("\n\n\n\n\n\n\nThanks for using my database!\n\n\n\n\n\n");
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            string selection = "";

            while (selection != "exit")
            {
                selection = GetSelection();
                // Book[] myBooks = Book.GetBookData();
                // Book.SortAndSend(myBooks);
                BookFile       data           = new BookFile("books.txt");
                Book[]         myBooks        = data.ReadBookData();
                BookUtility    bookUtility    = new BookUtility(myBooks);
                BookFile       bookFile       = new BookFile("books.txt");
                TranFile       tranFile       = new TranFile("transactions.txt");
                Transactions[] myTransactions = new Transactions[200];
                TranUtility    tranUtility    = new TranUtility(myTransactions);
                BookReport     bookReport     = new BookReport(myTransactions);

                if (selection == "add")
                {
                    myBooks = Book.GetBookData();
                    Book.SortAndSend(myBooks);
                }
                if (selection == "edit")
                {
                    Book.Edit(myBooks);
                }
                if (selection == "view")
                {
                    Console.WriteLine("\nBooks available for rent:\n\n");
                    for (int i = 0; i < Book.GetCount(); i++)
                    {
                        if (myBooks[i].GetStatus() == "Available")
                        {
                            Console.WriteLine(myBooks[i].GetTitle());
                        }
                    }
                    Console.WriteLine("\nPress enter to continue: ");
                    Console.ReadLine();
                }
                if (selection == "rent")
                {
                    //Lets the user input which book ISBN is to be rented
                    myTransactions = Transactions.GetTransactionData(myBooks);
                    Transactions.PrintRent(myTransactions);
                    //Marks the book as rented in the book text file
                    string rentPath = "books.txt";
                    File.WriteAllText(rentPath, String.Empty);
                    TextWriter twP = new StreamWriter(rentPath, true);
                    twP.Close();
                    Book.ToFile(myBooks);

                    //write what is in the transactions array to the text file, read the text file and send back to array, sort the array
                    Transactions.ToFile(myTransactions);
                    myTransactions = tranFile.ReadTranData();
                    tranUtility.SelectionSort(myTransactions);
                    Transactions.PrintRent(myTransactions);
                    //clear and re-send sorted and edited array (update the text file)
                    string tranPath = "transactions.txt";
                    File.WriteAllText(tranPath, String.Empty);
                    TextWriter tWTran = new StreamWriter(tranPath, true);
                    tWTran.Close();
                    Transactions.ToFile(myTransactions);
                }
                if (selection == "return")
                {
                    Console.Clear();
                    myTransactions = tranFile.ReadTranData();
                    Transactions.PrintRent(myTransactions);
                    //return book
                    Console.WriteLine("\nEnter the ISBN of the book to be returned: ");
                    //search user return ISBN in transaction file
                    int tempTranISBN = int.Parse(Console.ReadLine());
                    Console.WriteLine("\nEnter the customer's email: ");
                    string tempEmail = Console.ReadLine();

                    for (int i = 1; i < Transactions.GetTranCount(); i++)
                    {
                        int tempFound = TranUtility.BinarySearch(myTransactions, tempTranISBN);
                        if (tempEmail == myTransactions[i].GetCustomerEmail())
                        {
                            if (i == tempFound)
                            {
                                //find the isbn instance in the transaction file and replace the N/A with the current date (date of return)
                                string newReturnDate = DateTime.Now.ToString("M/d/yyyy");
                                myTransactions[tempFound].SetReturnDate(newReturnDate);
                            }
                        }
                    }
                    string tranPath = "transactions.txt";
                    File.WriteAllText(tranPath, String.Empty);
                    TextWriter tWTran = new StreamWriter(tranPath, true);
                    tWTran.Close();
                    Transactions.ToFile(myTransactions);

                    Console.WriteLine("\nBook returned.");
                    Console.WriteLine("\nPress enter to continue: ");
                    Console.ReadLine();
                }
                if (selection == "total")
                {
                    myTransactions = tranFile.ReadTranData();
                    tranUtility.SelectionSort(myTransactions);
                    //clear and re-send sorted and edited array (update the text file)
                    string returnPath = "transactions.txt";
                    File.WriteAllText(returnPath, String.Empty);
                    TextWriter tWReturn = new StreamWriter(returnPath, true);
                    tWReturn.Close();
                    Transactions.ToFile(myTransactions);

                    BookReport.SortDate(myTransactions);
                    Console.WriteLine("\nTotal rentals by month and year: \n");
                    Transactions.PrintRent(myTransactions);
                    Console.ReadLine();
                    Console.WriteLine("Would you like to save these to a text file? (yes or no) ");
                    string answer = Console.ReadLine();

                    if (answer.ToLower() == "yes")
                    {
                        Console.WriteLine("\nEnter the name of the text file: ");
                        string       tempTxt = Console.ReadLine();
                        StreamWriter outFile = new StreamWriter(tempTxt);

                        for (int i = 0; i < Transactions.GetTranCount(); i++)
                        {
                            outFile.WriteLine(myTransactions[i].GetRentID() + "#" + myTransactions[i].GetTranISBN() + "#" + myTransactions[i].GetCustomerName() + "#" + myTransactions[i].GetCustomerEmail() + "#" + myTransactions[i].GetRentDate() + "#" + myTransactions[i].GetReturnDate());
                        }

                        outFile.Close();
                    }
                }
                if (selection == "individual")
                {
                    myTransactions = tranFile.ReadTranData();
                    tranUtility.SelectionSort(myTransactions);
                    //clear and re-send sorted and edited array (update the text file)
                    string returnPath = "transactions.txt";
                    File.WriteAllText(returnPath, String.Empty);
                    TextWriter tWReturn = new StreamWriter(returnPath, true);
                    tWReturn.Close();
                    Transactions.ToFile(myTransactions);

                    Console.WriteLine("\nEnter the customer's email: ");
                    string tempIndvEmail = Console.ReadLine();
                    Console.WriteLine("\nCustomer rental history: \n");

                    for (int i = 1; i < Transactions.GetTranCount(); i++)
                    {
                        if (tempIndvEmail == myTransactions[i].GetCustomerEmail())
                        {
                            Console.WriteLine(myTransactions[i]);
                        }
                    }

                    Console.WriteLine("\nWould you like to enter this into a text file? (yes or no)");
                    string choice = Console.ReadLine();
                    if (choice.ToLower() == "yes")
                    {
                        Console.WriteLine("\nEnter the name of the text file: ");
                        string       tempTxt = Console.ReadLine();
                        StreamWriter outFile = new StreamWriter(tempTxt);
                        for (int i = 1; i < Transactions.GetTranCount(); i++)
                        {
                            if (tempIndvEmail == myTransactions[i].GetCustomerEmail())
                            {
                                outFile.WriteLine(myTransactions[i].GetRentID() + "#" + myTransactions[i].GetTranISBN() + "#" + myTransactions[i].GetCustomerName() + "#" + myTransactions[i].GetCustomerEmail() + "#" + myTransactions[i].GetRentDate() + "#" + myTransactions[i].GetReturnDate());
                            }
                        }
                        outFile.Close();
                    }

                    Console.WriteLine("\nPress enter to continue: ");
                    Console.ReadLine();
                }
                if (selection == "historical")
                {
                    myTransactions = tranFile.ReadTranData();
                    BookReport.CustDateSort(myTransactions);
                }
            }
        }