// Opens up the check in screen private void checkInButton_Click(object sender, EventArgs e) { if (currentEmployee != null) { // Selected instrument Instrument tempInstrument = (Instrument)instrumentList.SelectedItem; // If there are any instruments if (allInstruments.Count > 0) { // If the instrument has been checked out and if (tempInstrument.checkouts.Count > 0 && tempInstrument.checkouts != null) { // Checks to make sure that you can't check it in whle it's in if (tempInstrument.checkouts[tempInstrument.checkouts.Count - 1].type != (Checkout.Type) 0) { Checkout_Data mCheckout = new Checkout_Data((Instrument)instrumentList.SelectedItem, Checkout.Type.checkin); mCheckout.Text = "Check In"; mCheckout.ShowDialog(); } } // Otherwise, just run it else { Checkout_Data checkout = new Checkout_Data((Instrument)instrumentList.SelectedItem, Checkout.Type.checkin); checkout.Text = "Check In"; checkout.ShowDialog(); } } } }
// Opens up the check out screen private void checkoutButton_Click(object sender, EventArgs e) { if (currentEmployee != null) { // Selected instrument Instrument tempInstrument = (Instrument)instrumentList.SelectedItem; // If there's anything in library if (allInstruments.Count > 0) { // And there are any checkouts, make sure that it's not still checked out if (tempInstrument.checkouts.Count > 0) { if (tempInstrument.checkouts[tempInstrument.checkouts.Count - 1].type != (Checkout.Type) 1) { Checkout_Data mCheckout = new Checkout_Data(tempInstrument, Checkout.Type.checkout); mCheckout.Text = "Check Out"; mCheckout.ShowDialog(); } } // Otherwise, just check it out else { Checkout_Data checkout = new Checkout_Data(tempInstrument, Checkout.Type.checkout); checkout.Text = "Check Out"; checkout.ShowDialog(); } } } }
// Adds an employee name to the list private void addButton_Click(object sender, EventArgs e) { passwordCreated = false; if (original.Count > 0 | adminButton.Checked) { if (nameBox.Text != "" && nameBox.Text != "Enter an employee name") { // Capitalize the name nameBox.Text = Checkout_Data.capitalizeName(nameBox.Text); Employees temp = new Employees(nameBox.Text); if (adminButton.Checked) { AddPassword aP = new AddPassword(temp); aP.ShowDialog(); } else { passwordCreated = true; } // Add new employee to the list if (passwordCreated) { Form1.currentStaff.Add(temp); } passwordCreated = false; nameBox.Text = ""; // Sort datasource employeeBox.DataSource = Form1.currentStaff.OrderBy(x => x.eName.Substring(x.eName.LastIndexOf(" ") + 1)) .ToList <Employees>(); Refresh(); } } else { notificationForm nF = new notificationForm("You have to create an admin account\nbefore leaving this screen."); nF.ShowDialog(); } }