private void EditWorkOrderItem_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; if (b != null) { WorkOrderViewModel vm = (WorkOrderViewModel)b.CommandParameter; if (vm != null) { if (arrangementList.Where(a => a.Arrangement.ArrangementId == vm.GroupId).Any()) { AddArrangementRequest aar = arrangementList.Where(a => a.Arrangement.ArrangementId == vm.GroupId).First(); MainWindow wnd = Application.Current.MainWindow as MainWindow; ArrangementPage arrangementPage = new ArrangementPage(aar); wnd.NavigationStack.Push(arrangementPage); wnd.MainContent.Content = new Frame() { Content = arrangementPage }; } } } }
private void ProductType_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox) { KeyValuePair <long, string> kvp = (KeyValuePair <long, string>)((ComboBox)sender).SelectedItem; if (kvp.Key == 3) //arrangement { //load arrangementPage MainWindow wnd = Application.Current.MainWindow as MainWindow; ArrangementPage arrangementPage = new ArrangementPage(new AddArrangementRequest()); wnd.NavigationStack.Push(arrangementPage); wnd.MainContent.Content = new Frame() { Content = arrangementPage }; } else { MainWindow wnd = Application.Current.MainWindow as MainWindow; List <InventoryDTO> inventoryList = wnd.GetInventoryByType(kvp.Key); ObservableCollection <InventoryDTO> list1 = new ObservableCollection <InventoryDTO>(); foreach (InventoryDTO i in inventoryList) { list1.Add(i); } InventoryFilterListView.ItemsSource = list1; } } }
private void InventoryTypeCombo_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { //get types for the current inventory type selection ComboBox cb = sender as ComboBox; KeyValuePair <long, string> kvp = (KeyValuePair <long, string>)cb.SelectedItem; ObservableCollection <KeyValuePair <long, string> > list1 = new ObservableCollection <KeyValuePair <long, string> >(); switch (kvp.Value) { case "Arrangements": MainWindow wnd = Application.Current.MainWindow as MainWindow; ArrangementPage arrangementPage = new ArrangementPage(new AddArrangementRequest()); wnd.NavigationStack.Push(arrangementPage); wnd.MainContent.Content = new Frame() { Content = arrangementPage }; this.Close(); break; case "Orchids": if (plantTypes.Count == 0) { plantTypes = mainWnd.GetPlantTypes(); } foreach (PlantTypeDTO plantType in plantTypes) { list1.Add(new KeyValuePair <long, string>(plantType.PlantTypeId, plantType.PlantTypeName)); } break; case "Foliage": if (foliageTypes.Count == 0) { foliageTypes = mainWnd.GetFoliageTypes(); } foreach (FoliageTypeDTO foliageType in foliageTypes) { list1.Add(new KeyValuePair <long, string>(foliageType.FoliageTypeId, foliageType.FoliageTypeName)); } break; case "Materials": if (materialTypes.Count == 0) { materialTypes = mainWnd.GetMaterialTypes(); } foreach (MaterialTypeDTO materialType in materialTypes) { list1.Add(new KeyValuePair <long, string>(materialType.MaterialTypeId, materialType.MaterialTypeName)); } break; case "Containers": if (containerTypes.Count == 0) { containerTypes = mainWnd.GetContainerTypes(); } foreach (ContainerTypeDTO container in containerTypes) { list1.Add(new KeyValuePair <long, string>(container.ContainerTypeId, container.ContainerTypeName)); } break; } TypeCombo.ItemsSource = list1; List <string> sizes = mainWnd.GetSizeByInventoryType(kvp.Key); ObservableCollection <string> list2 = new ObservableCollection <string>(); foreach (string s in sizes) { list2.Add(s); } SizeCombo.ItemsSource = list2; }