using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.ScoreManage; namespace EMIS.DataLogic.ScoreManage { public class ScoreFormulaDAL { public ScoreFormulaRepository scoreFormulaRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } public ScoreFormulaDetailRepository scoreFormulaDetailRepository { get; set; } public IQueryable GetScoreFormulaDetailViewQueryableByID(Guid scoreFormulaID) { var detail = from sfdr in scoreFormulaDetailRepository.GetList(x => x.ScoreFormulaID == scoreFormulaID) select new ScoreFormulaDropdownDetailView { ScoreFormulaDetailID = sfdr.ScoreFormulaDetailID, ScoreFormulaID = sfdr.ScoreFormulaID, IsRequirePass = sfdr.IsRequirePass, PassScore = sfdr.PassScore, ScoreType = sfdr.ScoreType, Percentage = sfdr.Percentage, PassScoreStr = sfdr.PassScore == null ? "" : sfdr.PassScore.ToString() }; List detailList = detail.ToList(); var query = from sfr in scoreFormulaRepository.GetList(x => x.ScoreFormulaID == scoreFormulaID) join sfdr in scoreFormulaDetailRepository.Entities on sfr.ScoreFormulaID equals sfdr.ScoreFormulaID select new ScoreFormulaDropdownView { Name = sfr.Name, ScoreFormulaID = sfr.ScoreFormulaID, ScoreFormulaDetail = detailList }; return detail; } } }