private async Task <Request> CreateRequest(DdDocument ddDocument) { var customerId = GetObjectId <DicCustomer>(ddDocument.CustomerId); if ((customerId == null || customerId == 0) && ddDocument.CustomerId.HasValue) { customerId = await GetCustomer(ddDocument.CustomerId.Value); } var result = new Request { AddresseeId = customerId, Barcode = ddDocument.Id, ConventionTypeId = GetObjectId <DicConventionType>(ddDocument.TypeiiId), CopyCount = ddDocument.CopyCount, DateCreate = new DateTimeOffset(ddDocument.DateCreate.GetValueOrDefault(DateTime.Now)), DateUpdate = new DateTimeOffset(ddDocument.Stamp.GetValueOrDefault(DateTime.Now)), DepartmentId = GetObjectId <DicDepartment>(ddDocument.DepartmentId), DisclaimerKz = ddDocument.DisclamKz, DisclaimerRu = ddDocument.DisclamRu, DivisionId = GetObjectId <DicDivision>(ddDocument.DivisionId), ExternalId = ddDocument.Id, FlDivisionId = GetObjectId <DicDivision>(ddDocument.FlDivisionId), Image = ddDocument.Image, IncomingNumber = ddDocument.InoutNum, IncomingNumberFilial = ddDocument.InnumAdd, IsComplete = GenerateHelper.StringToBool(ddDocument.IsComplete), IsDeleted = false, IsImageFromName = false, IsRead = true, NameEn = ddDocument.DescriptionMlEn, NameKz = ddDocument.DescriptionMlKz, NameRu = ddDocument.DescriptionMlRu, NumberBulletin = ddDocument.Nby, OutgoingNumber = ddDocument.Outnum, PageCount = ddDocument.PageCount, PreviewImage = ddDocument.SysImagesmall, ProtectionDocTypeId = GetProtectionDocTypeByCode(MapOldRequestTypeToProtectionDocType.Get(ddDocument.DoctypeId)), PublicDate = GetNullableDate(ddDocument.PublicationDate), ReceiveTypeId = GetObjectId <DicReceiveType>(ddDocument.SendType), Referat = ddDocument.Ref57, RequestDate = GetNullableDate(ddDocument.DocumDate), RequestNum = ddDocument.DocumNum, RequestTypeId = InitializeSubType(ddDocument), SpeciesTradeMarkId = GetSpeciesTradeMarkId(ddDocument), SelectionFamily = ddDocument.SelectionFamily, StatusId = GetObjectId <DicRequestStatus>(ddDocument.StatusId), Timestamp = BitConverter.GetBytes(DateTime.Now.Ticks), TransferDate = GetNullableDate(ddDocument.Date85), Transliteration = ddDocument.Trasliteration, UserId = GetUserId(ddDocument.UserId), PublishDate = GetNullableDate(ddDocument.Dby) }; InitializeTypeTrademark(result); return(result); }
private int?GetSpeciesTradeMarkId(DdDocument ddDocument) { var protDocTypeId = GetProtectionDocTypeByCode(MapOldRequestTypeToProtectionDocType.Get(ddDocument.DoctypeId)); var protDocTypeCode = DictionaryHelper.GetDictionaryCodeById(nameof(DicProtectionDocType), protDocTypeId); if (!GetObjectId <DicProtectionDocSubType>(ddDocument.SubtypeId).HasValue&& protDocTypeCode == DicProtectionDocType.Codes.Trademark) { return(DictionaryHelper.GetSpeciesTradeMarkId(false)); } return(null); }
private async Task <Contract> CreateContract(DdDocument oldContract) { var customerId = GetObjectId <DicCustomer>(oldContract.CustomerId); if ((customerId == null || customerId == 0) && oldContract.CustomerId.HasValue) { customerId = await GetCustomer(oldContract.CustomerId.Value); } var contract = new Contract { AddresseeId = customerId, ApplicationNum = oldContract.ReqNumber21, Barcode = oldContract.Id, BulletinDate = GetNullableDate(oldContract.Dby), ContractNum = oldContract.ReqNumber21, CopyCount = oldContract.CopyCount, DateCreate = new DateTimeOffset(oldContract.DateCreate.GetValueOrDefault(DateTime.Now)), DateUpdate = new DateTimeOffset(oldContract.Stamp.GetValueOrDefault(DateTime.Now)), DepartmentId = GetObjectId <DicDepartment>(oldContract.DepartmentId), Description = $"{oldContract.DescriptionMlRu} {oldContract.DescriptionMlKz} {oldContract.DescriptionMlEn}", DivisionId = GetObjectId <DicDivision>(oldContract.DivisionId), ExternalId = oldContract.Id, GosDate = GetNullableDate(oldContract.GosDate11), GosNumber = oldContract.GosNumber11, IsRead = true, NameEn = oldContract.DescriptionMlEn, NameKz = oldContract.DescriptionMlKz, NameRu = oldContract.DescriptionMlRu, NumberBulletin = oldContract.Nby, OutgoingNumber = oldContract.Outnum, PageCount = oldContract.PageCount, ProtectionDocTypeId = DictionaryHelper.GetDictionaryIdByCode(nameof(DicProtectionDocType), DicProtectionDocTypeCodes.ProtectionDocTypeContractCode), ReceiveTypeId = GetObjectId <DicReceiveType>(oldContract.SendType), RegDate = GetNullableDate(oldContract.ReqDate22), StatusId = GetObjectId <DicContractStatus>(oldContract.StatusId), Timestamp = BitConverter.GetBytes(DateTime.Now.Ticks), ValidDate = oldContract.Stz17?.ToString("dd.MM.yyyy"), TypeId = GetObjectId <DicProtectionDocSubType>(oldContract.SubtypeId) }; return(contract); }
private int?InitializeSubType(DdDocument ddDocument) { var oldTypeId = GetProtectionDocTypeByCode(MapOldRequestTypeToProtectionDocType.Get(ddDocument.DoctypeId)); int?dicProtectionDocSubTypeId; switch (oldTypeId) { case ClDocumentId.Eapo: dicProtectionDocSubTypeId = DictionaryHelper.GetDictionaryIdByCode(nameof(DicProtectionDocSubType), "EAPO"); break; case ClDocumentId.Rst: dicProtectionDocSubTypeId = DictionaryHelper.GetDictionaryIdByCode(nameof(DicProtectionDocSubType), "PCT"); break; default: dicProtectionDocSubTypeId = GetObjectId <DicProtectionDocSubType>(ddDocument.SubtypeId); break; } return(dicProtectionDocSubTypeId); }