public bool Listado(DeduccionesEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicialisarVariablesGlovales(oDatos); Consultas = string.Format(@"Select IdDeducciones, INSS, IR, Prestamos, TotalDeduccines, IdDetalleDeDeducciones from deducciones where IdDeducciones > 0 {0} {1}", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; InicialisarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }
private string InformacionDelRegistro(DeduccionesEN oRegistroEN) { string Cadena = @"IdDeducciones: {0}, INSS: {1}, IR: {2}, Prestamos: {3}, TOtalDeDeducciones: {4}, IdDetalleDeDeducciones: {5}"; Cadena = string.Format(Cadena, oRegistroEN.IdDeducciones, oRegistroEN.INSS, oRegistroEN.IR, oRegistroEN.Prestamos, oRegistroEN.TotalDeDeducciones, oRegistroEN.oDetalleDeDeduccionesEN.IdDetalleDeDeducciones); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
public bool ListadoPorID(DeduccionesEN oREgistroEN, DatosDeConexionEN oDatos) { if (oDeduccionesAD.ListadoPorID(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oDeduccionesAD.Error; return(false); } }
public bool Agregar(DeduccionesEN oRegistroEN, DatosDeConexionEN oDatos) { if (oDeduccionesAD.Agregar(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oDeduccionesAD.Error; return(false); } }
public bool Actualizar(DeduccionesEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"update Deducciones set INSS = @INSS, IR = @IR, Prestamos = @Prestamos, TotalDeduccines = @TotalDeduccines, IdDetalleDeDeducciones = @IdDetalleDeDeducciones where IdDeducciones = @IdDeducciones;"; Comando.Parameters.Add(new MySqlParameter("@IdDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.IdDeducciones; Comando.Parameters.Add(new MySqlParameter("@INSS", MySqlDbType.Decimal)).Value = oRegistroEN.INSS; Comando.Parameters.Add(new MySqlParameter("@IR", MySqlDbType.Decimal)).Value = oRegistroEN.IR; Comando.Parameters.Add(new MySqlParameter("@Prestamos", MySqlDbType.Decimal)).Value = oRegistroEN.Prestamos; Comando.Parameters.Add(new MySqlParameter("@TotalDeduccines", MySqlDbType.Decimal)).Value = oRegistroEN.TotalDeDeducciones; Comando.Parameters.Add(new MySqlParameter("@IdDetalleDeDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.oDetalleDeDeduccionesEN.IdDetalleDeDeducciones; Comando.ExecuteNonQuery(); DescripcionDeLaOperacion = string.Format("El registro fue Actualizado correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTransacciones, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el siguiente error: {2} al actualizar el registro {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "ERROR"); oTransaccionesAD.Agregar(oTransacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }
public bool Agregar(DeduccionesEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"insert into deducciones (INSS, IR, Prestamos, TotalDeduccines, IdDetalleDeDeducciones) values (@INSS, @IR, @Prestamos, @TotalDeduccines, @IdDetalleDeDeducciones); Select last_insert_ID() as 'ID'; "; Comando.Parameters.Add(new MySqlParameter("@INSS", MySqlDbType.Decimal)).Value = oRegistroEN.INSS; Comando.Parameters.Add(new MySqlParameter("@IR", MySqlDbType.Decimal)).Value = oRegistroEN.IR; Comando.Parameters.Add(new MySqlParameter("@Prestamos", MySqlDbType.Decimal)).Value = oRegistroEN.Prestamos; Comando.Parameters.Add(new MySqlParameter("@TotalDeduccines", MySqlDbType.Decimal)).Value = oRegistroEN.TotalDeDeducciones; Comando.Parameters.Add(new MySqlParameter("@IdDetalleDeDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.oDetalleDeDeduccionesEN.IdDetalleDeDeducciones; InicialisarAdaptador(); oRegistroEN.IdDeducciones = Convert.ToInt32(DT.Rows[0].ItemArray[0].ToString()); DescripcionDeLaOperacion = string.Format("El registro se ha insertado correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTransacciones, 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); TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "ERROR"); oTransaccionesAD.Agregar(oTransacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }
public bool Actualizar(DeduccionesEN oRegistrEN, DatosDeConexionEN oDatos) { if (string.IsNullOrEmpty(oRegistrEN.IdDeducciones.ToString()) || oRegistrEN.IdDeducciones == 0) { this.Error = @"Se debe seleccionar un elemento de la lista"; return(false); } if (oDeduccionesAD.Actualizar(oRegistrEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oDeduccionesAD.Error; return(false); } }
private TransaccionesEN InformacionDelaTransaccion(DeduccionesEN oDeducciones, String TipoDeOperacion, String Descripcion, String Estado) { TransaccionesEN oRegistroEN = new TransaccionesEN(); oRegistroEN.IdRegistro = oDeducciones.IdDeducciones; oRegistroEN.Modelo = "DeduccionesAD"; //oRegistroEN.Modulo = "Clientes"; oRegistroEN.Tabla = "Deducciones"; oRegistroEN.TipoDeOperacion = TipoDeOperacion; oRegistroEN.Estado = Estado; oRegistroEN.IP = oDeducciones.oLoginEN.NumeroIP; oRegistroEN.IdUsuario = oDeducciones.oLoginEN.IdUsuario; oRegistroEN.IdUsuarioAPrueva = oDeducciones.oLoginEN.IdUsuario; oRegistroEN.DescripcionDelUsuario = DescripcionDeLaOperacion; oRegistroEN.DescripcionInterna = Descripcion; oRegistroEN.nombredelequipo = oDeducciones.oLoginEN.NombreDelEquipo; return(oRegistroEN); }
public bool Eliminar(DeduccionesEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"delete from deducciones where IdDeducciones = @IdDeducciones;"; Comando.Parameters.Add(new MySqlParameter("@IdDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.IdDeducciones; Comando.ExecuteNonQuery(); DescripcionDeLaOperacion = string.Format("El registro fue eliminado correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agregamos la transaccion... TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Eliminar", "Elminar Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTransacciones, oDatos); return(true); } catch (Exception ex) { DescripcionDeLaOperacion = string.Format("Se produjo el siguiente error: {2} al eliminar el registro. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); TransaccionesEN oTransacciones = InformacionDelaTransaccion(oRegistroEN, "Eliminar", "Eliminar Registro", "ERROR"); oTransaccionesAD.Agregar(oTransacciones, oDatos); return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }