private void cmbEstado_SelectedIndexChanged(object sender, EventArgs e) { if (cmbEstado.Text.Trim() != string.Empty) { errorIcono.SetError(cmbEstado, ""); DateTime Fecha = AccionEnviada == "Agregar" ? Convert.ToDateTime(dtpIngreso.Text) : Convert.ToDateTime(txtUltCalib.Text); if (AccionEnviada == "Agregar" || Cont > 0) { dtpProxCalib.Text = Convert.ToString(Funciones.ProximaFechaCalibracion(Convert.ToInt32(IDInstrumento.Cells[0].Value), cmbEstado.Text.Trim(), Fecha)); } else { Cont += 1; } if (cmbEstado.Text.Trim() == "Nuevo") { lblFrecuencia.Text = "Frecuencia: " + FrecNuevo; } else { lblFrecuencia.Text = "Frecuencia: " + FrecUsado; } } }
private void CargarEncabezado() { DataTable DTInstru = new DataTable(); DTInstru = NInstrumento.Buscar(Convert.ToInt32(DataIdentidad.Cells[0].Value)); txtCodInstru.Text = Convert.ToString(DTInstru.Rows[0][1]); txtDescInstru.Text = Convert.ToString(DTInstru.Rows[0][2]); txtId.Text = Convert.ToString(DataIdentidad.Cells[1].Value); txtEstado.Text = Convert.ToString(DataIdentidad.Cells[3].Value); txtCodEmp.Text = Convert.ToString(DataIdentidad.Cells[4].Value); txtNomEmp.Text = Convert.ToString(DataIdentidad.Cells[5].Value); txtCertificado.Text = Convert.ToString(DataIdentidad.Cells[9].Value); txtMarca.Text = Convert.ToString(DataIdentidad.Cells[10].Value); if (AccionEnviada == "Nuevo") { txtCalibra.Text = Convert.ToString(NCalibracion.ProximoCodigoIndividual(Convert.ToInt32(DataIdentidad.Cells[0].Value), Convert.ToInt32(DataIdentidad.Cells[1].Value))); dtpFecCalib.Text = Convert.ToString(DataIdentidad.Cells[8].Value); dtpProxCalib.Text = Convert.ToString(Funciones.ProximaFechaCalibracion(Convert.ToInt32(DataIdentidad.Cells[0].Value), txtEstado.Text.Trim(), dtpFecCalib.Value)); } else if (AccionEnviada == "Actualizar") { txtCalibra.Text = Convert.ToString(DataCalibracion.Cells[3].Value); dtpFecCalib.Text = Convert.ToString(DataCalibracion.Cells[4].Value); dtpProxCalib.Text = Convert.ToString(Funciones.ProximaFechaCalibracion(Convert.ToInt32(DataIdentidad.Cells[0].Value), txtEstado.Text.Trim(), dtpFecCalib.Value)); } txtCodInstru.BackColor = System.Drawing.SystemColors.ControlLightLight; txtDescInstru.BackColor = System.Drawing.SystemColors.ControlLightLight; txtId.BackColor = System.Drawing.SystemColors.ControlLightLight; txtEstado.BackColor = System.Drawing.SystemColors.ControlLightLight; txtCodEmp.BackColor = System.Drawing.SystemColors.ControlLightLight; txtNomEmp.BackColor = System.Drawing.SystemColors.ControlLightLight; txtCertificado.BackColor = System.Drawing.SystemColors.ControlLightLight; txtMarca.BackColor = System.Drawing.SystemColors.ControlLightLight; txtCalibra.BackColor = System.Drawing.SystemColors.ControlLightLight; }