Ejemplo n.º 1
0
        static List <string> GetItems(SCBVariable variable)
        {
            List <string> items = new List <string>();

            bool ok      = false;
            int  itemCnt = 0;

            while (!ok)
            {
                Console.Out.Write($"Item {++itemCnt} = ");
                string ans = Console.In.ReadLine();


                if (ans.ToLower().Equals("q"))
                {
                    break;
                }

                if (variable.values.Contains(ans))
                {
                    items.Add(ans);
                }
                else
                {
                    Console.Out.WriteLine("Not a valid value. Please try again or Quit!");
                }
            }
            return(items);
        }
Ejemplo n.º 2
0
        private void UpdateMetadata()
        {
            if (_currentMetaData != null)
            {
                labelTitle.Text = _currentMetaData.title;

                listBoxVariables.Items.Clear();
                listBoxVariables.Text = "Variables";
                foreach (SCBVariable metaVariable in _currentMetaData.variables)
                {
                    listBoxVariables.Items.Add(metaVariable);
                }

                // default query
                _currentQuery = new SCBQuery();
                _currentQuery.SetUp(_currentMetaData.variables);

                listBoxVariables.SelectedIndex = 0;
                SCBVariable var = listBoxVariables.SelectedItem as SCBVariable;
                if (var != null)
                {
                    UpdateSelectedItems(var);
                }
            }
        }
Ejemplo n.º 3
0
 private void UpdateSelectedItems(SCBVariable var)
 {
     checkedListBoxItems.Items.Clear();
     foreach (SCBValue varValue in var.Values)
     {
         checkedListBoxItems.Items.Add(varValue, varValue.IsSelected);
     }
 }
Ejemplo n.º 4
0
        private void UpdateGridView()
        {
            dataGridViewTable.Columns.Clear();
            foreach (SCBColumn tableColumn in _currentTable.columns)
            {
                dataGridViewTable.Columns.Add(tableColumn.code, tableColumn.text);
            }

            int nRows = _currentTable.data.Count;

            dataGridViewTable.Rows.Add(nRows);
            int row = 0;

            foreach (SCBTableEntry tableEntry in _currentTable.data)
            {
                int col = 0;
                // NB variables need not appear in same order as keys/values!
                foreach (string s in tableEntry.key)
                {
                    string text = s;

                    SCBVariable var   = _currentMetaData._keyToVariable[_currentTable.columns[col].text];
                    int         index = var.values.IndexOf(s);
                    text = var.valueTexts[index];

                    dataGridViewTable.Rows[row].Cells[col].Value = text;
                    ++col;
                }
                foreach (string s in tableEntry.values)
                {
                    dataGridViewTable.Rows[row].Cells[col].Value = s;
                    ++col;
                }

                row++;
            }
        }
Ejemplo n.º 5
0
 public SCBQueryItem(SCBVariable variable)
 {
     Var       = variable;
     code      = variable.code;
     selection = new SCBSelection(variable);
 }