private void btnModificar_Click(object sender, EventArgs e) { string _Message = ((cmbTipo.SelectedIndex == 0) ? "- Debe seleccionar un tipo de plantilla" : ""); if (_Message.Length > 0) { MessageBox.Show(_Message, "Información Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int Row = DtCruces.CurrentCell.RowIndex; int IDCruce = Convert.ToInt32(DtCruces.Rows[Row].Cells[0].Value.ToString()); oCruce _Cruce = _Cruces.Where(o => o.IdCruce == IDCruce).FirstOrDefault(); ActualizarCruce form = new ActualizarCruce(IDCruce, _Cruce, cmbTipo.SelectedIndex, "M"); form.Text = "Modificar cruce"; form.ShowDialog(); CargaDTCruces(); }
private void btnAgregar_Click(object sender, EventArgs e) { string _Message = ((cmbTipo.SelectedIndex == 0) ? "- Debe seleccionar un tipo de plantilla" : ""); if (_Message.Length > 0) { MessageBox.Show(_Message, "Información Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int temp = 0; var MaxNro = DtCruces.Rows.Cast <DataGridViewRow>() .Max(r => int.TryParse(r.Cells["Numero"].Value.ToString(), out temp) ? temp : 0); ActualizarCruce form = new ActualizarCruce(temp + 1, null, cmbTipo.SelectedIndex, "A"); form.Text = "Agregar cruce"; form.ShowDialog(); CargaDTCruces(); }