public BaseSearchViewModel() { State = new State(); TeacherType = new TeacherType(); Qualification = new QualificationCategory(); StudentCategory = new StudentCategory(); }
public ServiceCharge GetRequestCostBy(QualificationCategory qualification) { try { if (qualification == null || qualification.Id <= 0) { throw new ArgumentNullException("qualification"); } int serviceChargeId = 0; switch (qualification.Id) { case 3: { serviceChargeId = (int)ServiceCharge.Services.RequestToEmployTeacherWithCertificate; break; } case 6: { serviceChargeId = (int)ServiceCharge.Services.RequestToEmployTeacherWithFirstDegree; break; } case 7: { serviceChargeId = (int)ServiceCharge.Services.RequestToEmployTeacherWithSecondDegree; break; } case 8: { serviceChargeId = (int)ServiceCharge.Services.RequestToEmployTeacherWithPhDDegree; break; } default: { throw new Exception("Invalid qualification specified! Please contact your system administrator"); } } return(_da.GetModelBy <ServiceCharge, SERVICE_CHARGE>(tc => tc.Service_Charge_Id == serviceChargeId)); } catch (Exception) { throw; } }
public List <Teacher> GetBy(QualificationCategory qualificationCategory) { try { List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>() where teacher.TEACHER_EDUCATIONAL_QUALIFICATION.Any(x => x.QUALIFICATION.Qualification_Category_Id == qualificationCategory.Id) select teacher).ToList(); List <Teacher> teachers = Translate(entities); return(GetByHelper(teachers)); } catch (Exception) { throw; } }
public List <Teacher> GetBy(TeacherType teacherType, QualificationCategory qualification, State state) { try { List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>() where teacher.PERSON.State_Id == state.Id && teacher.TEACHER_STUDENT_CATEGORY.Any(x => x.TEACHER.Teacher_Type_Id == teacherType.Id) && teacher.TEACHER_EDUCATIONAL_QUALIFICATION.Any(x => x.QUALIFICATION.Qualification_Category_Id == qualification.Id) select teacher).ToList(); List <Teacher> teachers = Translate(entities); return(GetByHelper(teachers)); } catch (Exception) { throw; } }
protected List <Teacher> FindTeacherByHelper(TeacherType teacherType, StudentCategory studentCategory, QualificationCategory qualification, State location) { List <Teacher> teachers = null; try { if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(studentCategory); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(qualification); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(location); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, studentCategory); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, qualification); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, location); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(studentCategory, qualification); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(studentCategory, location); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(qualification, location); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, studentCategory, qualification); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, studentCategory, location); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, qualification, location); } else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(studentCategory, qualification, location); } else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id))) { teachers = _teacherFinder.GetBy(teacherType, studentCategory, qualification, location); } return(teachers); } catch (Exception) { throw; } }