private void addLec_Click(object sender, EventArgs e) { Lecturer lecturer = new Lecturer(); if (eidtxt.Text.Length != 6) { } else { 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 leccrl = new LectureController(); leccrl.insertLecturerDetails(lecturer); nametxt.Text = ""; eidtxt.Text = ""; factxt.Text = ""; depttxt.Text = ""; centertxt.Text = ""; buildingtxt.Text = ""; leveltxt.Text = ""; ranktxt.Text = ""; lecturerTble.DataSource = leccrl.getdatatoTable(); } }
private void addLec_Click(object sender, EventArgs e) { Lecturer lecturer = new Lecturer(); if (nametxt.Text != "" && eidtxt.Text != "" && factxt.Text != "" && depttxt.Text != "" && centertxt.Text != "" && buildingtxt.Text != "" && leveltxt.Text != "" && ranktxt.Text != "") { 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 leccrl = new LectureController(); leccrl.insertLecturerDetails(lecturer); nametxt.Text = ""; eidtxt.Text = ""; factxt.Text = ""; depttxt.Text = ""; centertxt.Text = ""; buildingtxt.Text = ""; leveltxt.Text = ""; ranktxt.Text = ""; lecturerTble.DataSource = leccrl.getdatatoTable(); } else { MessageBox.Show("Please Fill the all the required fields ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }