Ejemplo n.º 1
0
        public GetBtBasePatentListResult GetBtBasePatentList(GetBtBasePatentListArgument arg)
        {
            var result = new GetBtBasePatentListResult();
            var query  = new ProtectionDocList.Query
            {
                Result   = result,
                Argument = arg
            };

            _mediator.Send(query).Wait();
            return(result);
        }
Ejemplo n.º 2
0
        public void GetProtectionDocs(GetBtBasePatentListArgument argument, GetBtBasePatentListResult result)
        {
            if (!argument.DateBegin.HasValue)
            {
                throw new ArgumentNullException(nameof(argument.DateBegin));
            }

            if (!argument.DateEnd.HasValue)
            {
                throw new ArgumentNullException(nameof(argument.DateEnd));
            }

            result.List = GetBtBasePatents(argument);
        }
Ejemplo n.º 3
0
        private BtBasePatent[] GetBtBasePatents(GetBtBasePatentListArgument argument)
        {
            var protectionDocTypeCommercializationContractId = _dictionaryHelper.GetDictionaryIdByCode(nameof(DicProtectionDocType),
                                                                                                       DicProtectionDocType.Codes.CommercializationContract);
            var basePatents    = new List <BtBasePatent>();
            var protectionDocs = _niisWebContext.ProtectionDocs
                                 .Where(x => x.DateUpdate.Date >= argument.DateBegin.Value.Date &&
                                        x.DateUpdate.Date <= argument.DateEnd.Value.Date)
                                 .Select(x => new
            {
                x.Barcode,
                x.DateUpdate,
                TypeName = x.Type.NameRu,
                x.TypeId,
                x.RegNumber,
                x.RegDate,
                x.GosNumber,
                BulletinDate = x.TypeId == protectionDocTypeCommercializationContractId
                        ? x.GosDate
                        : x.Bulletins.Any()
                            ? x.Bulletins.FirstOrDefault().Bulletin.PublishDate
                            : null,
                SubTypeName = GetSubTypeName(x.TypeId, x.Type.NameRu, x.SubType.NameRu)
            });

            foreach (var protectionDoc in protectionDocs)
            {
                basePatents.Add(new BtBasePatent
                {
                    UID         = protectionDoc.Barcode,
                    GosNumber   = protectionDoc.GosNumber,
                    PublishDate = protectionDoc.BulletinDate?.DateTime,
                    ReqDate     = protectionDoc.RegDate?.DateTime,
                    ReqNumber   = protectionDoc.RegNumber,
                    RefType     = protectionDoc.SubTypeName,
                    TypeID      = protectionDoc.TypeId,
                    TypeName    = protectionDoc.TypeName
                });
            }

            return(basePatents.ToArray());
        }