private void iAddBtn_Click(object sender, EventArgs e) { //validate input //add instructor details if (!Validation.isTextBoxValid(errorProvider1, IuserIdTxtBox, iPasswordTxtBox, iFirstNameTxtBox, iLastNameTxtBox, iEmailTxtBox, iPhoneTxtBox)) { return; } //add instructor adminConnect = new AdminConnect(); InstructorObject instructor = new InstructorObject(); instructor.UserId = IuserIdTxtBox.Text; instructor.Password = iPasswordTxtBox.Text; instructor.FirstName = iFirstNameTxtBox.Text; instructor.LastName = iLastNameTxtBox.Text; instructor.Phone = iPhoneTxtBox.Text; instructor.Email = iEmailTxtBox.Text; if (adminConnect.AddUser(instructor) <= 0) { //show error MessageBox.Show("Instructor not added", "Add error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } else { //display success message MessageBox.Show("Instructor added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } }
private void sAddButton_Click(object sender, EventArgs e) { if (!Validation.isTextBoxValid(errorProvider1, sUserIdTextBox, sPassowrdtextBox, sFirstNametextBox, sLastNametextBox, sEmailTextBox, sPhoneTextBox)) { return; } //add student adminConnect = new AdminConnect(); StudentObject student = new StudentObject(); student.UserId = sUserIdTextBox.Text; student.Password = sPassowrdtextBox.Text; student.FirstName = sFirstNametextBox.Text; student.LastName = sLastNametextBox.Text; student.Phone = sPhoneTextBox.Text; student.Email = sEmailTextBox.Text; if (adminConnect.AddUser(student) <= 0) { //show error MessageBox.Show("Instructor not added", "Add error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } else { //display success message MessageBox.Show("Instructor added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } }