public GarmentLeftoverWarehouseExpenditureAccessories MapToModel(GarmentLeftoverWarehouseExpenditureAccessoriesViewModel viewModel)
        {
            GarmentLeftoverWarehouseExpenditureAccessories model = new GarmentLeftoverWarehouseExpenditureAccessories();

            PropertyCopier <GarmentLeftoverWarehouseExpenditureAccessoriesViewModel, GarmentLeftoverWarehouseExpenditureAccessories> .Copy(viewModel, model);

            if (viewModel.UnitExpenditure != null)
            {
                model.UnitExpenditureId   = long.Parse(viewModel.UnitExpenditure.Id);
                model.UnitExpenditureCode = viewModel.UnitExpenditure.Code;
                model.UnitExpenditureName = viewModel.UnitExpenditure.Name;
            }

            if (viewModel.Buyer != null)
            {
                model.BuyerId   = viewModel.Buyer.Id;
                model.BuyerCode = viewModel.Buyer.Code;
                model.BuyerName = viewModel.Buyer.Name;
            }

            model.Items = new List <GarmentLeftoverWarehouseExpenditureAccessoriesItem>();
            foreach (var viewModelItem in viewModel.Items)
            {
                GarmentLeftoverWarehouseExpenditureAccessoriesItem modelItem = new GarmentLeftoverWarehouseExpenditureAccessoriesItem();
                PropertyCopier <GarmentLeftoverWarehouseExpenditureAccessoriesItemViewModel, GarmentLeftoverWarehouseExpenditureAccessoriesItem> .Copy(viewModelItem, modelItem);

                if (viewModelItem.Unit != null)
                {
                    modelItem.UnitId   = long.Parse(viewModelItem.Unit.Id);
                    modelItem.UnitCode = viewModelItem.Unit.Code;
                    modelItem.UnitName = viewModelItem.Unit.Name;
                }

                if (viewModelItem.Uom != null)
                {
                    modelItem.UomId   = long.Parse(viewModelItem.Uom.Id);
                    modelItem.UomUnit = viewModelItem.Uom.Unit;
                }

                if (viewModelItem.Product != null)
                {
                    modelItem.ProductId   = long.Parse(viewModelItem.Product.Id);
                    modelItem.ProductCode = viewModelItem.Product.Code;
                    modelItem.ProductName = viewModelItem.Product.Name;
                }

                model.Items.Add(modelItem);
            }

            return(model);
        }
예제 #2
0
        public GarmentLeftoverWarehouseExpenditureAccessories CopyData(GarmentLeftoverWarehouseExpenditureAccessories oldData)
        {
            GarmentLeftoverWarehouseExpenditureAccessories newData = new GarmentLeftoverWarehouseExpenditureAccessories();

            PropertyCopier <GarmentLeftoverWarehouseExpenditureAccessories, GarmentLeftoverWarehouseExpenditureAccessories> .Copy(oldData, newData);

            newData.Items = new List <GarmentLeftoverWarehouseExpenditureAccessoriesItem>();
            foreach (var oldItem in oldData.Items)
            {
                GarmentLeftoverWarehouseExpenditureAccessoriesItem newItem = new GarmentLeftoverWarehouseExpenditureAccessoriesItem();

                PropertyCopier <GarmentLeftoverWarehouseExpenditureAccessoriesItem, GarmentLeftoverWarehouseExpenditureAccessoriesItem> .Copy(oldItem, newItem);

                newData.Items.Add(newItem);
            }

            return(newData);
        }
        private GarmentLeftoverWarehouseStock GenerateStock(GarmentLeftoverWarehouseExpenditureAccessoriesItem item)
        {
            GarmentLeftoverWarehouseStock stock = new GarmentLeftoverWarehouseStock
            {
                ReferenceType = GarmentLeftoverWarehouseStockReferenceTypeEnum.ACCESSORIES,
                UnitId        = item.UnitId,
                UnitCode      = item.UnitCode,
                UnitName      = item.UnitName,
                PONo          = item.PONo,
                UomId         = item.UomId,
                UomUnit       = item.UomUnit,
                Quantity      = item.Quantity,
                ProductCode   = item.ProductCode,
                ProductId     = item.ProductId,
                ProductName   = item.ProductName,
                BasicPrice    = item.BasicPrice
            };

            return(stock);
        }