private void loadForm(object sender, EventArgs e) { LoadEmployees load = new LoadEmployees(); foreach (var item in load.Load()) { bxEmployeers.Items.Add(item); } foreach (var item in load.Load()) { lstBoxEmployees.Items.Add(item); } //Adds the deadlines of projects to the Calendar tab SeeDeadLines deadLine = new SeeDeadLines(DeadLinesCalendar, ProjectsNearDeadLinelstbx); deadLine.DeadLines(); //Shows alert for deadlines that are at one week to end deadLine.AlertDeadLines(); // Extras extra = new Extras(label2, label1, label4, label5, save_button); extra.ToolTips(); //Change Language languageCmbBx.Items.Add("English"); languageCmbBx.Items.Add("Spanish"); languageCmbBx.SelectedIndex = 0; }
private void SaveEmployees(object sender, EventArgs e) { //Checks if the fields like DNI is ok or not if (Regex.IsMatch(dniTxtBx.Text, "/^[0-9]{8}[a-z]?$") || dniTxtBx.Text.Length == 9 && TxtBxEmployeeName.Text.Length > 0 && TxtBxEmployeeSurname.Text.Length > 0) { Employees employee = new Employees(TxtBxEmployeeName.Text, TxtBxEmployeeSurname.Text, ageTxtBx.Text, dniTxtBx.Text); employee.Save(); } else { MessageBox.Show("Dni must be like 12345678A. \n" + "No textBoxes should be empty."); } /* * Refresh the employees page so you can see the new employee in * employee list box */ LoadEmployees load = new LoadEmployees(); lstBoxEmployees.Items.Clear(); foreach (var item in load.Load()) { lstBoxEmployees.Items.Add(item); } }