private void ListarAsignados() { dataItemsAS.DataSource = NInstruItems.ListarAsignados(IDInstrumento); dataItemsAS.AutoResizeColumns(); dataItemsAS.Columns[1].Width = 250; dataItemsAS.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsAS.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsAS.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsAS.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsAS.Columns[3].DefaultCellStyle.Format = "#,0.00###"; dataItemsAS.Columns[4].DefaultCellStyle.Format = "#,0.00###"; dataItemsAS.Columns[5].DefaultCellStyle.Format = "#,0.00###"; dataItemsAS.ClearSelection(); //dataItems.SelectedRows[0].Selected = false; }
/// <summary> /// Carga el DataGrid dataItemsCompaa /// </summary> private void ListarItemComprobacion() { if (dataInstrumentos.SelectedRows.Count > 0) { int indice = dataInstrumentos.SelectedRows[0].Index; dataItemsComp.DataSource = NInstruItems.ListarAsignados(Convert.ToInt32(dataInstrumentos[0, indice].Value)); dataItemsComp.AutoResizeColumns(); dataItemsComp.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsComp.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsComp.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsComp.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataItemsComp.Columns[3].DefaultCellStyle.Format = "#,0.00###"; dataItemsComp.Columns[4].DefaultCellStyle.Format = "#,0.00###"; dataItemsComp.Columns[5].DefaultCellStyle.Format = "#,0.00###"; } }
private void btnAgregar_Click(object sender, EventArgs e) { //Eliminar los Items Actuales Asociados NInstruItems.Eliminar(IDInstrumento); foreach (DataGridViewRow RowDG in dataItemsAS.Rows) { NInstruItems.Insertar(IDInstrumento, Convert.ToInt32(RowDG.Cells[0].Value), Convert.ToString(RowDG.Cells[1].Value), Convert.ToString(RowDG.Cells[2].Value), Convert.ToDouble(RowDG.Cells[3].Value), Convert.ToDouble(RowDG.Cells[4].Value), Convert.ToDouble(RowDG.Cells[5].Value)); } EnviarEvento(); this.Close(); }