private void BindingDataToComboBox() { try { List <StudentDegree> student_degrees = StudentDegreeController.StudentDegreeSelectAll(); cmbStudentAdmissionDegree.DataSource = student_degrees; cmbStudentAdmissionDegree.DisplayMember = "DegreeName"; cmbStudentAdmissionDegree.ValueMember = "DegreeID"; cmbStudentAdmissionDegree.Tag = "DegreeID"; cmbStudentAdmissionDegree.SelectedIndex = 0; List <StudentProgram> selected_programs = StudentProgramController.StudentProgramSelectAll(); cmbStudentAdmissionProgram.DataSource = selected_programs; cmbStudentAdmissionProgram.DisplayMember = "ProgramName"; cmbStudentAdmissionProgram.ValueMember = "ProgramID"; cmbStudentAdmissionProgram.Tag = "ProgramID"; cmbStudentAdmissionProgram.SelectedIndex = 0; List <StudentSession> student_Sessions = StudentSessionController.StudentSessionSelectAll(); cmbStudentSession.DataSource = student_Sessions; cmbStudentSession.DisplayMember = "SessionName"; cmbStudentSession.ValueMember = "SessionID"; cmbStudentSession.Tag = "SessionID"; cmbStudentSession.SelectedIndex = 0; List <StudentSections> Student_section = StudentSectionsController.StudentSectionsSelectAll(); cmbStudentSession.DataSource = Student_section; cmbStudentSession.DisplayMember = "SectionName"; cmbStudentSession.ValueMember = "SectionID"; cmbStudentSession.Tag = "SectionID"; cmbStudentSession.SelectedIndex = 0; List <StudentSubject> student_Subject = StudentSubjectController.StudentSubjectSelectAll(); cmbMasterMajor.DataSource = student_Subject; cmbMasterMajor.DisplayMember = "SubjectName"; cmbMasterMajor.ValueMember = "SubjectID"; cmbMasterMajor.Tag = "SubjectID"; cmbMasterMajor.SelectedIndex = 0; List <DAEStudentMajor> student_DAEMajor = DAEStudentMajorController.DAEStudentMajorSelectAll(); cmbInterStudentDEAMajor.DataSource = student_DAEMajor; cmbDAE.DisplayMember = "DAEName"; cmbInterStudentDEAMajor.ValueMember = "DAEMajorID"; cmbInterStudentDEAMajor.Tag = "DAEMajorID"; cmbInterStudentDEAMajor.SelectedIndex = 0; List <AllReligion> religion = AllReligionController.AllReligionSelectAll(); cmbRligion.DataSource = religion; cmbRligion.DisplayMember = "ReligionName"; cmbRligion.ValueMember = "ReligionID"; cmbRligion.Tag = "ReligionID"; cmbRligion.SelectedIndex = 0; } catch (Exception) { } }
private void btnSave_Click(object sender, EventArgs e) { AllReligion religion = new AllReligion(); religion.ReligionID = 0; religion.ReligionName = txtReligion.Text; religion.AddByID = Convert.ToInt32(this.Tag); religion.AddByDateTime = System.DateTime.Now; religion.LastUpDateByID = Convert.ToInt32(this.Tag); religion.LastUpdateDateTime = System.DateTime.Now; religion.IsEnable = true; religion.Remarks = txtRemarks.Text; Int64 religion_Id = AllReligionController.InsertUpdateAllReligion(religion); if (religion_Id > 0) { SuccessMessage.SHowDialog("Religin Entered Successfully"); } else { ErrorMessage.SHowDialog("Religin not entered successfully"); } }