예제 #1
0
            public void setDisabledColandRows(DataGridView dgv, DataTable dt)
            {
                //reset the column disabled properties
                foreach (DataColumn c in dt.Columns)
                {
                    bool hasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (hasattribute)
                    {
                        int selectedColIndex = dt.Columns.IndexOf(c);
                        if (c.ExtendedProperties[VBCommon.Globals.ENABLED].ToString() != "True")
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                            {
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                            }
                        }
                    }
                }

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool enabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!enabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                        {
                            dgv[c, r].Style.ForeColor = Color.Red;
                        }
                    }
                }
            }
예제 #2
0
 /// <summary>
 /// constructor optionally calls method to init the row information structure 
 /// and return the itself - singleton
 /// </summary>
 /// <param name="dt">table to gather info on</param>
 /// <param name="init">if true, initialize; for example, on import</param>
 /// <returns></returns>
 public static dtRowInformation getdtRI(DataTable dt, bool init)
 {
     //pass null after initialization to access the DTRowInfo property
     //or pass init=true (after import) to initialize
     if (dtRI == null || init) dtRI = new dtRowInformation(dt);
     return dtRI;
 }
예제 #3
0
 /// <summary>
 /// constructor optionally calls method to init the row information structure
 /// and return the itself - singleton
 /// </summary>
 /// <param name="dt">table to gather info on</param>
 /// <param name="init">if true, initialize; for example, on import</param>
 /// <returns></returns>
 public static dtRowInformation getdtRI(DataTable dt, bool init)
 {
     //pass null after initialization to access the DTRowInfo property
     //or pass init=true (after import) to initialize
     if (dtRI == null || init)
     {
         dtRI = new dtRowInformation(dt);
     }
     return(dtRI);
 }
예제 #4
0
            public void enableGridCol(DataGridView dgv, int selectedColIndex, DataTable dt)
            {
                dtRowInformation dtRI = dtRowInformation.getdtRI(dt, false);

                for (int r = 0; r < dgv.Rows.Count; r++)
                {
                    //set style to black unless the row is disabled
                    if (!dtRI.getRowStatus(dgv[0, r].Value.ToString()))
                    {
                        continue;
                    }
                    dgv[selectedColIndex, r].Style.ForeColor = Color.Black;
                }
            }
예제 #5
0
        /// <summary>
        /// Constructor takes the datagridview to show changes implemented in this class
        /// </summary>
        /// <param name="dgv">datasheet grid reference</param>
        /// <param name="dt">datasource for the grid</param>
        public frmMissingValues(DataGridView dgv, DataTable dt)
        {
            InitializeComponent();

            _tu = new Utilities.TableUtils(dt);
            _dtRI = dtRowInformation.getdtRI(_dt, false);
            _dtCI = dtColumnInformation.getdtCI(dt, false);

            //get a working copy of the dataset
            _dt = dt.Copy();
            _dgv = dgv;

            cboCols.DataSource = strArrDdlReplaceWith;
            btnReturn.Enabled = false;
        }
예제 #6
0
        /// <summary>
        /// Constructor takes the datagridview to show changes implemented in this class
        /// </summary>
        /// <param name="dgv">datasheet grid reference</param>
        /// <param name="dt">datasource for the grid</param>
        public frmMissingValues(DataGridView dgv, DataTable dt)
        {
            InitializeComponent();

            _tu   = new Utilities.TableUtils(dt);
            _dtRI = VBCommon.Metadata.dtRowInformation.getdtRI(_dt, false);
            _dtCI = VBCommon.Metadata.dtColumnInformation.getdtCI(dt, false);

            //get a working copy of the dataset
            _dt  = dt.Copy();
            _dgv = dgv;

            cboCols.DataSource = strArrDdlReplaceWith;
            btnReturn.Enabled  = false;
        }
예제 #7
0
 public TableUtils(DataTable dt)
 {
     _dt   = dt;
     _dtCI = dtColumnInformation.getdtCI(dt, false);
     _dtRI = dtRowInformation.getdtRI(dt, false);
 }
예제 #8
0
            public void maintainGrid(DataGridView dgv, DataTable dt, int selectedColIndex, string responseVarColName)
            {
                //reset the grid
                dgv.DataSource = null;
                dgv.DataSource = dt;

                //mark all grid cols visible, not sortable
                for (int c = 0; c < dgv.Columns.Count; c++)
                {
                    dgv.Columns[c].SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                //hide any main effect cols that have been transformed (hidden attribute is set in the transform class)
                foreach (DataColumn c in dt.Columns)
                {
                    bool hashidden = c.ExtendedProperties.ContainsKey(VBCommon.Globals.HIDDEN);
                    if (hashidden == true)
                    {
                        if (c.ExtendedProperties[VBCommon.Globals.HIDDEN].ToString() == "True")
                        {
                            dgv.Columns[c.ColumnName].Visible = false;
                        }
                    }

                    //reset the column disabled properties
                    bool hasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (hasattribute)
                    {
                        selectedColIndex = dt.Columns.IndexOf(c);
                        if (c.ExtendedProperties[VBCommon.Globals.ENABLED].ToString() != "True")
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                            {
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                            }
                        }
                        else
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                            {
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Black;
                            }
                        }
                    }
                }

                //reset the UI clues for the response variable
                dgv.Columns[responseVarColName].DefaultCellStyle.BackColor = Color.LightBlue;

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool enabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!enabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                        {
                            dgv[c, r].Style.ForeColor = Color.Red;
                        }
                    }
                }

                //set the numerical precision for display
                setViewOnGrid(dgv);
            }
예제 #9
0
파일: Utilities.cs 프로젝트: wrbrooks/VB3
            public void maintainGrid(DataGridView dgv, DataTable dt, int selectedColIndex, string responseVarColName)
            {
                //reset the grid
                dgv.DataSource = null;
                dgv.DataSource = dt;

                //mark all grid cols visible, not sortable
                for (int c = 0; c < dgv.Columns.Count; c++)
                {
                    dgv.Columns[c].SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                //hide any main effect cols that have been transformed (hidden attribute is set in the transform class)
                foreach (DataColumn c in dt.Columns)
                {
                    bool hashidden = c.ExtendedProperties.ContainsKey(VBCommon.Globals.HIDDEN);
                    if (hashidden == true)
                    {
                        if (c.ExtendedProperties[VBCommon.Globals.HIDDEN].ToString() == "True")
                            { dgv.Columns[c.ColumnName].Visible = false; }
                    }

                    //reset the column disabled properties
                    bool hasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (hasattribute)
                    {
                        selectedColIndex = dt.Columns.IndexOf(c);
                        if (c.ExtendedProperties[VBCommon.Globals.ENABLED].ToString() != "True")
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                        }
                        else
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Black;
                        }
                    }
                }

                //reset the UI clues for the response variable
                dgv.Columns[responseVarColName].DefaultCellStyle.BackColor = Color.LightBlue;

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool enabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!enabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                            dgv[c, r].Style.ForeColor = Color.Red;
                    }
                }

                //set the numerical precision for display
                setViewOnGrid(dgv);
            }
예제 #10
0
파일: Utilities.cs 프로젝트: wrbrooks/VB3
 public TableUtils(DataTable dt)
 {
     _dt = dt;
     _dtCI = dtColumnInformation.getdtCI(dt, false);
     _dtRI = dtRowInformation.getdtRI(dt, false);
 }
예제 #11
0
파일: Utilities.cs 프로젝트: wrbrooks/VB3
            public void setDisabledColandRows(DataGridView dgv, DataTable dt)
            {
                //reset the column disabled properties
                foreach (DataColumn c in dt.Columns)
                {
                    bool hasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (hasattribute)
                    {
                        int selectedColIndex = dt.Columns.IndexOf(c);
                        if (c.ExtendedProperties[VBCommon.Globals.ENABLED].ToString() != "True")
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                        }
                    }
                }

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool enabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!enabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                            dgv[c, r].Style.ForeColor = Color.Red;
                    }
                }
            }