private void _Mtd_CargarGrid(string _P_Str_Cadena, DataGridView _P_Dg_Grid) { if (_P_Dg_Grid.InvokeRequired) { SetDataSetsCallback _Sets = new SetDataSetsCallback(_Mtd_CargarGrid); this.Invoke(_Sets, new object[] { _P_Str_Cadena, _P_Dg_Grid }); } else { _P_Dg_Grid.DataSource = Program._MyClsCnn._mtd_conexion2._Mtd_RetornarDataset(_P_Str_Cadena).Tables[0]; _P_Dg_Grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; foreach (DataGridViewRow _Dg_Row in _P_Dg_Grid.Rows) { if (Convert.ToString(_Dg_Row.Cells["prioridad"].Value).Trim() == "1") { _Dg_Row.DefaultCellStyle.BackColor = Color.FromArgb(255, 113, 113); } if (Convert.ToString(_Dg_Row.Cells["prioridad"].Value).Trim() == "2") { _Dg_Row.DefaultCellStyle.BackColor = Color.FromArgb(255, 175, 175); } if (Convert.ToString(_Dg_Row.Cells["prioridad"].Value).Trim() == "3") { _Dg_Row.DefaultCellStyle.BackColor = Color.FromArgb(255, 252, 183); } if (Convert.ToString(_Dg_Row.Cells["prioridad"].Value).Trim() == "4") { _Dg_Row.DefaultCellStyle.BackColor = Color.FromArgb(220, 218, 254); } } } }
private void _Mtd_CargarGrid(DataGridView _P_Dg_Grid, ComboBox _P_Cmb_Combo, string _P_Str_Cadena) { if (_P_Dg_Grid.InvokeRequired) { SetDataSetsCallback _Sets = new SetDataSetsCallback(_Mtd_CargarGrid); this.Invoke(_Sets, new object[] { _P_Dg_Grid, _P_Cmb_Combo, _P_Str_Cadena }); } else { string _Str_Filtro = ""; if (_P_Cmb_Combo.SelectedIndex > 0) { string[] _Str_MesAno = _Mtd_ExtraerMesAno(_P_Cmb_Combo.Text.Trim()); _Str_Filtro = " AND MONTH(cfechadesde)='" + _Str_MesAno[0] + "' AND YEAR(cfechadesde)='" + _Str_MesAno[1] + "'"; } if (_P_Dg_Grid.Name == "_Dg_Grid_IVA") { _Str_Filtro += " ORDER BY cidarchivoiva DESC"; } else { _Str_Filtro += " ORDER BY cidarchivoislr DESC"; } DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_P_Str_Cadena + _Str_Filtro); _P_Dg_Grid.DataSource = _Ds.Tables[0]; _P_Dg_Grid.Columns[5].Visible = false; } }
private void _Mtd_CargarGrid(DataSet _P_Ds, DataGridView _P_Dg_Grid) { if (_P_Dg_Grid.InvokeRequired) { SetDataSetsCallback _Sets = new SetDataSetsCallback(_Mtd_CargarGrid); this.Invoke(_Sets, new object[] { _P_Ds, _P_Dg_Grid }); } else { _P_Dg_Grid.DataSource = _P_Ds.Tables[0]; } }