private void additionsToolStripMenuItem_Click(object sender, EventArgs e) { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album Name To Add"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to add " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); if (location != -1) { MessageBox.Show("Album already on File"); } else { n++; albumname[n] = d.Borrow; borrower[n] = "free"; Search.Shell(albumname, borrower, n); } } else { MessageBox.Show("you pressed cancel"); } }
private void Transactions(string type, int loc) { if (type == "b") { if (borrower[loc] != "free") { MessageBox.Show("Album already borrowed by " + borrower[loc]); } else { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Borrower's Name"; if (d.ShowDialog() == DialogResult.OK) { borrower[loc] = d.Borrow; } } } else if (type == "r") { if (borrower[loc] == "free") { MessageBox.Show("Album already returned"); } else { borrower[loc] = "free"; } } }
private void deletionsToolStripMenuItem_Click(object sender, EventArgs e) { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album Name To Delete"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to delete " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); if (location != -1) { n--; for (int i = location; i <= n; i++) { albumname[i] = albumname[i + 1]; borrower[i] = borrower[i + 1]; Search.Shell(albumname, borrower, n); } } else { MessageBox.Show("No such album you may have misspelled it"); } } else { MessageBox.Show("you pressed cancel"); } }
private void returnAlbumToolStripMenuItem_Click(object sender, EventArgs e) { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album to Return"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to return " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); //int location = Search.Binary(albumname, d.Borrow, n); //int location = Search.RecursiveBinary(albumname, 1, n, d.Borrow); if (location != -1) { Transactions("r", location); } else { MessageBox.Show("No such album you may have misspelled it"); } } else { MessageBox.Show("you pressed cancel"); } }
private void Add() { if (fileOK == "yes") { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album Name To Add"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to add " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); if (location != -1) { MessageBox.Show("Album already on File"); } else { n++; albumname[n] = d.Borrow; borrower[n] = "free"; Search.Shell(albumname, borrower, n); } } else { MessageBox.Show("you pressed cancel"); } } else { MessageBox.Show("You cannot add anything to this file " + "\n" + "during loading the program detected an error" + "\n" + "you need to either re-load or create a new file"); } }
private void Borrow() { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album to Borrow"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to borrow " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); //int location = Search.Binary(albumname, d.Borrow, n); //int location = Search.RecursiveBinary(albumname, 1, n, d.Borrow); if (location != -1) { Transactions("b", location); } else { MessageBox.Show("No such album you may have misspelled it"); } } else { MessageBox.Show("you pressed cancel"); } }
private void changesToolStripMenuItem_Click(object sender, EventArgs e) { FrmDataEntry d = new FrmDataEntry(); d.Title = "Enter Album Name To Change"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album to change " + d.Borrow); int location = Search.Linear(albumname, d.Borrow, n); if (location != -1) { d.Title = "Enter New Album Name"; if (d.ShowDialog() == DialogResult.OK) { MessageBox.Show("album name being changed to " + d.Borrow); albumname[location] = d.Borrow; Search.Shell(albumname, borrower, n); } else { MessageBox.Show("you pressed cancel"); } } else { MessageBox.Show("No such album you may have misspelled it"); } } else { MessageBox.Show("you pressed cancel"); } }