private void editLec_Click(object sender, EventArgs e) { Lecturer lecturer = new Lecturer(); lecturer.lecName = nametxt.Text; lecturer.eid = eidtxt.Text; lecturer.faculty = factxt.Text; lecturer.department = depttxt.Text; lecturer.center = centertxt.Text; lecturer.buildng = buildingtxt.Text; lecturer.level = leveltxt.Text; lecturer.rank = ranktxt.Text; ranktxt.Text = lecturer.level + "." + lecturer.eid; LectureController ctrl = new LectureController(); ctrl.UpdateLecturer(lecturer); lecturerTble.DataSource = ctrl.getdatatoTable(); }
private void editLec_Click(object sender, EventArgs e) { if (nametxt.Text != "" && eidtxt.Text != "" && factxt.Text != "" && depttxt.Text != "" && centertxt.Text != "" && buildingtxt.Text != "" && leveltxt.Text != "" && ranktxt.Text != "") { Lecturer lecturer = new Lecturer(); lecturer.lecName = nametxt.Text; lecturer.eid = eidtxt.Text; lecturer.faculty = factxt.Text; lecturer.department = depttxt.Text; lecturer.center = centertxt.Text; lecturer.buildng = buildingtxt.Text; lecturer.level = leveltxt.Text; lecturer.rank = ranktxt.Text; ranktxt.Text = lecturer.level + "." + lecturer.eid; LectureController ctrl = new LectureController(); ctrl.UpdateLecturer(lecturer); nametxt.Text = ""; eidtxt.Text = ""; factxt.Text = ""; depttxt.Text = ""; centertxt.Text = ""; buildingtxt.Text = ""; leveltxt.Text = ""; ranktxt.Text = ""; eidtxt.ReadOnly = false; lecturerTble.DataSource = ctrl.getdatatoTable(); addLec.Enabled = true; } else { MessageBox.Show("Please Fill the all the required fields ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }