private void dgvLista_DoubleClick(object sender, EventArgs e) { if (Activar_Filtros == true) { int a = 0; this.Cursor = Cursors.WaitCursor; dgvLista.CurrentRow.Cells["Seleccionar"].Value = true; foreach (DataGridViewRow Fila in dgvLista.Rows) { if (Convert.ToBoolean(Fila.Cells["Seleccionar"].Value) == true) { a++; Array.Resize(ref oAreaLaboral, a); oAreaLaboral[a - 1] = new AreaLaboralEN(); oAreaLaboral[a - 1].IdAreaLaboral = Convert.ToInt32(Fila.Cells["IdAreaLaboral"].Value); oAreaLaboral[a - 1].Area = Fila.Cells["Area"].Value.ToString(); oAreaLaboral[a - 1].oEmpresaEN.Nombre = Fila.Cells["Empresa"].Value.ToString(); } } this.Cursor = Cursors.Default; this.Close(); } }
public bool ListadoPorIdentificador(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = string.Format(@"Select IdAreaLaboral, Area, IdEmpresa from arealaboral where IdAreaLaboral = @IdAreaLaboral", oRegistroEN.IdAreaLaboral); Comando.Parameters.Add(new MySqlParameter("@IdAreaLaboral", MySqlDbType.Int32)).Value = oRegistroEN.IdAreaLaboral; Comando.CommandText = Consultas; InicializarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }
private void LlenarInformacionDelAreaLaboral() { try { this.Cursor = Cursors.WaitCursor; AreaLaboralEN oRegistroEN = new AreaLaboralEN(); AreaLaboralLN oRegistroLN = new AreaLaboralLN(); oRegistroEN.Where = ""; oRegistroEN.OrderBy = ""; if (oRegistroLN.Listado(oRegistroEN, Program.oDatosDeConexioEN)) { cmbAreaLaboral.DataSource = oRegistroLN.TraerDatos(); cmbAreaLaboral.DisplayMember = "Area Laboral"; cmbAreaLaboral.ValueMember = "IdAreaLaboral"; cmbAreaLaboral.SelectedIndex = -1; } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Información de los tipos de cuentas", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
public bool ListadoParaCombos(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = string.Format(@"select al.IdAreaLaboral, al.Area as 'Area Laboral', al.IdEmpresa, esa.Nombre as 'Empresa' from arealaboral as al inner join empresa as esa on al.IdEmpresa = esa.IdEmpresa where al.IdAreaLaboral > 0 {0} {1}; ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; InicializarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }
public bool ListadoPorIdentificador(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = string.Format(@"Select IdAreaLaboral, Area from AreaLaboral where IdAreaLaboral> {0}", oRegistroEN.IdAreaLaboral); Comando.CommandText = Consultas; InicializarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }
private string InformacionDelRegistro(AreaLaboralEN oRegistroEN) { string Cadena = @"IdAreaLaboral: {0}, Area: {1}"; Cadena = string.Format(Cadena, oRegistroEN.IdAreaLaboral, oRegistroEN.Area); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
public bool ValidarSiElRegistroEstaDuplicado(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { try { InicializarVariablesGlovales(oDatos); switch (TipoDeOperacion.Trim().ToUpper()) { case "AGREGAR": Consultas = @"SELECT CASE WHEN EXISTS(Select IdAreaLaboral from arealaboral where upper(trim(Area)) = upper(trim(@Area))) THEN 1 ELSE 0 END AS 'RES'"; Comando.Parameters.Add(new MySqlParameter("@Area", MySqlDbType.VarChar, oRegistroEN.Area.Trim().Length)).Value = oRegistroEN.Area.Trim(); break; case "ACTUALIZAR": Consultas = @"SELECT CASE WHEN EXISTS(Select IdAreaLaboral from arealaboral where upper(trim(Area)) = upper(trim(@Area)) and IdAreaLaboral <> @IdAreaLaboral) THEN 1 ELSE 0 END AS 'RES'"; Comando.Parameters.Add(new MySqlParameter("@Area", MySqlDbType.VarChar, oRegistroEN.Area.Trim().Length)).Value = oRegistroEN.Area.Trim(); Comando.Parameters.Add(new MySqlParameter("@IdAreaLaboral", MySqlDbType.Int32)).Value = oRegistroEN.IdAreaLaboral; break; default: throw new ArgumentException("La aperación solicitada no esta disponible"); } Comando.CommandText = Consultas; InicializarAdaptador(); if (Convert.ToInt32(DT.Rows[0]["RES"].ToString()) > 0) { DescripcionDeLaOperacion = string.Format("Ya existe información del Registro dentro de nuestro sistema: {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); this.Error = DescripcionDeLaOperacion; return(true); } return(false); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el seguiente error: '{2}' al validar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); //Agregamos la Transacción.... TransaccionesEN oTransaccion = InformacionDeLaTransaccion(oRegistroEN, "VALIDAR", "REGISTRO DUPLICADO DENTRO DE LA BASE DE DATOS", "ERROR"); oTransacciones.Agregar(oTransaccion, oDatos); return(false); } finally { FinalizarConexion(); oTransacciones = null; } }
public bool ValidarSiElRegistroEstaVinculado(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { oTransacciones = new TransaccionesAD(); try { InicializarVariablesGlovalesProcedure(oDatos); Comando.CommandText = "ValidarSiElRegistroEstaVinculado"; Comando.Parameters.Add(new MySqlParameter("@CampoABuscar_", MySqlDbType.VarChar, 200)).Value = "idDepartamentoOrganizacional"; Comando.Parameters.Add(new MySqlParameter("@ValorCampoABuscar", MySqlDbType.Int32)).Value = oRegistroEN.IdAreaLaboral; Comando.Parameters.Add(new MySqlParameter("@ExcluirTabla_", MySqlDbType.VarChar, 200)).Value = string.Empty; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); if (DT.Rows[0].ItemArray[0].ToString().ToUpper() == "NINGUNA".ToUpper()) { return(false); } else { this.Error = String.Format("La Operación: '{1}', {0} no se puede completar por que el registro: {0} '{2}', {0} se encuentra asociado con: {0} {3}", Environment.NewLine, TipoDeOperacion, InformacionDelRegistro(oRegistroEN)); DescripcionDeLaOperacion = this.Error; //Agregamos la Transacción.... TransaccionesEN oTransaccion = InformacionDeLaTransaccion(oRegistroEN, "VALIDAR", "VALIDAR SI EL REGISTRO ESTA VINCULADO", "CORRECTO"); oTransacciones.Agregar(oTransaccion, oDatos); return(true); } } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el seguiente error: '{2}' al validar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); //Agregamos la Transacción.... TransaccionesEN oTransaccionsacciones = InformacionDeLaTransaccion(oRegistroEN, "VALIDAR", "VALIDAR SI EL REGISTRO ESTA VINCULADO", "ERROR"); oTransacciones.Agregar(oTransaccionsacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransacciones = null; } }
public bool ListadoParaCombos(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { if (oAreaLaboralAD.ListadoParaCombos(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oAreaLaboralAD.Error; return(false); } }
public bool Agregar(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { if (oAreaLaboralAD.Agregar(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oAreaLaboralAD.Error; return(false); } }
public bool ValidarSiElRegistroEstaVinculado(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { if (oAreaLaboralAD.ValidarSiElRegistroEstaVinculado(oRegistroEN, oDatos, TipoDeOperacion)) { Error = oAreaLaboralAD.Error; return(true); } else { Error = string.Empty; return(false); } }
private AreaLaboralEN InformacionDeElRegistro() { AreaLaboralEN oRegistroEN = new AreaLaboralEN(); oRegistroEN.IdAreaLaboral = Convert.ToInt32((txtIdentificador.Text.Length > 0 ? txtIdentificador.Text : "0")); oRegistroEN.Area = txtArea.Text.Trim(); oRegistroEN.oEmpresaEN.IdEmpresa = Convert.ToInt32(cmbEmpresa.SelectedValue); oRegistroEN.oEmpresaEN.Nombre = cmbEmpresa.Text.Trim(); //partes generales. oRegistroEN.oLoginEN = Program.oLoginEN; return(oRegistroEN); }
public bool Actualizar(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { oTransacciones = new TransaccionesAD(); try { InicializarVariablesGlovales(oDatos); Consultas = @"update arealaboral set Area = @Area, IdEmpresa = @IdEmpresa where IdAreaLaboral = @IdAreaLaboral;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdAreaLaboral", MySqlDbType.Int32)).Value = oRegistroEN.IdAreaLaboral; Comando.Parameters.Add(new MySqlParameter("@Area", MySqlDbType.VarChar, oRegistroEN.Area.Trim().Length)).Value = oRegistroEN.Area.Trim(); Comando.Parameters.Add(new MySqlParameter("@IdEmpresa", MySqlDbType.Int32)).Value = oRegistroEN.oEmpresaEN.IdEmpresa; Comando.ExecuteNonQuery(); DescripcionDeLaOperacion = string.Format("El registro fue Actualizado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agregamos la Transacción.... TransaccionesEN oTransaccionsacciones = InformacionDeLaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "CORRECTO"); oTransacciones.Agregar(oTransaccionsacciones, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el seguiente error: '{2}' al actualizar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); //Agregamos la Transacción.... TransaccionesEN oTransaccionsacciones = InformacionDeLaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "ERROR"); oTransacciones.Agregar(oTransaccionsacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransacciones = null; } }
public bool Agregar(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { oTransacciones = new TransaccionesAD(); try { InicializarVariablesGlovales(oDatos); Consultas = @"insert into arealaboral (Area, IdEmpresa) value (@Area, @IdEmpresa); select last_insert_id() as 'ID'; "; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@Area", MySqlDbType.VarChar, oRegistroEN.Area.Trim().Length)).Value = oRegistroEN.Area.Trim(); Comando.Parameters.Add(new MySqlParameter("@IdEmpresa", MySqlDbType.Int32)).Value = oRegistroEN.oEmpresaEN.IdEmpresa; InicializarAdaptador(); oRegistroEN.IdAreaLaboral = Convert.ToInt32(DT.Rows[0].ItemArray[0].ToString()); DescripcionDeLaOperacion = string.Format("El registro fue insertado correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agragamos la transaccion... TransaccionesEN oTransaccionsacciones = InformacionDeLaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "CORRECTO"); oTransacciones.Agregar(oTransaccionsacciones, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el seguiente error: '{2}' al insertar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); //Agregamos la Transacción.... TransaccionesEN oTransaccionsacciones = InformacionDeLaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "ERROR"); oTransacciones.Agregar(oTransaccionsacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransacciones = null; } }
private void tsbSeleccionarTodos_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; tsbSeleccionarTodos.Checked = !tsbMarcarTodos.Checked; if (tsbSeleccionarTodos.Checked == true) { tsbSeleccionarTodos.Image = Properties.Resources.unchecked16x16; } else { tsbSeleccionarTodos.Image = Properties.Resources.checked16x16; } int a = 0; this.Cursor = Cursors.WaitCursor; if (dgvLista.Rows.Count > 0) { foreach (DataGridViewRow Fila in dgvLista.Rows) { if (Convert.ToBoolean(Fila.Cells["Seleccionar"].Value) == true) { a++; Array.Resize(ref oAreaLaboral, a); oAreaLaboral[a - 1] = new AreaLaboralEN(); oAreaLaboral[a - 1].IdAreaLaboral = Convert.ToInt32(Fila.Cells["ID"].Value); oAreaLaboral[a - 1].Area = Fila.Cells["Area"].Value.ToString(); oAreaLaboral[a - 1].oEmpresaEN.Nombre = Fila.Cells["Empresa"].Value.ToString(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Seleccionar registros", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { AgregarRegistroAlDTUsuario(); this.Cursor = Cursors.Default; this.Close(); } }
private void LlenarCamposDesdeBaseDatosSegunID() { this.Cursor = Cursors.WaitCursor; AreaLaboralEN oRegistrosEN = new AreaLaboralEN(); AreaLaboralLN oRegistrosLN = new AreaLaboralLN(); oRegistrosEN.IdAreaLaboral = ValorLlavePrimariaEntidad; if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexioEN)) { if (oRegistrosLN.TraerDatos().Rows.Count > 0) { DataRow Fila = oRegistrosLN.TraerDatos().Rows[0]; txtArea.Text = Fila["Area"].ToString(); cmbEmpresa.SelectedValue = Convert.ToInt32(Fila["IdEmpresa"].ToString()); oRegistrosEN = null; oRegistrosLN = null; } else { string Mensaje; Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado." + "\n\r-----Causas---- " + "\n\r1. Este registro pudo haber sido eliminado por otro usuario." + "\n\r2. El listado no está actualizado.", Nombre_Entidad); MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; this.Close(); } } else { this.Cursor = Cursors.Default; MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; } this.Cursor = Cursors.Default; }
public bool Eliminar(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { if (string.IsNullOrEmpty(oRegistroEN.IdAreaLaboral.ToString()) || oRegistroEN.IdAreaLaboral == 0) { this.Error = @"Se debe seleccionar un elemento de la lista"; return(false); } if (oAreaLaboralAD.Eliminar(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oAreaLaboralAD.Error; return(false); } }
private TransaccionesEN InformacionDeLaTransaccion(AreaLaboralEN oAreaLaboral, string TipoDeOperacion, string Descripcion, string Estado) { TransaccionesEN oRegistroEN = new TransaccionesEN(); oRegistroEN.IdRegistro = oAreaLaboral.IdAreaLaboral; oRegistroEN.Modelo = "AreaLaboralAD"; oRegistroEN.Tabla = "AreaLaboral"; oRegistroEN.TipoDeOperacion = TipoDeOperacion; oRegistroEN.Estado = Estado; oRegistroEN.IP = oAreaLaboral.oLoginEN.NumeroIP; oRegistroEN.IdUsuario = oAreaLaboral.oLoginEN.IdUsuario; oRegistroEN.IdUsuarioAPrueva = oAreaLaboral.oLoginEN.IdUsuario; oRegistroEN.DescripcionDelUsuario = DescripcionDeLaOperacion; oRegistroEN.DescripcionInterna = Descripcion; oRegistroEN.nombredelequipo = oAreaLaboral.oLoginEN.NombreDelEquipo; return(oRegistroEN); }
private void LlenarListado() { try { this.Cursor = Cursors.WaitCursor; AreaLaboralEN oRegistroEN = new AreaLaboralEN(); AreaLaboralLN oRegistroLN = new AreaLaboralLN(); oRegistroEN.Where = WhereDinamico(); if (oRegistroLN.Listado(oRegistroEN, Program.oDatosDeConexioEN)) { dgvLista.Columns.Clear(); System.Diagnostics.Debug.Print(oRegistroLN.TraerDatos().Rows.Count.ToString()); if (Activar_Filtros == true) { dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistroLN.TraerDatos()); } else { dgvLista.DataSource = oRegistroLN.TraerDatos(); } FormatearDGV(); this.dgvLista.ClearSelection(); tsbNoRegistros.Text = "No. Registros: " + oRegistroLN.TotalRegistros().ToString(); } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Llenar listado de registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
public bool ListadoParaReportes(AreaLaboralEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = string.Format(@"select IdAreaLaboral, Area, IdEmpresa from arealaboral where IdAreaLaboral > 0 {0} {1} ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; InicializarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }
private void tsbEliminar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { if (txtIdentificador.Text.Length == 0 || txtIdentificador.Text == "0") { MessageBox.Show("No se puede continuar. Ha ocurrido un error y el registro no ha sido cargado correctamente.", OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("¿Está seguro que desea eliminar el registro?", "Eliminar la Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == System.Windows.Forms.DialogResult.No) { return; } AreaLaboralEN oRegistroEN = InformacionDeElRegistro(); AreaLaboralLN oRegistroLN = new AreaLaboralLN(); if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexioEN, "ELIMINAR")) { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, this.OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (oRegistroLN.Eliminar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdAreaLaboral.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdAreaLaboral; EvaluarErrorParaMensageDePantalla(oRegistroLN.Error, "Eliminar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Eliminar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void tsbActualizar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { if (txtIdentificador.Text.Length == 0 || txtIdentificador.Text == "0") { MessageBox.Show("No se puede continuar. Ha ocurrido un error y el registro no ha sido cargado correctamente.", OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("¿Está seguro que desea aplicar los cambios al registro seleccionado?", "Actualizar la Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == System.Windows.Forms.DialogResult.No) { return; } AreaLaboralEN oRegistroEN = InformacionDeElRegistro(); AreaLaboralLN oRegistroLN = new AreaLaboralLN(); if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexioEN, "ACTUALIZAR")) { if (PermitirCambiarRegistroAunqueEstenVinculados == true && AplicarCambio == true) { if (MessageBox.Show(string.Format("Está seguro que desea actualizar los cambios en el registro seleccionado ya que este se encuentra asociado a otras Entidades de manera interna? {0} {1}", Environment.NewLine, oRegistroLN.Error), "Confirmación de Actualización", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { this.Cursor = Cursors.Default; return; } } else { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, "Actualizar la información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexioEN, "ACTUALIZAR")) { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, "Actualizar la información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (oRegistroLN.Actualizar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdAreaLaboral.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdAreaLaboral; EvaluarErrorParaMensageDePantalla(oRegistroLN.Error, "Actualizar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Actualizar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void tsbGuardar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { AreaLaboralEN oRegistroEN = InformacionDeElRegistro(); AreaLaboralLN oRegistroLN = new AreaLaboralLN(); if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexioEN, "AGREGAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexioEN, "AGREGAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar Informacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexioEN)) { txtIdentificador.Text = oRegistroEN.IdAreaLaboral.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.IdAreaLaboral; EvaluarErrorParaMensageDePantalla(oRegistroLN.Error, "Guardar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; if (CerrarVentana == true) { this.Close(); } else { OperacionARealizar = "GUARDAR"; ObtenerValoresDeLaConfiguracion(); LlamarMetodoSegunOperacion(); EstablecerTituloDeVentana(); DeshabilitarControlesSegunOperacionesARealizar(); } } else { throw new ArgumentException(oRegistroLN.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Guardar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }