using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using wispro.sp.share; namespace wispro.sp.api.AppealHandler { public class SpecialPointsHandler : IDoAppealObject { public void DoAppeal(AppealObject appeal, int appealRecordId, DbContext spContext) { bool isAggree = true; if (isAggree) { var apRecord = ((spDbContext)spContext).AppealRecords.FirstOrDefault(p => p.Id == appealRecordId); if (apRecord != null) { var Item = ((spDbContext)spContext).PerformanceItems.FirstOrDefault(p=>p.Id == apRecord.ItemId); foreach (var iv in appeal.inputFieldValues) { if (iv.InputField == null) { iv.InputField = ((spDbContext)spContext).InputFields.FirstOrDefault(s => s.Id == iv.InputFieldId); } if (iv.InputField.FieldName == "给定点数") { Item.BasePoint = double.Parse(iv.Value); } if (iv.InputField.FieldName == "绩效类型") { Item.Type = iv.Value; } } Item.AgentFeedbackMemo = "特殊点数申诉"; } else { throw new ApplicationException("没找到指定的申诉记录!"); } } } } }