using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel.ExamManage; namespace EMIS.DataLogic.ExamManage { public class ProjectFeeDAL { public ExaminationProjectFeeTypeRepository ProjectFeeTypeRepository { get; set; } public DictionaryItemRepository DictionaryItemRepository { get; set; } public ExaminationProjectFeeRepository ProjectFeeRepository { get; set; } public ExaminationProjectRepository ProjectRepository { get; set; } public ExaminationTypeRepository TypeRepository { get; set; } public ExaminationProjectSubjectRepository ProjectSubjectRepository { get; set; } public ExaminationBatchProjectRepository BatchProjectRepository { get; set; } public ExaminationBatchProjectControlRepository ExaminationBatchProjectControlRepository { get; set; } public ExaminationProjectFeeRepository ExaminationProjectFeeRepository { get; set; } public IQueryable GetProjectFeeTypeGrid(Expression> expCampus) { var query = from a in ProjectFeeTypeRepository.GetList(expCampus) join c in DictionaryItemRepository.Entities on new { a.FeeTypeID, DictionaryCode = "EX_ExaminationProjectFeeType" } equals new { FeeTypeID = c.Value, c.DictionaryCode } select new EMIS.ViewModel.ProjectFeeTypeView { ExaminationProjectFeeTypeID = a.ExaminationProjectFeeTypeID, ExaminationProjectFeeID = a.ExaminationProjectFeeID, Fee = a.Fee, FeeTypeID = a.FeeTypeID, FeeTypeName = c.Name, IsRequiredForNew = a.IsRequiredForNew, IsResit = a.IsResit, IsMaterial = a.IsMaterial, IsTrainingFee = a.IsTrainingFee, IsResitText = a.IsResit == true ? "是" : "否", IsMaterialText = a.IsMaterial == true ? "是" : "否", IsTrainingFeeText = a.IsTrainingFee == true ? "是" : "否" }; return query; } public IQueryable GetProectListViewGrid(Expression> expFeetype) { var query = from a in ProjectRepository.Entities.Where(expFeetype) join c in DictionaryItemRepository.Entities on new { a.ExaminationLevelID, DictionaryCode = "EX_ExaminationLevel" } equals new { ExaminationLevelID = c.Value, c.DictionaryCode } join d in DictionaryItemRepository.Entities on new { a.IssuedByID, DictionaryCode = "EX_Issuer" } equals new { IssuedByID = d.Value, d.DictionaryCode } select new EMIS.ViewModel.ExaminationProjectView { ExaminationLevelID = a.ExaminationLevelID, ExaminationProjectID = a.ExaminationProjectID, ExaminationType = a.EX_ExaminationType.Name, ExaminationTypeID = a.ExaminationTypeID, Name = a.Name, IssuedByID = a.IssuedByID, ExaminationLevelText = c.Name, IssuedByIDText = d.Name, EX_ExaminationProjectSubject = a.EX_ExaminationProjectSubject, PreposeProjectID = a.PreposeProjectID, Remark = a.Remark }; return query; } public IQueryable GetProectListViewGridForSelect(Expression> expFeetype) { var query = from a in ProjectRepository.Entities.Where(expFeetype) join c in DictionaryItemRepository.Entities on new { a.ExaminationLevelID, DictionaryCode = "EX_ExaminationLevel" } equals new { ExaminationLevelID = c.Value, c.DictionaryCode } join d in DictionaryItemRepository.Entities on new { a.IssuedByID, DictionaryCode = "EX_Issuer" } equals new { IssuedByID = d.Value, d.DictionaryCode } select new EMIS.ViewModel.ExaminationProjectViewNotSubject { ExaminationLevelID = a.ExaminationLevelID, ExaminationProjectID = a.ExaminationProjectID, ExaminationType = a.EX_ExaminationType.Name, ExaminationTypeID = a.ExaminationTypeID, Name = a.Name, IssuedByID = a.IssuedByID, ExaminationLevelText = c.Name, IssuedByIDText = d.Name, PreposeProjectID = a.PreposeProjectID, Remark = a.Remark }; return query; } public IQueryable GetProjectFeeType(Expression> expFeetype) { var query = from a in ProjectFeeTypeRepository.Entities.Where(expFeetype) join c in DictionaryItemRepository.Entities on new { a.FeeTypeID, DictionaryCode = "EX_ExaminationProjectFeeType" } equals new { FeeTypeID = c.Value, c.DictionaryCode } select new EMIS.ViewModel.ProjectFeeTypeView { ExaminationProjectFeeTypeID = a.ExaminationProjectFeeTypeID, ExaminationProjectFeeID = a.ExaminationProjectFeeID, Fee = a.Fee, FeeTypeID = a.FeeTypeID, FeeTypeName = c.Name, IsRequiredForNew = a.IsRequiredForNew, IsResitText = a.IsResit == true ? "是" : "否", IsMaterialText = a.IsMaterial == true ? "是" : "否", IsTrainingFeeText = a.IsTrainingFee == true ? "是" : "否", IsResit = a.IsResit, IsMaterial = a.IsMaterial, IsTrainingFee = a.IsTrainingFee, }; return query; } public IQueryable GetProjectFee(Expression> expFee) { var query = from a in ProjectFeeRepository.Entities.Where(expFee) join p in ProjectRepository.Entities on a.ExaminationProjectID equals p.ExaminationProjectID select new EMIS.ViewModel.ExaminationProjectFeeView { ExaminationProjectFeeID = a.ExaminationProjectFeeID, ExaminationType = p.EX_ExaminationType.Name, ExaminationProjectID = a.ExaminationProjectID, Name = a.Name, ProjectName = p.Name, ExaminationTypeID = p.ExaminationTypeID, RecordStatus = a.RecordStatus.Value }; return query; } public IQueryable GerProjectFeeByProjectAndYearStandard(Expression> expebpc) { var query = from ebpcr in ExaminationBatchProjectControlRepository.Entities.Where(expebpc) from epfr in ExaminationProjectFeeRepository.Entities.Where(x => ebpcr.ExaminationProjectFeeID == x.ExaminationProjectFeeID) select new EMIS.ViewModel.ExaminationProjectFeeView { ExaminationProjectFeeID = ebpcr.ExaminationProjectFeeID.Value, ExaminationProjectID = epfr.ExaminationProjectID, Name = epfr.Name, ProjectName = epfr.EX_ExaminationProject.Name, }; return query; } public IQueryable GetExaminationType(Expression> expFee) { var query = from a in TypeRepository.Entities.Where(expFee) select a; return query; } public IQueryable GetProjectSubjectList(Expression> expFee) { var query = from a in ProjectSubjectRepository.Entities.Where(expFee) join c in DictionaryItemRepository.Entities on new { a.ExaminationSubjectID, DictionaryCode = "EX_ExaminationSubject" } equals new { ExaminationSubjectID = c.Value, c.DictionaryCode } select new EMIS.ViewModel.ExaminationProjectSubjectView { ExaminationProjectSubjectID = a.ExaminationProjectSubjectID, ExaminationSubject = c.Name, ExaminationSubjectID = a.ExaminationSubjectID, ExaminationProjectID = a.ExaminationProjectID, SubjectCode = c.Code }; return query; } public IQueryable GetExamSubjectByProjectID(Expression> expeps) { var query = from psr in ProjectSubjectRepository.Entities.Where(expeps) from dic in DictionaryItemRepository.Entities.Where(x => x.DictionaryCode == "EX_ExaminationSubject" && x.Value == psr.ExaminationSubjectID) select new ExamSubjectView { ExaminationSubjectID = psr.ExaminationSubjectID, ExaminationSubjectName = dic.Name, ResitCount = psr.ResitCount, }; return query; } public IQueryable GetExamSubject() { var query = from dic in DictionaryItemRepository.Entities.Where(x => x.DictionaryCode == "EX_ExaminationSubject") select new ExamSubjectView { ExaminationSubjectID = dic.Value, ExaminationSubjectName = dic.Name, //ResitCount = psr.ResitCount, }; return query; } } }