// Opens up add employees winform private void addEmployeesButton_Click(object sender, EventArgs e) { // If there's an emplyee and they have a password if (currentEmployee != null && currentEmployee.password != null) { employeeAdd aE = new employeeAdd(0); aE.ShowDialog(); } // Otherwise, reject them else { adminForm(); } }
// Opens up change employee winform private void changeEmployeeButton_Click(object sender, EventArgs e) { // If there's any staff if (Form1.currentStaff.Count > 0) { employeeSelect eS = new employeeSelect(); eS.ShowDialog(); } else { employeeAdd aE = new employeeAdd(1); aE.ShowDialog(); } // Display what employee is logged in this.Text = currentEmployee + ": " + versionNumber; Refresh(); }
// Sets the filepath for the program and populates the directories private void setFilepath() { if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } // If the file does not already exist, create it, otherwise, deserialize if (!File.Exists(filepath + "\\InstrumentData.xml")) { File.Create(filepath + "\\InstrumentData.xml").Close(); } else { SaveToFile.deserialize(0); instrumentList.DataSource = allInstruments; } // If the file does not already exist, create it, otherwise, deserialize if (!File.Exists(filepath + "\\StudentData.xml")) { File.Create(filepath + "\\StudentData.xml").Close(); } else { SaveToFile.deserialize(1); } // If the file does not already exist, create it, otherwise, deserialize if (!File.Exists(filepath + "\\Employees.xml")) { File.Create(filepath + "\\Employees.xml").Close(); // Add employee dialoge employeeAdd eA = new employeeAdd(0); eA.ShowDialog(); } else { SaveToFile.deserialize(2); } Refresh(); }