ScoreFormulaDAL.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.ScoreManage;
  7. namespace EMIS.DataLogic.ScoreManage
  8. {
  9. public class ScoreFormulaDAL
  10. {
  11. public ScoreFormulaRepository scoreFormulaRepository { get; set; }
  12. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  13. public ScoreFormulaDetailRepository scoreFormulaDetailRepository { get; set; }
  14. public IQueryable<ScoreFormulaDropdownDetailView> GetScoreFormulaDetailViewQueryableByID(Guid scoreFormulaID)
  15. {
  16. var detail = from sfdr in scoreFormulaDetailRepository.GetList(x => x.ScoreFormulaID == scoreFormulaID)
  17. select new ScoreFormulaDropdownDetailView
  18. {
  19. ScoreFormulaDetailID = sfdr.ScoreFormulaDetailID,
  20. ScoreFormulaID = sfdr.ScoreFormulaID,
  21. IsRequirePass = sfdr.IsRequirePass,
  22. PassScore = sfdr.PassScore,
  23. ScoreType = sfdr.ScoreType,
  24. Percentage = sfdr.Percentage,
  25. PassScoreStr = sfdr.PassScore == null ? "" : sfdr.PassScore.ToString()
  26. };
  27. List<ScoreFormulaDropdownDetailView> detailList = detail.ToList();
  28. var query = from sfr in scoreFormulaRepository.GetList(x => x.ScoreFormulaID == scoreFormulaID)
  29. join sfdr in scoreFormulaDetailRepository.Entities
  30. on sfr.ScoreFormulaID equals sfdr.ScoreFormulaID
  31. select new ScoreFormulaDropdownView
  32. {
  33. Name = sfr.Name,
  34. ScoreFormulaID = sfr.ScoreFormulaID,
  35. ScoreFormulaDetail = detailList
  36. };
  37. return detail;
  38. }
  39. }
  40. }