示例#1
0
        public OrderDetailsWindow()
        {
            InitializeComponent();

            Closing += (s, e) =>
            {
                MessageBoxResult result = MessageBox.Show("Are you sure you want to close this window?", "WARNING!", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                if (result == MessageBoxResult.Cancel)
                {
                    e.Cancel = true;
                }
            };

            Loaded += (s, e) =>
            {
                var setCodes = (from code in App.root.Data select code.Code).ToList();

                SetCodeBox.ItemsSource = setCodes;

                OrderItemGrid.ItemsSource = orderItems;
                OrderItemGrid.Columns.RemoveAt(0);

                QualityCombo.ItemsSource = new List <string>()
                {
                    "NM", "SP", "PLD", "HP"
                };
            };

            SetCodeBox.SelectionChanged += (s, e) => { SetNameBox.Clear(); };
            SetNameBox.TextChanged      += (s, e) => { SetCodeBox.SelectedIndex = -1; };
        }
示例#2
0
        //private static SetList root = new SetList();

        public StocksWindow()
        {
            InitializeComponent();

            Loaded += (s, e) =>
            {
                try
                {
                    var setCodes = (from code in App.root.Data select code.Code).ToList();

                    SetBox.ItemsSource = setCodes;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            };

            SetBox.SelectionChanged += (s, ev) => { SetNameBox.Clear(); };

            SetNameBox.TextChanged += (s, ex) => { SetBox.SelectedIndex = -1; };

            NameSearchBox.TextChanged += (s, eh) =>
            {
                SetBox.SelectedIndex = -1;
                SetNameBox.Clear();
            };
        }
示例#3
0
        private void SearchSetsButton_Click(object sender, RoutedEventArgs e)
        {
            //SearchNameButton.IsEnabled = false;
            InvGrid.ItemsSource = null;

            DataTable     dt = new DataTable();
            SqlConnection sConn;
            string        comm;

            if (SetBox.SelectedIndex.Equals(-1) && string.IsNullOrWhiteSpace(SetNameBox.Text))
            {
                MessageBox.Show("No search parameter selected", "WARNING", MessageBoxButton.OK);
                return;
            }
            else if (SetBox.SelectedIndex > -1)
            {
                comm  = "Select * from dbo.Inventory where SetCode = '" + SetBox.SelectedItem.ToString().ToUpper() + "'";
                sConn = new SqlConnection(App.connstring);
                SqlCommand sComm = new SqlCommand(comm, sConn);
                sConn.Open();
                using (SqlDataAdapter da = new SqlDataAdapter(sComm))
                {
                    da.Fill(dt);
                    dt.Columns.Remove("InventoryId");
                    InvGrid.ItemsSource = dt.AsDataView();
                }
                sConn.Close();
                sConn.Dispose();
            }
            else if (!string.IsNullOrWhiteSpace(SetNameBox.Text))
            {
                comm  = "Select * from dbo.Inventory where SetName like '%" + SetNameBox.Text + "%'";
                sConn = new SqlConnection(App.connstring);
                SqlCommand sComm = new SqlCommand(comm, sConn);
                sConn.Open();
                using (SqlDataAdapter da = new SqlDataAdapter(sComm))
                {
                    da.Fill(dt);
                    dt.Columns.Remove("InventoryId");
                    InvGrid.ItemsSource = dt.AsDataView();
                }
                sConn.Close();
                sConn.Dispose();
            }

            SetBox.SelectedIndex = -1;
            SetNameBox.Clear();
            NameSearchBox.Clear();
            //SearchNameButton.IsEnabled = true;
        }