示例#1
0
        private void GuitarTypeSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                dataGridInventory.ItemsSource = null;
                var guitar = (Guitar) cboBoxGuitarTypes.SelectedItem;
                var guitarType = new Guid(guitar.Id.ToString());

                var nhi = new NHibernateInventory();
                var guitarTypes = (List<Inventory>) nhi.ExecuteICriteria(guitarType);
                dataGridInventory.ItemsSource = guitarTypes;

                if (guitarTypes != null)
                {
                    dataGridInventory.Columns[0].Visibility = Visibility.Hidden;
                    dataGridInventory.Columns[1].Visibility = Visibility.Hidden;

                }

                PopulateComboBox();
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void comboBoxGuitarTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                dataGridInventory.ItemsSource = null;
                var guitar = (Guitar) comboBoxGuitarTypes.SelectedItem;
                var guitarType = new Guid(guitar.Id.ToString());

                var nhi = new NHibernateInventory();
                var list = (List<Inventory>) nhi.ExecuteICriteria(guitarType);
                dataGridInventory.ItemsSource = list;

                if (list != null)
                    HideColumnsWhichContainTechnicalInformation();
            }
            catch (Exception ex)
            {
                labelMessage.Content = ex.Message;
            }
        }