private void Edit_Worker_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("No worker was selected."); return; } else if (listView1.SelectedItems.Count > 1) { MessageBox.Show("Choose only one worker to delete at the time."); return; } HeadOfDepartmentSQL sql = new HeadOfDepartmentSQL(SQLConnection.GetSqlConnection()); BasicUser temp = new BasicUser(); temp.FirstName = listView1.SelectedItems[0].SubItems[0].Text; temp.LastName = listView1.SelectedItems[0].SubItems[1].Text; temp.Id = listView1.SelectedItems[0].SubItems[2].Text; temp.Age = int.Parse(listView1.SelectedItems[0].SubItems[3].Text); temp.Username = listView1.SelectedItems[0].SubItems[4].Text; String id = temp.Id; BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref temp, false); regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling); regForm.ShowDialog(); sql.UpdateWorker(id, job, temp); listView1.Items.Clear(); sql.LoadAllPeopleInListView(ref this.listView1, job); }
public void CallBasicUserRegisteration() { this.Hide(); BasicUser newUser = null; BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref newUser, true); regForm.ShowDialog(); this.Close(); }
private void Secretary_Click(object sender, EventArgs e) { this.Hide(); Secretary secretary = new Secretary(); secretary.FirstName = "empty"; BasicUser temp = (BasicUser)secretary; BasicUser_Registration_Form regForm = new BasicUser_Registration_Form(ref temp, true); regForm.FormClosed += new FormClosedEventHandler(FormClosedHandling); regForm.ShowDialog(); if (temp != null && temp.FirstName != "empty") { String tempt = "The new user details: FirstName:" + temp.FirstName + ", lastname:" + temp.LastName + ",password:"******"SecretaryTable"); } }