private SalesmanSupplierDTO Map(tblSalesmanSupplier tbl) { var dto = new SalesmanSupplierDTO { MasterId = tbl.id, DateCreated = tbl.IM_DateCreated, DateLastUpdated = tbl.IM_DateLastUpdated, StatusId = tbl.IM_Status, DistributorSalesmanMasterId = tbl.CostCentreId, SupplierMasterId = tbl.SupplierId }; return dto; }
private async void Save() { if (SelectedSalesman == null) { MessageBox.Show("A Salesman has to be selected first", "Salesman Supplier", MessageBoxButton.OK); } else { using (var c = NestedContainer) { var assignedSupplier = SalemanSupplierItems.ToList(); var assignedlist = new List<SalesmanSupplierDTO>(); foreach (var item in assignedSupplier) { var assignedDto = new SalesmanSupplierDTO(); assignedDto.DistributorSalesmanMasterId = SelectedSalesman.Id; assignedDto.Assigned = item.IsAssigned; assignedDto.SupplierMasterId = item.Supplier.Id; assignedlist.Add(assignedDto); } var response = await Using<IDistributorServiceProxy>(c).SalesmanSupplierSaveAsync(assignedlist); if (response.Success) { MessageBox.Show("SalesmanSupplier Successfully Added", "Distribtr: SalesmanSupplier ", MessageBoxButton.OK, MessageBoxImage.Information); // SendNavigationRequestMessage(new Uri("/Views/Admin/FarmActivities/Infections/ListInfection.xaml", UriKind.Relative)); } else { MessageBox.Show(response.ErrorInfo, "Distribtr: Error ", MessageBoxButton.OK, MessageBoxImage.Information); } } } ClearViewModel(); }
public SalesmanSupplier Map(SalesmanSupplierDTO dto) { if (dto == null) return null; var salesmanSupplier = Mapper.Map<SalesmanSupplierDTO, SalesmanSupplier>(dto); salesmanSupplier.Supplier = _supplierRepository.GetById(dto.SupplierMasterId); return salesmanSupplier; }