private string InformacionDelRegistro(PlanillaEN oRegistroEN) { string Cadena = @"IdPlanilla: {0}, SalarioBase: {1}, PagoHorasExtras: {2}, Comicion: {3}, IdEmpleado: {4}, IdDeducciones: {5}"; Cadena = string.Format(Cadena, oRegistroEN.IdPlanilla, oRegistroEN.SalarioBase, oRegistroEN.PagoHorasExtras, oRegistroEN.Comicion, oRegistroEN.oEmpleadoEN.IdEmpleado, oRegistroEN.oDeducciones.IdDeducciones); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
public bool Actualizar(PlanillaEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"UPDATE planilla set SalarioBase = @SalarioBase, PagoHorasExtras = @PagoHorasExtras, Comicion = @Comicion, IdEmpleado = @IdEmpleado, IdDeducciones = @IdDeducciones where IdPlanilla = @IdPlanilla;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdPlanilla", MySqlDbType.Int32)).Value = oRegistroEN.IdPlanilla; Comando.Parameters.Add(new MySqlParameter("@SalarioBase", MySqlDbType.Decimal)).Value = oRegistroEN.SalarioBase; Comando.Parameters.Add(new MySqlParameter("@PagoHorasExtras", MySqlDbType.Decimal)).Value = oRegistroEN.PagoHorasExtras; Comando.Parameters.Add(new MySqlParameter("@Comicion", MySqlDbType.Decimal)).Value = oRegistroEN.Comicion; Comando.Parameters.Add(new MySqlParameter("@IdEmpleado", MySqlDbType.Int32)).Value = oRegistroEN.oEmpleadoEN.IdEmpleado; Comando.Parameters.Add(new MySqlParameter("@IdDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.oDeducciones.IdDeducciones; 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(PlanillaEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"insert into planilla (SalarioBase, PagoHorasExtras, Comicion, IdEmpleado, IdDeducciones) values (@SalarioBase, @PagoHorasExtras, @Comicion, @IdEmpleado, @IdDeducciones); Select last_insert_ID() as 'ID';"; Comando.Parameters.Add(new MySqlParameter("@SalarioBase", MySqlDbType.Decimal)).Value = oRegistroEN.SalarioBase; Comando.Parameters.Add(new MySqlParameter("@PagoHorasExtras", MySqlDbType.Decimal)).Value = oRegistroEN.PagoHorasExtras; Comando.Parameters.Add(new MySqlParameter("@Comicion", MySqlDbType.Decimal)).Value = oRegistroEN.Comicion; Comando.Parameters.Add(new MySqlParameter("@IdEmpleado", MySqlDbType.Int32)).Value = oRegistroEN.oEmpleadoEN.IdEmpleado; Comando.Parameters.Add(new MySqlParameter("@IdDeducciones", MySqlDbType.Int32)).Value = oRegistroEN.oDeducciones.IdDeducciones; InicialisarAdaptador(); oRegistroEN.IdPlanilla = 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; } }
private TransaccionesEN InformacionDelaTransaccion(PlanillaEN oPlanilla, String TipoDeOperacion, String Descripcion, String Estado) { TransaccionesEN oRegistroEN = new TransaccionesEN(); oRegistroEN.IdRegistro = oPlanilla.IdPlanilla; oRegistroEN.Modelo = "PlanillaAD"; //oRegistroEN.Modulo = "#"; oRegistroEN.Tabla = "Planilla"; oRegistroEN.TipoDeOperacion = TipoDeOperacion; oRegistroEN.Estado = Estado; oRegistroEN.IP = oPlanilla.oLoginEN.NumeroIP; oRegistroEN.IdUsuario = oPlanilla.oLoginEN.IdUsuario; oRegistroEN.IdUsuarioAPrueva = oPlanilla.oLoginEN.IdUsuario; oRegistroEN.DescripcionDelUsuario = DescripcionDeLaOperacion; oRegistroEN.DescripcionInterna = Descripcion; oRegistroEN.nombredelequipo = oPlanilla.oLoginEN.NombreDelEquipo; return(oRegistroEN); }
public bool Eliminar(PlanillaEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { InicialisarVariablesGlovales(oDatos); Consultas = @"Delete from planilla where IdPlanilla = @IdPlanilla;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdPlanilla", MySqlDbType.Int32)).Value = oRegistroEN.IdPlanilla; 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) { this.Error = ex.Message; 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; } }
public bool ListadoParaReportes(PlanillaEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicialisarVariablesGlovales(oDatos); Consultas = string.Format(@"select IdPlanilla, SalarioBase, PagoHorasExtras, Comicion, IdEmpleado, IdDeducciones from planilla where IdPlanilla > 0 {0} {1} ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; InicialisarAdaptador(); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { FinalizarConexion(); } }