Beispiel #1
0
        public async Task <GetProductSpecificPriceForEditOutput> GetProductSpecificPriceForEdit(NullableIdInput <long> input)
        {
            ProductSpecificPriceEditDto productSpecificPriceEditDto;

            if (!input.Id.HasValue)
            {
                productSpecificPriceEditDto = new ProductSpecificPriceEditDto();
            }
            else
            {
                IRepository <ProductSpecificPrice, long> repository = this._specificPriceRepository;
                ProductSpecificPrice async = await repository.GetAsync(input.Id.Value);

                productSpecificPriceEditDto = async.MapTo <ProductSpecificPriceEditDto>();
            }
            return(new GetProductSpecificPriceForEditOutput()
            {
                SpecificPrice = productSpecificPriceEditDto
            });
        }
Beispiel #2
0
        public async Task <long> CreateOrUpdateProductSpecificPrice(CreateOrUpdateProductSpecificPriceInput input)
        {
            long     num;
            long     num1;
            DateTime?nullable;
            DateTime?nullable1;
            decimal? nullable2;
            bool?    nullable3;
            int?     nullable4;
            long?    nullable5;
            long?    nullable6;
            long?    nullable7;
            int?     nullable8;
            long     value = (long)0;
            long?    id    = input.SpecificPrice.Id;

            if (id.HasValue)
            {
                id = input.SpecificPrice.Id;
                if (id.Value <= (long)0)
                {
                    num1 = await this._specificPriceRepository.InsertAndGetIdAsync(input.SpecificPrice.MapTo <ProductSpecificPrice>());

                    value = num1;
                    num   = value;
                    return(num);
                }
                IRepository <ProductSpecificPrice, long> repository = this._specificPriceRepository;
                id = input.SpecificPrice.Id;
                ProductSpecificPrice async = await repository.GetAsync(id.Value);

                async.Cost = input.SpecificPrice.Cost;
                ProductSpecificPrice productSpecificPrice = async;
                DateTime?            availableFrom        = input.SpecificPrice.AvailableFrom;
                if (availableFrom.HasValue)
                {
                    availableFrom = input.SpecificPrice.AvailableFrom;
                    nullable      = new DateTime?(availableFrom.Value);
                }
                else
                {
                    availableFrom = null;
                    nullable      = availableFrom;
                }
                productSpecificPrice.AvailableFrom = nullable;
                ProductSpecificPrice productSpecificPrice1 = async;
                availableFrom = input.SpecificPrice.AvailableTo;
                if (availableFrom.HasValue)
                {
                    availableFrom = input.SpecificPrice.AvailableTo;
                    nullable1     = new DateTime?(availableFrom.Value);
                }
                else
                {
                    availableFrom = null;
                    nullable1     = availableFrom;
                }
                productSpecificPrice1.AvailableTo = nullable1;
                async.BaseCost         = input.SpecificPrice.BaseCost;
                async.Cost             = input.SpecificPrice.Cost;
                async.BaseCostOverride = input.SpecificPrice.BaseCostOverride;
                ProductSpecificPrice productSpecificPrice2 = async;
                decimal?discount = input.SpecificPrice.Discount;
                if (discount.HasValue)
                {
                    discount  = input.SpecificPrice.Discount;
                    nullable2 = new decimal?(discount.Value);
                }
                else
                {
                    discount  = null;
                    nullable2 = discount;
                }
                productSpecificPrice2.Discount = nullable2;
                ProductSpecificPrice productSpecificPrice3 = async;
                bool?discountIncludeTax = input.SpecificPrice.DiscountIncludeTax;
                if (discountIncludeTax.HasValue)
                {
                    discountIncludeTax = input.SpecificPrice.DiscountIncludeTax;
                    nullable3          = new bool?(discountIncludeTax.Value);
                }
                else
                {
                    discountIncludeTax = null;
                    nullable3          = discountIncludeTax;
                }
                productSpecificPrice3.DiscountIncludeTax = nullable3;
                ProductSpecificPrice productSpecificPrice4 = async;
                int?forCountryId = input.SpecificPrice.ForCountryId;
                if (forCountryId.HasValue)
                {
                    forCountryId = input.SpecificPrice.ForCountryId;
                    nullable4    = new int?(forCountryId.Value);
                }
                else
                {
                    forCountryId = null;
                    nullable4    = forCountryId;
                }
                productSpecificPrice4.ForCountryId = nullable4;
                async.ForCurrency = "Dollar";
                ProductSpecificPrice productSpecificPrice5 = async;
                id = input.SpecificPrice.ForCustomerId;
                if (id.HasValue)
                {
                    id        = input.SpecificPrice.ForCustomerId;
                    nullable5 = new long?(id.Value);
                }
                else
                {
                    id        = null;
                    nullable5 = id;
                }
                productSpecificPrice5.ForCustomerId = nullable5;
                ProductSpecificPrice productSpecificPrice6 = async;
                id = input.SpecificPrice.ForOrganizationalUnitId;
                if (id.HasValue)
                {
                    id        = input.SpecificPrice.ForOrganizationalUnitId;
                    nullable6 = new long?(id.Value);
                }
                else
                {
                    id        = null;
                    nullable6 = id;
                }
                productSpecificPrice6.ForOrganizationalUnitId = nullable6;
                ProductSpecificPrice productSpecificPrice7 = async;
                id = input.SpecificPrice.ProductOptionId;
                if (id.HasValue)
                {
                    id        = input.SpecificPrice.ProductOptionId;
                    nullable7 = new long?(id.Value);
                }
                else
                {
                    id        = null;
                    nullable7 = id;
                }
                productSpecificPrice7.ProductOptionId = nullable7;
                ProductSpecificPrice productSpecificPrice8 = async;
                forCountryId = input.SpecificPrice.StartingAtQuantity;
                if (forCountryId.HasValue)
                {
                    forCountryId = input.SpecificPrice.StartingAtQuantity;
                    nullable8    = new int?(forCountryId.Value);
                }
                else
                {
                    forCountryId = null;
                    nullable8    = forCountryId;
                }
                productSpecificPrice8.StartingAtQuantity = nullable8;
                async.IsActive = input.SpecificPrice.IsActive;
                id             = input.SpecificPrice.Id;
                value          = id.Value;
                await this._specificPriceRepository.UpdateAsync(async);

                num = value;
                return(num);
            }
            num1 = await this._specificPriceRepository.InsertAndGetIdAsync(input.SpecificPrice.MapTo <ProductSpecificPrice>());

            value = num1;
            num   = value;
            return(num);
        }