SpecialPointsHandler.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Microsoft.EntityFrameworkCore;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using wispro.sp.share;
  7. namespace wispro.sp.api.AppealHandler
  8. {
  9. public class SpecialPointsHandler : IDoAppealObject
  10. {
  11. public void DoAppeal(AppealObject appeal, int appealRecordId, DbContext spContext)
  12. {
  13. bool isAggree = true;
  14. if (isAggree)
  15. {
  16. var apRecord = ((spDbContext)spContext).AppealRecords.FirstOrDefault(p => p.Id == appealRecordId);
  17. if (apRecord != null)
  18. {
  19. var Item = ((spDbContext)spContext).PerformanceItems.FirstOrDefault(p=>p.Id == apRecord.ItemId);
  20. foreach (var iv in appeal.inputFieldValues)
  21. {
  22. if (iv.InputField == null)
  23. {
  24. iv.InputField = ((spDbContext)spContext).InputFields.FirstOrDefault(s => s.Id == iv.InputFieldId);
  25. }
  26. if (iv.InputField.FieldName == "给定点数")
  27. {
  28. Item.BasePoint = double.Parse(iv.Value);
  29. }
  30. if (iv.InputField.FieldName == "绩效类型")
  31. {
  32. Item.Type = iv.Value;
  33. }
  34. }
  35. Item.AgentFeedbackMemo = "特殊点数申诉";
  36. }
  37. else
  38. {
  39. throw new ApplicationException("没找到指定的申诉记录!");
  40. }
  41. }
  42. }
  43. }
  44. }