הפעולה שמעדכנת את הפרטים בהתאם לעובד הנבחר
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
employeeTBL e1 = (employeeTBL)comboBox1.SelectedItem;
textBox6.Text = e1.firstName;
textBox5.Text = e1.lastName;
maskedTextBox2.Text = e1.phone;
textBox4.Text = e1.address;
checkBox1.Checked = e1.isActive;
int roleID = e1.roleID;
roleTBL r1 = (from s in db.roleTBL where s.Id == roleID select s).FirstOrDefault();
comboBox3.SelectedItem = r1;
}
הפעולה שמעדכנת את הפרטים המעודכנים בבסיס הנתונים
private void button2_Click(object sender, EventArgs e){
employeeTBL e1 = (employeeTBL)comboBox1.SelectedItem;
employeeTBL e2 = (from s in db.employeeTBL where s.Id == e1.Id select s).FirstOrDefault();
e2.firstName = textBox6.Text;
e2.lastName = textBox5.Text;
e2.phone = maskedTextBox2.Text;
e2.address = textBox4.Text;
e2.isActive = checkBox1.Checked;
roleTBL r1 = (roleTBL)comboBox3.SelectedItem;
e2.roleID = r1.Id;
db.SaveChanges();
MessageBox.Show("עודכן בהצלחה");
textBox6.Text = "";
textBox5.Text = "";
textBox4.Text = "";
maskedTextBox2.Text = "";
update();
}