Пример #1
0
        public async Task Update(int id, MaterialDeliveryNoteWeavingViewModel viewModel)
        {
            var model = new Data.MaterialDeliveryNoteWeavingModel(viewModel.Code, viewModel.DateSJ.GetValueOrDefault(), viewModel.selectedDO.Id.GetValueOrDefault(), viewModel.selectedDO.DOSalesNo, viewModel.SendTo, viewModel.Unit.Id.GetValueOrDefault(), viewModel.Unit.Name,
                                                                  viewModel.Buyer.Id.GetValueOrDefault(), viewModel.Buyer.Code, viewModel.Buyer.Name, viewModel.NumberBonOut, viewModel.Storage.Id, viewModel.Storage.Code, viewModel.Storage.Name,
                                                                  viewModel.Remark,
                                                                  viewModel.ItemsMaterialDeliveryNoteWeaving.Select(s => new ItemsMaterialDeliveryNoteWeavingModel(s.itemNoSOP, s.itemMaterialName, s.itemGrade, s.itemType, s.itemCode, s.inputBale.GetValueOrDefault(), s.inputPiece.GetValueOrDefault(), s.inputMeter.GetValueOrDefault(), s.inputKg.GetValueOrDefault())).ToList());

            await _MaterialDeliveryNoteWeavingRepository.UpdateAsync(id, model);
        }
Пример #2
0
        private MaterialDeliveryNoteWeavingViewModel MapToViewModel(Data.MaterialDeliveryNoteWeavingModel model)
        {
            var vm = new MaterialDeliveryNoteWeavingViewModel()
            {
                Id         = model.Id,
                Code       = model.Code,
                DateSJ     = model.DateSJ,
                selectedDO = new DeliveryOrderMaterialDeliveryNoteWeaving()
                {
                    Id        = model.DoSalesNumberId,
                    DOSalesNo = model.DoSalesNumber
                },
                SendTo = model.SendTo,
                Unit   = new UnitMaterialDeliveryNoteWeaving()
                {
                    Id   = model.UnitId,
                    Name = model.UnitName
                },
                Buyer = new BuyerMaterialDeliveryNoteWeaving()
                {
                    Id   = model.BuyerId,
                    Code = model.BuyerCode,
                    Name = model.BuyerName
                },
                NumberBonOut = model.NumberOut,
                Storage      = new StorageMaterialDeliveryNoteWeaving()
                {
                    Id   = model.StorageId,
                    Code = model.StorageCode,
                    Name = model.StorageName
                },
                Remark = model.Remark,
                ItemsMaterialDeliveryNoteWeaving = model.ItemsMaterialDeliveryNoteWeaving.Select(d => new ItemsMaterialDeliveryNoteWeavingViewModel()
                {
                    itemNoSOP        = d.ItemNoSOP,
                    itemMaterialName = d.ItemMaterialName,
                    itemGrade        = d.ItemGrade,
                    itemType         = d.ItemType,
                    itemCode         = d.ItemCode,
                    inputBale        = d.InputBale,
                    inputPiece       = d.InputPiece,
                    inputMeter       = d.InputMeter,
                    inputKg          = d.InputKg
                }).ToList()
            };

            return(vm);
        }
Пример #3
0
        public async Task Create(MaterialDeliveryNoteWeavingViewModel viewModel)
        {
            var model = new Data.MaterialDeliveryNoteWeavingModel(null, viewModel.DateSJ.GetValueOrDefault(), viewModel.selectedDO.Id.GetValueOrDefault(), viewModel.selectedDO.DOSalesNo, viewModel.SendTo, viewModel.Unit.Id.GetValueOrDefault(), viewModel.Unit.Name,
                                                                  viewModel.Buyer.Id.GetValueOrDefault(), viewModel.Buyer.Code, viewModel.Buyer.Name, viewModel.NumberBonOut, viewModel.Storage.Id, viewModel.Storage.Code, viewModel.Storage.Name,
                                                                  viewModel.Remark,
                                                                  viewModel.ItemsMaterialDeliveryNoteWeaving.Select(s => new ItemsMaterialDeliveryNoteWeavingModel(s.itemNoSOP, s.itemMaterialName, s.itemGrade, s.itemType, s.itemCode, s.inputBale.GetValueOrDefault(), s.inputPiece.GetValueOrDefault(), s.inputMeter.GetValueOrDefault(), s.inputKg.GetValueOrDefault())).ToList());

            foreach (var itm in viewModel.ItemsMaterialDeliveryNoteWeaving)
            {
                var modelItem = new ItemsMaterialDeliveryNoteWeavingModel(itm.itemNoSOP, itm.itemMaterialName, itm.itemGrade, itm.itemType, itm.itemCode, itm.inputBale.GetValueOrDefault(), itm.inputPiece.GetValueOrDefault(), itm.inputMeter.GetValueOrDefault(), itm.inputKg.GetValueOrDefault());

                await _ItemsMaterialDeliveryNoteWeavingRepository.InsertAsync(modelItem);
            }

            await _MaterialDeliveryNoteWeavingRepository.InsertAsync(model);
        }