public void LoadTeachers() { ITeacherService teacherService = new TeacherService(); string message = String.Empty; try { var teachers = teacherService.GetAllTeachers(); teacherList = new List<Teacher>(teachers); gvTeacher.DataSource = teachers; gvTeacher.Refresh(); if (gvTeacher.RowCount != 0) gvTeacher.Rows[0].IsSelected = true; } catch (Exception ex) { message = "Error Loading Faculty List"; MessageBox.Show(ex.ToString()); } }
public List <Teacher> GetAvailableTeachers(string timeslotcode) { List <Teacher> teacherList = new List <Teacher>(); List <SubjectAssignment> schedList = new List <SubjectAssignment>(); List <Teacher> takenTeachers = new List <Teacher>(); List <Teacher> availableTeachers = new List <Teacher>(); SubjectAssignmentService sas = new SubjectAssignmentService(); schedList = GetAllSchedules(); foreach (SubjectAssignment sa in schedList) { takenTeachers.Add(sa.Teacher); } TeacherService ts = new TeacherService(); teacherList = ts.GetAllTeachers(); availableTeachers = teacherList.Except <Teacher>(takenTeachers).ToList <Teacher>(); return(availableTeachers); }
public List <Teacher> GetAllTeachers() { TeacherService ts = new TeacherService(); return(ts.GetAllTeachers()); }
public List<Teacher> GetAllTeachers() { TeacherService t = new TeacherService(); return t.GetAllTeachers(); }
public List<Teacher> GetAvailableTeachers(string timeslotcode) { List<Teacher> teacherList = new List<Teacher>(); List<SubjectAssignment> schedList = new List<SubjectAssignment>(); List<Teacher> takenTeachers = new List<Teacher>(); List<Teacher> availableTeachers = new List<Teacher>(); SubjectAssignmentService sas = new SubjectAssignmentService(); schedList = GetAllSchedules(); foreach (SubjectAssignment sa in schedList) { takenTeachers.Add(sa.Teacher); } TeacherService ts = new TeacherService(); teacherList = ts.GetAllTeachers(); availableTeachers = teacherList.Except<Teacher>(takenTeachers).ToList<Teacher>(); return availableTeachers; }
private void Save() { string szGender = string.Empty; string szBloodType = string.Empty; bool acad = false; if (cmbGender.Text == "Female") szGender = "F"; if (cmbGender.Text == "Male") szGender = "M"; if (cmbBloodType.Text == "A") szBloodType = "A"; if (cmbBloodType.Text == "O") szBloodType = "O"; if (cmbBloodType.Text == "AB") szBloodType = "AB"; if (cmbBloodType.Text == "A") szBloodType = "A"; if (radioAcademic.Checked == true && radioNonAcad.Checked == false) acad = true; else if (radioAcademic.Checked == false && radioNonAcad.Checked == true) acad = false; else if (radioAcademic.Checked == false && radioNonAcad.Checked == false) acad = false; Boolean ret = false; string message = String.Empty; byte[] bImage = null; if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png); TeacherService teacherService = new TeacherService(); String fName = txtFirstName.Text; String mName = txtMiddleName.Text; String lName = txtLastName.Text; String cName = fName.Trim() + mName.Trim() + lName.Trim(); var teachers = teacherService.GetAllTeachers(); teacherCompare = new List<Teacher>(teachers); Teacher teacher = new Teacher() { TeacherId = txtTeacherID.Text, BloodType = szBloodType, CivilStatus = cmbCivilState.Text, DOB = dtBirth.Value, DateOfAppointment = dtAppointment.Value, EmailAddress = txtEmailAdd.Text, EmploymentStatus = txtEmploymentState.Text, DialectSpoken = txtDialect.Text, FirstName = txtFirstName.Text, MiddleName = txtMiddleName.Text, LastName = txtLastName.Text, Gender = szGender, HeightCm = int.Parse(txtHeight.Text), WeightKg = double.Parse(txtWeight.Text), MobileNo = txtCellphone.Text, PAMunicipality = txtPA_Municipality.Text, PAProvince = txtPA_Province.Text, PARegion = cmbPA_Region.SelectedValue.ToString(), PAStreetName = txtPA_StreetName.Text, POBMunicipality = txtPOB_Municipality.Text, POBProvince = txtPOB_Province.Text, PagIBIGNo = txtPagIbig.Text, PhilHealthNo = txtPhilHealth.Text, PreviousSchool = txtSchoolReassigned.Text, RAMunicipality = txtRes_Municipality.Text, RAProvince = txtRes_Province.Text, RARegion = cmbRes_Region.SelectedValue.ToString(), RAStreetName = txtRes_StreetName.Text, ResTelephoneNo = txtRes_TelNo.Text, SSSNum = txtSSS.Text, SpouseBusinessAdd = txtSpouse_BusinessAdd.Text, SpouseEmployerName = txtSpouse_Employer.Text, SpouseFirstName = txtSpouse_FirstName.Text, SpouseLastName = txtSpouse_LastName.Text, SpouseMiddleName = txtSpouse_MiddleName.Text, SpouseOccupation = txtSpouse_Occupation.Text, SpouseTelephoneNo = txtSpouse_Contact.Text, TIN = txtTIN.Text, Image = bImage, PERAA = txtPERAA.Text, Academic = acad, Salary = double.Parse(txtSalary.Text), Department = txtDepartment.Text, TeacherChildrens = teachChild, TeacherEducationalBackgrounds = educBack, TeacherEligibilities = teachElig, WorkExperiences = workExp, TrainingSeminars=trainSem, }; if (Op.Equals("edit")) { ret = teacherService.UpdateTeacher(ref teacher, ref message); ILogService logService = new LogService(); teacher.TeacherChildrens = null; teacher.TeacherEducationalBackgrounds = null; teacher.TeacherEligibilities = null; teacher.TrainingSeminars = null; teacher.WorkExperiences = null; Log("U", "Teachers", teacher); foreach (TeacherChildren tc in teachChild) Log("U", "TeacherChildren", tc); foreach (TeacherEducationalBackground teb in educBack) Log("U", "TeacherEducationalBackground", teb); foreach (TeacherEligibility te in teachElig) Log("U", "TeacherEligibilities", te); foreach (WorkExperience we in workExp) Log("U", "WorkExperiences", we); foreach (TrainingSeminar ts in trainSem) Log("U", "TrainingSeminars", ts); } else { foreach (Teacher tc in teacherCompare) { String compareString = tc.FirstName.Trim() + tc.MiddleName.Trim() + tc.LastName.Trim(); if (cName.Equals(compareString)) { MessageBox.Show("Teacher already exist!"); break; } else { ret = teacherService.CreateTeacher(ref teacher, ref message); Log("C", "Teachers", teacher); } } } // if (ret) MessageBox.Show("Saved Successfully"); //else // MessageBox.Show("Error Saving"); Close(); }