private ICGSRequest CreateIcg(RfTmIcgs oldIcg, int requestId) { try { var icgId = GetObjectId <DicICGS>(oldIcg.IcpsId); if (icgId == null || icgId == 0) { return(null); } var icg = new ICGSRequest { ClaimedDescription = oldIcg.FlDscStarted, DateCreate = new DateTimeOffset(oldIcg.DateCreate.GetValueOrDefault(DateTime.Now)), DateUpdate = new DateTimeOffset(oldIcg.Stamp.GetValueOrDefault(DateTime.Now)), Description = oldIcg.Dsc, DescriptionKz = oldIcg.DscKz, ExternalId = oldIcg.Id, IcgsId = icgId.Value, IsNegative = GenerateHelper.StringToNullableBool(oldIcg.IsNegative), IsNegativePartial = GenerateHelper.StringToNullableBool(oldIcg.FlIsNegativePartial), RequestId = requestId, Timestamp = BitConverter.GetBytes(DateTime.Now.Ticks) }; return(icg); } catch (Exception) { return(null); } }
public int Execute(ICGSRequest icgs) { var repo = Uow.GetRepository <ICGSRequest>(); repo.Create(icgs); Uow.SaveChanges(); return(icgs.Id); }
public async Task ExecuteAsync(ICGSRequest icgs) { var repo = Uow.GetRepository <ICGSRequest>(); repo.Update(icgs); await Uow.SaveChangesAsync(); }
/// <summary> /// (511) МКТУ- Описание отказа по классу /// </summary> /// <param name="localContext"></param> /// <param name="markgr"></param> /// <param name="request"></param> /// <param name="statusCode"></param> /// <param name="protectionDocIcgs"></param> private void ProcessIcgsRefuse(NiisWebContext localContext, MARKGR markgr, Request request, string statusCode, IList <ICGSProtectionDoc> protectionDocIcgs) { foreach (var lin in markgr.LIN.Where(l => l.DCPCD.Contains(KZ))) { foreach (var limto in lin.LIMTO) { var icgs = localContext.DicICGSs.FirstOrDefault(di => di.NameEn.Contains(limto.NICCLAI.Trim())); if (icgs != null) { var gsterStr = new[] { limto.GSTERMEN, limto.GSTERMES, limto.GSTERMFR }.FirstOrDefault(str => !string.IsNullOrEmpty(str)) ?? string.Empty; var icgsObj = localContext.ICGSRequests.FirstOrDefault(icf => icf.IcgsId != icgs.Id && icf.RequestId != request.Id); if (icgsObj == null) { var ir = new ICGSRequest { IcgsId = icgs.Id, Icgs = icgs, IsRefused = true }; LogMsg(ir.Description, gsterStr, "(511) МКТУ- Описание отказа по классу"); ir.ClaimedDescription = ir.Description = gsterStr; request.ICGSRequests.Add(ir); } else { LogMsg(icgsObj.Description, gsterStr, "(511) МКТУ- Описание отказа по классу"); icgsObj.Description = icgsObj.ClaimedDescription = gsterStr; } if (statusCode == "D.TZ") { protectionDocIcgs.Add(new ICGSProtectionDoc { DateCreate = DateTimeOffset.Now, ClaimedDescription = gsterStr, Description = gsterStr, IsNegative = false }); } } } } }
/// <summary> /// МКТУ /// </summary> /// <param name="localContext"></param> /// <param name="markgr"></param> /// <param name="request"></param> /// <param name="statusCode"></param> /// <param name="protectionDocIcgs"></param> private void ProcessIcgs(NiisWebContext localContext, MARKGR markgr, Request request, string statusCode, IList <ICGSProtectionDoc> protectionDocIcgs) { foreach (var gsgr in markgr.CURRENT.BASICGS.GSGRs) { var icgs = localContext.DicICGSs.FirstOrDefault(di => di.NameEn.Contains(gsgr.NICCLAI.Trim())); if (icgs != null) { var gstrStr = new[] { gsgr.GSTERMEN, gsgr.GSTERMES, gsgr.GSTERMFR }.FirstOrDefault(str => !string.IsNullOrEmpty(str)) ?? string.Empty; var icgsObj = localContext.ICGSRequests.FirstOrDefault(icf => icf.IcgsId == icgs.Id && icf.RequestId == request.Id); if (icgsObj == null) { var ir = new ICGSRequest { IcgsId = icgs.Id, Icgs = icgs }; LogMsg(ir.Description, gstrStr, "МКТУ"); ir.ClaimedDescription = ir.Description = gstrStr; request.ICGSRequests.Add(ir); } else { LogMsg(icgsObj.Description, gstrStr, "МКТУ"); icgsObj.ClaimedDescription = icgsObj.Description = gstrStr; } if (statusCode == "D.TZ") { protectionDocIcgs.Add(new ICGSProtectionDoc { DateCreate = DateTimeOffset.Now, ClaimedDescription = gstrStr, Description = gstrStr }); } } } }