private void dataGridView1_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } var currentRow = dataGridView1.Rows[e.RowIndex]; if (currentRow == dataGridView1_MouseMove_previousRow) { return; } dataGridView1_MouseMove_previousRow = currentRow; // See if we have a valid item under mouse pointer if (currentRow != null) { var IDNivelUF = long.Parse(currentRow.Cells[ID].Value.ToString()); LoadUFRelacionada(IDNivelUF); var ufRow = GisaDataSetHelper.GetInstance().Nivel.Cast <GISADataset.NivelRow>().Single(r => r.ID == IDNivelUF); currentRow.Cells[e.ColumnIndex].ToolTipText = UnidadesFisicasHelper.GetConteudoInformacional(GisaDataSetHelper.GetInstance(), ufRow); } }
private string GetNextCodigoString(GISADataset.NivelRow nivelEDRow, int ano) { // if it is a new row. generate new code // *OR* // it is an existing row being edited. generate new code only if entidade detentora is diferent than the original if (txtDesignacao.Tag == null || ((GISADataset.NivelDesignadoRow)txtDesignacao.Tag).ID == -1 || (((GISADataset.NivelDesignadoRow)txtDesignacao.Tag).ID != -1 && ((GISADataset.NivelDesignadoRow)cbEntidadeDetentora.SelectedItem).ID != ((GISADataset.NivelDesignadoRow)cbEntidadeDetentora.Tag).ID)) { return(UnidadesFisicasHelper.GenerateNewCodigoString(nivelEDRow, ano)); } else { // restore original return(((GISADataset.NivelDesignadoRow)txtDesignacao.Tag).NivelRow.Codigo); } }