Exemple #1
0
        internal static void LoadPromptDataGridView(DataGridView gridView, Table table)
        {
            BindingList <PromptRow> ptList = PromptRow.GetRowsFromTable(table);

            if (gridView.Columns.Count == 0)
            {
                gridView.AutoGenerateColumns = false;
                AddButtonColumn(gridView, Strings.IndentColumnName, Strings.IndentButtonName);
                AddTextBoxColumn(gridView, PromptTypeRow.ConditionColumnName);
                AddButtonColumn(gridView, Strings.OutdentColumnName, Strings.OutdentButtonName);
                AddTextBoxColumn(gridView, PromptTypeRow.WordingColumnName);
                AddTextBoxColumn(gridView, PromptTypeRow.IdColumnName);
                AddTextBoxColumn(gridView, PromptTypeRow.TypeDateStampColumnName);
                AddTextBoxColumn(gridView, PromptTypeRow.ConditionDateStampColumnName);
                AddTextBoxColumn(gridView, PromptTypeRow.WordingDateStampColumnName);
                AddTextBoxColumn(gridView, PromptTypeRow.IdDateStampColumnName);

                gridView.CellValueChanged -= new DataGridViewCellEventHandler(OnPromptCellValueChangedForAutoPromptId);
                gridView.CellValueChanged += new DataGridViewCellEventHandler(OnPromptCellValueChangedForAutoPromptId);

                ApplyCommonDataGridViewSettings <PromptRow>(gridView, true);
            }

            HideDateStampColumns(gridView);
            gridView.DataSource = ptList;
        }
 public static BindingList<PromptRow> GetRowsFromTable(Table table)
 {
     BindingList<PromptRow> list = new BindingList<PromptRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         PromptRow pt = new PromptRow();
         pt.Condition = table.GetData(row, (int)TableColumns.Prompts.Condition);
         pt.Wording = table.GetData(row, (int)TableColumns.Prompts.Wording);
         pt.Id = table.GetData(row, (int)TableColumns.Prompts.Id);
         pt.ConditionDateStamp = table.GetData(row, (int)TableColumns.Prompts.ConditionDateStamp);
         pt.WordingDateStamp = table.GetData(row, (int)TableColumns.Prompts.WordingDateStamp);
         pt.IdDateStamp = table.GetData(row, (int)TableColumns.Prompts.IdDateStamp);
         list.Add(pt);
     }
     return list;
 }
Exemple #3
0
        public static BindingList <PromptRow> GetRowsFromTable(Table table)
        {
            BindingList <PromptRow> list = new BindingList <PromptRow>();

            for (int row = 0; row < table.GetNumRows(); row++)
            {
                PromptRow pt = new PromptRow();
                pt.Condition          = table.GetData(row, (int)TableColumns.Prompts.Condition);
                pt.Wording            = table.GetData(row, (int)TableColumns.Prompts.Wording);
                pt.Id                 = table.GetData(row, (int)TableColumns.Prompts.Id);
                pt.ConditionDateStamp = table.GetData(row, (int)TableColumns.Prompts.ConditionDateStamp);
                pt.WordingDateStamp   = table.GetData(row, (int)TableColumns.Prompts.WordingDateStamp);
                pt.IdDateStamp        = table.GetData(row, (int)TableColumns.Prompts.IdDateStamp);
                list.Add(pt);
            }
            return(list);
        }
Exemple #4
0
        internal static Table UnloadPromptDataGridView(DataGridView gridView)
        {
            BindingList <PromptRow> list = gridView.DataSource as BindingList <PromptRow>;

            return(PromptRow.GetTableFromRows(list));
        }