Beispiel #1
0
        private void ColumnSelect_Click(object sender, RoutedEventArgs args)
        {
            //populate columns in conditions listbox
            FullQuery += "SELECT ";

            foreach (string s in ColumnsListBox.SelectedItems)
            {
                SelectedColumns.Add(s);
                FullQuery += s + ", ";
            }

            //trim last comma
            FullQuery = FullQuery.Substring(0, (FullQuery.Length - 2));

            //add view
            FullQuery        += " FROM " + View;
            FullQueryBox.Text = FullQuery;

            #region ResetToggles
            ConditionsListBox.ClearValue(ItemsControl.ItemsSourceProperty);
            ConditionsListBox.ItemsSource = SelectedColumns;
            ColumnButton.IsEnabled        = false;
            BackToCol.IsEnabled           = true;
            BackToView.IsEnabled          = false;
            ExecuteQuery.IsEnabled        = true;
            #endregion
        }
Beispiel #2
0
        private void ApplyConditionButton_Click(object sender, RoutedEventArgs e)
        {
            if (!InputBox.IsEnabled && InputBox.Text == "[DATE CRITERIA]")
            {
                //date criteria entered, pull from class
                string clause = DateCriteriaData.ConstructClause();
                if (InitialCondition == false)
                {
                    WhereClause += " AND ";
                }
                else
                {
                    WhereClause += " WHERE ";
                }

                WhereClause       += clause;
                InputBox.IsEnabled = true;
            }
            else
            {
                string Comparator = ComparatorBox.Text;
                string Criteria   = InputBox.Text;
                string Condition  = (string)ConditionsListBox.SelectedItem;

                if (Comparator == "" || Criteria == "" || Condition == null)
                {
                    MessageBox.Show("Please enter a comparator and criteria, and also a column.");
                }
                else
                {
                    if (InitialCondition == false)
                    {
                        WhereClause += " AND ";
                    }
                    else
                    {
                        WhereClause += " WHERE ";
                    }

                    WhereClause += Condition + " " + Comparator + " " + Criteria;
                }
            }

            FullQueryBox.Text = (FullQuery += WhereClause);
            InitialCondition  = false;

            #region ResetToggles
            ComparatorBox.Text = "";
            ConditionsListBox.UnselectAll();
            InputBox.Text = "";
            WhereClause   = "";
            #endregion
        }
Beispiel #3
0
 private void BackToCol_Click(object sender, RoutedEventArgs e)
 {
     #region ResetToggles
     ConditionsListBox.ClearValue(ItemsControl.ItemsSourceProperty);
     SelectedColumns.Clear();
     ConditionsListBox.ItemsSource = SelectedColumns;
     ColumnButton.IsEnabled        = true;
     BackToView.IsEnabled          = true;
     BackToCol.IsEnabled           = false;
     FullQuery              = "";
     FullQueryBox.Text      = FullQuery;
     WhereClause            = "";
     InitialCondition       = true;
     ExecuteQuery.IsEnabled = false;
     #endregion
 }