Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public int Execute(ICGSRequest icgs)
        {
            var repo = Uow.GetRepository <ICGSRequest>();

            repo.Create(icgs);
            Uow.SaveChanges();
            return(icgs.Id);
        }
Ejemplo n.º 3
0
        public async Task ExecuteAsync(ICGSRequest icgs)
        {
            var repo = Uow.GetRepository <ICGSRequest>();

            repo.Update(icgs);

            await Uow.SaveChangesAsync();
        }
Ejemplo n.º 4
0
        /// <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
                            });
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <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
                        });
                    }
                }
            }
        }