Ejemplo n.º 1
0
        public CompanyResponse Map(Company address)
        {
            if (address == null)
            {
                return(null);
            }
            ;

            CompanyResponse response = new CompanyResponse
            {
                Id            = address.Id,
                Name          = address.Name,
                Addition      = address.Addition,
                Addition2     = address.Addition2,
                Street        = address.Street,
                PostCode      = address.PostCode,
                City          = address.City,
                Email         = address.Email,
                Phone         = address.Phone,
                Fax           = address.Fax,
                VatId         = address.VatId,
                TimeZone      = address.TimeZone,
                ParentId      = (System.Guid)address.ParentId,
                Parent        = _addressMapper.Map(address.Parent),
                CountryId     = address.CountryId,
                Country       = _countryMapper.Map(address.Country),
                LogoId        = (System.Guid)address.LogoId,
                Logo          = _fagBinaryMapper.Map(address.Logo),
                CompanyTypeId = address.CompanyTypeId,
                CompanyType   = _companyTypeMapper.Map(address.CompanyType)
            };

            return(response);
        }
Ejemplo n.º 2
0
        public async Task <RespContainer <CompanyResponse> > Handle(AddCompanyCommand request, CancellationToken cancellationToken)
        {
            Models.Company company = _companyMapper.Map(request.Data);
            Models.Company result  = _companyRespository.Add(company);

            int modifiedRecords = await _companyRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(RespContainer.Ok(_companyMapper.Map(result), "Company Created"));
        }
Ejemplo n.º 3
0
        public async Task <CompanyResponse> AddCompanyAsync(AddCompanyRequest request)
        {
            Company address = _companyMapper.Map(request);
            Company result  = _companyRespository.Add(address);

            int modifiedRecords = await _companyRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(_companyMapper.Map(result));
        }
Ejemplo n.º 4
0
        public ArticlePlaceResponse Map(ArticlePlace articlePlace)
        {
            if (articlePlace == null)
            {
                return(null);
            }
            ;

            ArticlePlaceResponse response = new ArticlePlaceResponse
            {
                Id          = articlePlace.Id,
                ReservedQty = articlePlace.ReservedQty,
                MinimumQty  = articlePlace.MinimumQty,
                OpoQty      = articlePlace.OpoQty,
                CompanyId   = articlePlace.CompanyId,
                Company     = _addressMapper.Map(articlePlace.Company)
            };

            return(response);
        }
Ejemplo n.º 5
0
        public DocumentResponse Map(Document document)
        {
            if (document == null)
            {
                return(null);
            }
            ;

            DocumentResponse response = new DocumentResponse
            {
                Id = document.Id,
                CompanyTextDocument = document.CompanyTextDocument,
                CompanyTextDelivery = document.CompanyTextDelivery,
                CompanyTextInvoice  = document.CompanyTextInvoice,
                Number       = document.Number,
                DocumentType = document.DocumentType,
                SubType      = document.SubType,
                TypeName     = document.TypeName,
                ValueBias    = document.ValueBias,
                Status       = document.Status,
                PrintDate    = document.PrintDate,
                ReminderDate = document.ReminderDate,
                PrintCount   = document.PrintCount,
                NetPriceSum  = document.NetPriceSum,
                PriceGross   = document.PriceGross,
                IsArchived   = document.IsArchived,

                TextStartId        = (Guid)document.TextStartId,
                TextStart          = _fagTextMapper.Map(document.TextStart),
                TextHeadId         = (Guid)document.TextHeadId,
                TextHead           = _fagTextMapper.Map(document.TextHead),
                TextPaymentTermsId = (Guid)document.TextPaymentTermsId,
                TextPaymentTerms   = _fagTextMapper.Map(document.TextPaymentTerms),
                TextDeliveryId     = (Guid)document.TextDeliveryId,
                TextDelivery       = _fagTextMapper.Map(document.TextDelivery),
                TextEndId          = (Guid)document.TextEndId,
                TextEnd            = _fagTextMapper.Map(document.TextEnd),

                DocumentPersonId  = (Guid)document.DocumentPersonId,
                DocumentPerson    = _personMapper.Map(document.DocumentPerson),
                DocumentCompanyId = (Guid)document.DocumentCompanyId,
                DocumentCompany   = _addressMapper.Map(document.DocumentCompany),
                DeliveryPersonId  = (Guid)document.DeliveryPersonId,
                DeliveryPerson    = _personMapper.Map(document.DeliveryPerson),
                DeliveryCompanyId = (Guid)document.DeliveryCompanyId,
                DeliveryCompany   = _addressMapper.Map(document.DeliveryCompany),
                InvoicePersonId   = (Guid)document.InvoicePersonId,
                InvoicePerson     = _personMapper.Map(document.InvoicePerson),
                InvoiceCompanyId  = (Guid)document.InvoiceCompanyId,
                InvoiceCompany    = _addressMapper.Map(document.InvoiceCompany),
            };

            return(response);
        }