//get personal details button private void getDetailsButton_Click(object sender, EventArgs e) { try { IStudentData _studentData = new StudentPersonalDetails(); _studentID = 700; StudentDetails _studentPersonalDetails = _studentData.GetStudentDetailsBy(_studentID); firstnameTextbox.Text = string.IsNullOrEmpty(_studentPersonalDetails.FirstName) == true ? "Empty" : _studentPersonalDetails.FirstName; lastnameTextBox.Text = _studentPersonalDetails.LastName; dob = _studentPersonalDetails.DateOfBirth; displayDOBlabel.Text = "D.O.B. " + dob; //genderCombobox.SelectedItem = _studentPersonalDetails.Gender; //genderCombobox.SelectedText = _studentPersonalDetails.Gender; genderCombobox.SelectedText = "Female";// _studentPersonalDetails.Gender.ToString(); // genderCombobox.SelectedIndex = 0; emailidTextbox.Text = _studentPersonalDetails.Email; phonenumberTextbox.Text = _studentPersonalDetails.PhoneNo; addressLine1TextBox.Text = _studentPersonalDetails.AddressL1; if (!string.IsNullOrEmpty(addressLine2TextBox.Text)) { addressLine2TextBox.Text = _studentPersonalDetails.AddressL2; } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
private void buttonSearch_Click(object sender, EventArgs e) { var _studentId = Convert.ToInt16(textBoxStudentId.Text); var studenData = new StudentPersonalDetails(); var result = studenData.GetStudentCompleteDetails(_studentId); personalDetailsDataGridView.DataSource = result[0].Tables[0]; educationDetailsDataGridView.DataSource = result[1].Tables[0]; experienceDataGridView.DataSource = result[1].Tables[0]; technologiesDataGridView.DataSource = result[3].Tables[0]; }
//update student personla details private void updatePersonalDetailsButton_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(firstnameTextbox.Text)) { MessageBox.Show("Please Enter FirstName"); return; } if (string.IsNullOrEmpty(lastnameTextBox.Text)) { MessageBox.Show("Please Enter LastName"); return; } if (string.IsNullOrEmpty(emailidTextbox.Text)) { MessageBox.Show("Please Enter Email ID"); return; } if (string.IsNullOrEmpty(genderCombobox.SelectedItem.ToString())) { MessageBox.Show("Please Select Gender"); return; } if (string.IsNullOrEmpty(phonenumberTextbox.Text)) { MessageBox.Show("Please Enter Phone Number"); return; } if (string.IsNullOrEmpty(addressLine1TextBox.Text)) { MessageBox.Show("Please Enter details in Address Line 1"); return; } IStudentData _personalData = new StudentPersonalDetails(); StudentDetails _studentDetails = new StudentDetails(); _studentDetails.FirstName = firstnameTextbox.Text; _studentDetails.LastName = lastnameTextBox.Text; if (string.IsNullOrEmpty(dateOfBirthMonthCalendar.SelectionRange.Start.ToShortDateString())) { _studentDetails.DateOfBirth = dateOfBirthMonthCalendar.SelectionRange.Start.ToShortDateString(); } else { _studentDetails.DateOfBirth = dob; } _studentDetails.Email = emailidTextbox.Text; _studentDetails.Gender = genderCombobox.SelectedItem.ToString(); _studentDetails.PhoneNo = phonenumberTextbox.Text; _studentDetails.AddressL1 = addressLine1TextBox.Text; _studentDetails.StudentId = _studentID; if (!string.IsNullOrEmpty(addressLine2TextBox.Text)) { _studentDetails.AddressL2 = addressLine2TextBox.Text; } else { _studentDetails.AddressL2 = "Empty"; } string updateResult = _personalData.UpDateStudentDetails(_studentDetails); MessageBox.Show(updateResult); } catch (Exception ex) { MessageBox.Show("Exception Occured in Personal details tab " + ex.Message); } }