监管端量化等级中转换日常监督管理机构的代码(在MainMaodel的初始化方法中写)
var LiShiSCJG_SPAQNianDuDengjiPDB = _ioc.Query<SCJG_SPAQNianDuDengjiPDB>(false) //查找出不是本年度的记录 .ToList(); for(var i = 0; i < LiShiSCJG_SPAQNianDuDengjiPDB.Count(); i++) { var jianChaJiLu = _ioc.Query<SCJG_JianChaJiLu>(false) .Where(e => e.JianChaLeiBie == "食品经营日常检查" && !string.IsNullOrEmpty(e.JianChaJieGuo)) .Where(e => !string.IsNullOrEmpty(e.XuKeZhengHao)) .Where(e => e.XuKeZhengHao == LiShiSCJG_SPAQNianDuDengjiPDB[i].XuKeZhengHao) .FirstOrDefault(); if (jianChaJiLu==null) { LiShiSCJG_SPAQNianDuDengjiPDB[i].Delete().SaveToDBAsync().Wait(); } else { if (string.IsNullOrEmpty(LiShiSCJG_SPAQNianDuDengjiPDB[i].RiChangJianDuGuanLiJiGou)) { LiShiSCJG_SPAQNianDuDengjiPDB[i].RiChangJianDuGuanLiJiGou = jianChaJiLu.JianGuanPianOu; LiShiSCJG_SPAQNianDuDengjiPDB[i].Update().SaveToDBAsync().Wait(); } } }