public GetBtBasePatentListResult GetBtBasePatentList(GetBtBasePatentListArgument arg) { var result = new GetBtBasePatentListResult(); var query = new ProtectionDocList.Query { Result = result, Argument = arg }; _mediator.Send(query).Wait(); return(result); }
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); }
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()); }