public override DataSqlGeneratorColumnSet GetColumnSet()
        {
            var res = new DataSqlGeneratorColumnSet();

            if (rbtAllColumns.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.AllColumns;
            }
            if (rbtChooseColumns.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.ExplicitColumns;
                res.Columns.AddRange(m_columns);
            }
            if (rbtNoKeyColumns.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.NoPkCols;
            }
            if (rbtPrimaryKey.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.PrimaryKey;
            }
            if (rbtSelectedColumns.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.SelectedColumns;
            }
            if (rbtNoSelectedColumns.Checked)
            {
                res.Mode = DataSqlGeneratorColumnSet.ModeEnum.NoSelectedColumns;
            }
            return(res);
        }
Beispiel #2
0
        protected static string[] GetColumns(DataSqlGeneratorColumnSet colset, ITableStructure ts, string[] selcolumns)
        {
            switch (colset.Mode)
            {
            case DataSqlGeneratorColumnSet.ModeEnum.AllColumns:
                return(ts.Columns.GetNames());

            case DataSqlGeneratorColumnSet.ModeEnum.ExplicitColumns:
                return(colset.Columns.ToArray());

            case DataSqlGeneratorColumnSet.ModeEnum.NoPkCols:
                return(ts.GetNoPkColumnNames());

            case DataSqlGeneratorColumnSet.ModeEnum.PrimaryKey:
                return(ts.GetPkColumnNames());

            case DataSqlGeneratorColumnSet.ModeEnum.SelectedColumns:
                return(selcolumns);

            case DataSqlGeneratorColumnSet.ModeEnum.NoSelectedColumns:
            {
                var res = new List <string>();
                foreach (string col in ts.Columns.GetNames())
                {
                    if (Array.IndexOf(selcolumns, col) <= 0)
                    {
                        res.Add(col);
                    }
                }
                return(res.ToArray());
            }
            }
            return(null);
        }
        public override DataSqlGeneratorColumnSet GetColumnSet()
        {
            var res = new DataSqlGeneratorColumnSet();

            res.Mode = DataSqlGeneratorColumnSet.ModeEnum.ExplicitColumns;
            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                bool value = checkedListBox1.GetItemChecked(i);
                if (m_currentCheck != null && i == m_currentCheck.Index)
                {
                    value = m_currentCheck.NewValue == CheckState.Checked;
                }
                if (value)
                {
                    res.Columns.Add(checkedListBox1.Items[i].ToString());
                }
            }
            return(res);
        }