private void LoadData(Obj SelecterObj_) { switch (SelecterObj_) { case Obj.Worker: ObservableCollection <WorkerDG> workerDGs = new ObservableCollection <WorkerDG>(); foreach (var item in BLL_.GetAllWorkers()) { workerDGs.Add(WorkerDG.Convert(item)); } DG.ItemsSource = workerDGs; break; case Obj.Product: ObservableCollection <ProductDG> productDGs = new ObservableCollection <ProductDG>(); foreach (var item in BLL_.GetAllProducts()) { productDGs.Add(ProductDG.Convert(item)); } DG.ItemsSource = productDGs; break; case Obj.Director: ObservableCollection <DirectorDG> directorDGs = new ObservableCollection <DirectorDG>(); foreach (var item in BLL_.GetAllDirectors()) { directorDGs.Add(DirectorDG.Convert(item)); } DG.ItemsSource = directorDGs; break; case Obj.Shop: ObservableCollection <ShopDG> shopDGs = new ObservableCollection <ShopDG>(); foreach (var item in BLL_.GetAllShops()) { shopDGs.Add(ShopDG.Convert(item)); } DG.ItemsSource = shopDGs; break; case Obj.NONE: MessageBox.Show("NoNe"); return; default: break; } }
public static WorkersDTO ConvertToDTO(WorkerDG workersDTO) { return(new WorkersDTO(workersDTO.Id, workersDTO.Name, workersDTO.Surname, workersDTO.Phone, workersDTO.ShopId, workersDTO.WorkerTypeId)); }