Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }