private void StaffViewForm_Load(object sender, EventArgs e) { tmrTime.Start(); lblID.Text = Globals.StaffID; StaffManagment staffM = new StaffManagment(); staff = staffM.GetLstaff(); foreach (var item in staff) { cmbStaffAll.Items.Add(item.StaffID + " " + item.Name); } }
private void btnAddStaff_Click(object sender, EventArgs e) { bool flag = new Validations().ValidateStaffRegister(pnlAddStaff); if (flag) { flag = new StaffManagment().AddStaff(txtName.Text, txtSurname.Text, cmbSkills.Text, txtAddress.Text, txtUsername.Text, txtPassword.Text); if (flag) { MessageBox.Show("Staff was added succesfully", "Addition Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Staff was not added succesfully", "Addition Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnEditStaff_Click(object sender, EventArgs e) { switch (cmbData.Text) { case "Name": { staff.Name = txtNewData.Text; } break; case "Surname": { staff.Surname = txtNewData.Text; } break; case "Status": { staff.Status = txtNewData.Text; } break; default: { MessageBox.Show("Please select data to edit in the drop down menu", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } bool flag = new StaffManagment().EditStaff(staff); if (flag) { MessageBox.Show("New Staff data was registered", "Update Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("There was a error updating Staff data", "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }