Exemple #1
1
 /// <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;
 }
Exemple #2
0
            public void setDisabledColandRows(DataGridView dgv, DataTable dt)
            {
                //reset the column disabled properties
                foreach (DataColumn c in dt.Columns)
                {
                    bool boolHasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (boolHasattribute)
                    {
                        int  intSelectedColIndex = dt.Columns.IndexOf(c);
                        bool boolEnabled         = (bool)c.ExtendedProperties[VBCommon.Globals.ENABLED];
                        if (!boolEnabled) //{ DisableCol(null, null); }
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                            {
                                dgv[intSelectedColIndex, r].Style.ForeColor = Color.Red;
                            }
                        }
                    }
                }

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool boolEnabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!boolEnabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                        {
                            dgv[c, r].Style.ForeColor = Color.Red;
                        }
                    }
                }
            }
Exemple #3
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 boolHashidden = c.ExtendedProperties.ContainsKey(VBCommon.Globals.HIDDEN);
                    if (boolHashidden == true)
                    {
                        bool boolHide = (bool)c.ExtendedProperties[VBCommon.Globals.HIDDEN];
                        if (boolHide)
                        {
                            dgv.Columns[c.ColumnName].Visible = false;
                        }
                    }
                    //reset the column disabled properties
                    bool boolHasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (boolHasattribute)
                    {
                        selectedColIndex = dt.Columns.IndexOf(c);
                        bool boolEnabled = (bool)c.ExtendedProperties[VBCommon.Globals.ENABLED];
                        if (!boolEnabled)
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                            {
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                            }
                        }
                    }
                }

                //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 boolEnabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!boolEnabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                        {
                            dgv[c, r].Style.ForeColor = Color.Red;
                        }
                    }
                }

                //set the numerical precision for display
                setViewOnGrid(dgv);
            }
Exemple #4
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);
 }
Exemple #5
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;
                }
            }
Exemple #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 = 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;
        }
Exemple #7
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;
        }
Exemple #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 boolHashidden = c.ExtendedProperties.ContainsKey(VBCommon.Globals.HIDDEN);
                    if (boolHashidden == true)
                    {
                        bool boolHide = (bool)c.ExtendedProperties[VBCommon.Globals.HIDDEN];
                        if (boolHide) { dgv.Columns[c.ColumnName].Visible = false; }
                    }
                    //reset the column disabled properties
                    bool boolHasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (boolHasattribute)
                    {
                        selectedColIndex = dt.Columns.IndexOf(c);
                        bool boolEnabled = (bool)c.ExtendedProperties[VBCommon.Globals.ENABLED];
                        if (!boolEnabled)
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                                dgv[selectedColIndex, r].Style.ForeColor = Color.Red;
                        }
                    }
                }

                //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 boolEnabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!boolEnabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                            dgv[c, r].Style.ForeColor = Color.Red;
                    }
                }

                //set the numerical precision for display
                setViewOnGrid(dgv);
            }
Exemple #9
0
 public TableUtils(DataTable dt)
 {
     _dt = dt;
     _dtCI = dtColumnInformation.getdtCI(dt, false);
     _dtRI = dtRowInformation.getdtRI(dt, false);
 }
Exemple #10
0
            public void setDisabledColandRows(DataGridView dgv, DataTable dt)
            {
                //reset the column disabled properties
                foreach (DataColumn c in dt.Columns)
                {
                    bool boolHasattribute = c.ExtendedProperties.ContainsKey(VBCommon.Globals.ENABLED);
                    if (boolHasattribute)
                    {
                        int intSelectedColIndex = dt.Columns.IndexOf(c);
                        bool boolEnabled = (bool)c.ExtendedProperties[VBCommon.Globals.ENABLED];
                        if (!boolEnabled) //{ DisableCol(null, null); }
                        {
                            for (int r = 0; r < dgv.Rows.Count; r++)
                                dgv[intSelectedColIndex, r].Style.ForeColor = Color.Red;
                        }
                    }
                }

                //reset disable rows
                _dtRI = dtRowInformation.getdtRI(dt, false);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    bool boolEnabled = _dtRI.getRowStatus(dt.Rows[r][0].ToString());
                    if (!boolEnabled)
                    {
                        for (int c = 0; c < dgv.Columns.Count; c++)
                            dgv[c, r].Style.ForeColor = Color.Red;
                    }
                }
            }
Exemple #11
0
 public TableUtils(DataTable dt)
 {
     _dt   = dt;
     _dtCI = dtColumnInformation.getdtCI(dt, false);
     _dtRI = dtRowInformation.getdtRI(dt, false);
 }