private void CargarInformacionDeLaConfiguracion() { try { ConfiguracionEN oRegistroEN = new ConfiguracionEN(); ConfiguracionLN oRegistroLN = new ConfiguracionLN(); oRegistroEN.IdConfiguracion = 1; if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion)) { DataRow Fila = oRegistroLN.TraerDatos().Rows[0]; Program.oConfiguracionEN.RutaRespaldos = Fila["RutaRespaldos"].ToString(); Program.oConfiguracionEN.RutaRespaldosDeExcel = Fila["RutaRespaldosDeExcel"].ToString(); Program.oConfiguracionEN.PathMysSQLDump = Fila["PathMysSQLDump"].ToString(); Program.oConfiguracionEN.PathMySQL = Fila["PathMySQL"].ToString(); Program.oConfiguracionEN.NombreDelSistema = Fila["NombreDelSistema"].ToString(); Program.oConfiguracionEN.TiempoDeRespaldo = Convert.ToInt32(Fila["TiempoDeRespaldo"].ToString()); Program.oConfiguracionEN.PrecioPorDefecto = Convert.ToInt32(Fila["PrecioPorDefecto"].ToString()); } } catch (Exception ex) { MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool Listado(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = string.Format(@"Select IdConfiguracion, RutaDeRespaldo, RutaDeRespaldoDeEcxel, PathMySqlDump, PathMySql, NombreDelSistema, TiempoDeRespaldo, ImpuestoDeValorAgregado, CorreoDelRemitente, ServicioSmtp, ContrasenaDelRemitente, PuertoDelServidor, AsuntoDelCorreo, MensageDelCorreofrom configuracion where IdConfiguracion > 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 ConfiguracionEN InformacionDelRegistro() { ConfiguracionEN oRegistroEN = null; try { MessageBox.Show(int.Parse(cmbPrecioPorDefecto.Text).ToString()); oRegistroEN = new ConfiguracionEN(); oRegistroEN.IdConfiguracion = IdConfiguracion; oRegistroEN.RutaRespaldos = txtRutaRespaldosBD.Text.Trim(); oRegistroEN.RutaRespaldosDeExcel = txtRutaExportacionArchivosExcel.Text.Trim(); oRegistroEN.PathMysSQLDump = txtMysqlDump.Text.Trim(); oRegistroEN.PathMySQL = txtPathMySQL.Text.Trim(); oRegistroEN.NombreDelSistema = txtNombreDelSistema.Text; oRegistroEN.TiempoDeRespaldo = Convert.ToInt32(txtTiempoDeRespaldo.Text); oRegistroEN.oLoginEN = Program.oLoginEN; oRegistroEN.PrecioPorDefecto = Convert.ToInt32(int.Parse(cmbPrecioPorDefecto.Text)); return(oRegistroEN); } catch (Exception ex) { MessageBox.Show(ex.Message, "Información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); return(oRegistroEN); } }
public bool Eliminar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = @"delete from configuracion where IdConfiguracion = @IdConfiguracion;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdConfiguracion", MySqlDbType.Int32)).Value = oRegistroEN.IdConfiguracion; Comando.ExecuteNonQuery(); DescripcionDeLaOperacion = string.Format("El registro fue Eliminado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ELIMINAR", "INFORMACIÓN DE LA CONFIGURACIÓN ELIMINADA", "CORRECTA", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeLaOperacion = string.Format("Se produjo el seguiente error: '{2}' al eliminar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ELIMINAR", "ERROR AL ELIMINAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, oDatos); return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }
private ConfiguracionEN InformacionDelRegistro() { ConfiguracionEN oRegistroEN = null; try { oRegistroEN = new ConfiguracionEN(); oRegistroEN.IdConfiguracion = IdConfiguracion; oRegistroEN.RutaRespaldos = txtRutaRespaldosBD.Text.Trim(); oRegistroEN.RutaRespaldosDeExcel = txtRutaExportacionArchivosExcel.Text.Trim(); oRegistroEN.NivelesDeLaCuenta = Convert.ToInt32(txtNivelesDeLaCuentas.Text); oRegistroEN.PathMysSQLDump = txtMysqlDump.Text.Trim(); oRegistroEN.PathMySQL = txtPathMySQL.Text.Trim(); oRegistroEN.CuentaPrincipalDeBanco = txtCuentaPrincipalDeBanco.Text; oRegistroEN.NombreDelSistema = txtNombreDelSistema.Text; oRegistroEN.UtilidadOPerdidaDelEjercicio = txtUtilidadOPerdidaDelEjercicio.Text.Trim(); oRegistroEN.TiempoDeRespaldo = Convert.ToInt32(txtTiempoDeRespaldo.Text); oRegistroEN.oLoginEN = Program.oLoginEN; oRegistroEN.CuentaQueSeVaOcultarNivel = txtCuentaQueSeVaOcultarNivel.Text.Trim(); oRegistroEN.NivelDeLaCuentaAOcultar = Convert.ToInt32(cmbNivelDeLaCuentaAOcultar.Text); oRegistroEN.CuentaQueSeVaAMostrar = txtCuentaQueSeVaAMostrar.Text.Trim(); oRegistroEN.NivelDelaCuentaQueSeVaAMostrar = Convert.ToInt32(cmbNivelDelaCuentaQueSeVaAMostrar.Text); return(oRegistroEN); } catch (Exception ex) { MessageBox.Show(ex.Message, "Información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); return(oRegistroEN); } }
private void TraerInformacionDelRegistro() { try { ConfiguracionEN oRegistroEN = new ConfiguracionEN(); ConfiguracionLN oRegistroLN = new ConfiguracionLN(); oRegistroEN.IdConfiguracion = IdConfiguracion; if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion)) { DataRow Fila = oRegistroLN.TraerDatos().Rows[0]; txtRutaRespaldosBD.Text = Fila["RutaRespaldos"].ToString(); txtRutaExportacionArchivosExcel.Text = Fila["RutaRespaldosDeExcel"].ToString(); txtNivelesDeLaCuentas.Text = Fila["NivelesDeLaCuenta"].ToString(); txtMysqlDump.Text = Fila["PathMysSQLDump"].ToString(); txtPathMySQL.Text = Fila["PathMySQL"].ToString(); txtCuentaPrincipalDeBanco.Text = Fila["CuentaPrincipalDeBanco"].ToString(); txtNombreDelSistema.Text = Fila["NombreDelSistema"].ToString(); txtUtilidadOPerdidaDelEjercicio.Text = Fila["UtilidadOPerdidaDelEjercicio"].ToString(); txtTiempoDeRespaldo.Text = Fila["TiempoDeRespaldo"].ToString(); txtCuentaQueSeVaOcultarNivel.Text = Fila["CuentaQueSeVaOcultarNivel"].ToString(); cmbNivelDeLaCuentaAOcultar.Text = Fila["NivelDeLaCuentaAOcultar"].ToString(); txtCuentaQueSeVaAMostrar.Text = Fila["CuentaQueSeVaAMostrar"].ToString(); cmbNivelDelaCuentaQueSeVaAMostrar.Text = Fila["NivelDelaCuentaQueSeVaAMostrar"].ToString(); } } catch (Exception ex) { MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmdGuardar_Click(object sender, EventArgs e) { try { if (EvaluarSiHayRegistro()) { return; } ConfiguracionEN oRegistroEN = InformacionDelRegistro(); ConfiguracionLN oRegistroLN = new ConfiguracionLN(); if (oRegistroLN.Actualizar(oRegistroEN, Program.oDatosDeConexion)) { MessageBox.Show("Registro actualizado correctamente", "Guardar inforamción del registro", MessageBoxButtons.OK, MessageBoxIcon.Information); CargarInformacionDeLaConfiguracion(); } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Guardar Información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarInformacionDeLaConfiguracion() { try { ConfiguracionEN oRegistroEN = new ConfiguracionEN(); ConfiguracionLN oRegistroLN = new ConfiguracionLN(); oRegistroEN.IdConfiguracion = 1; if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion)) { DataRow Fila = oRegistroLN.TraerDatos().Rows[0]; Program.oConfiguracionEN.RutaRespaldos = Fila["RutaRespaldos"].ToString(); Program.oConfiguracionEN.RutaRespaldosDeExcel = Fila["RutaRespaldosDeExcel"].ToString(); Program.oConfiguracionEN.NivelesDeLaCuenta = Convert.ToInt32(Fila["NivelesDeLaCuenta"].ToString()); Program.oConfiguracionEN.PathMysSQLDump = Fila["PathMysSQLDump"].ToString(); Program.oConfiguracionEN.PathMySQL = Fila["PathMySQL"].ToString(); Program.oConfiguracionEN.CuentaPrincipalDeBanco = Fila["CuentaPrincipalDeBanco"].ToString(); Program.oConfiguracionEN.NombreDelSistema = Fila["NombreDelSistema"].ToString(); Program.oConfiguracionEN.UtilidadOPerdidaDelEjercicio = Fila["UtilidadOPerdidaDelEjercicio"].ToString(); Program.oConfiguracionEN.TiempoDeRespaldo = Convert.ToInt32(Fila["TiempoDeRespaldo"].ToString()); Program.oConfiguracionEN.NivelDeLaCuentaAOcultar = Convert.ToInt32(Fila["NivelDeLaCuentaAOcultar"].ToString()); Program.oConfiguracionEN.CuentaQueSeVaOcultarNivel = Fila["CuentaQueSeVaOcultarNivel"].ToString(); Program.oConfiguracionEN.CuentaQueSeVaAMostrar = Fila["CuentaQueSeVaAMostrar"].ToString(); Program.oConfiguracionEN.NivelDelaCuentaQueSeVaAMostrar = Convert.ToInt32(Fila["NivelDelaCuentaQueSeVaAMostrar"].ToString()); } } catch (Exception ex) { MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void TraerInformacionDelRegistro() { try { ConfiguracionEN oRegistroEN = new ConfiguracionEN(); ConfiguracionLN oRegistroLN = new ConfiguracionLN(); oRegistroEN.IdConfiguracion = IdConfiguracion; if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion)) { DataRow Fila = oRegistroLN.TraerDatos().Rows[0]; txtRutaRespaldosBD.Text = Fila["RutaRespaldos"].ToString(); txtRutaExportacionArchivosExcel.Text = Fila["RutaRespaldosDeExcel"].ToString(); txtMysqlDump.Text = Fila["PathMysSQLDump"].ToString(); txtPathMySQL.Text = Fila["PathMySQL"].ToString(); txtNombreDelSistema.Text = Fila["NombreDelSistema"].ToString(); txtTiempoDeRespaldo.Text = Fila["TiempoDeRespaldo"].ToString(); cmbPrecioPorDefecto.Text = string.Format("Precio ", Fila["PrecioPorDefecto"].ToString()); } } catch (Exception ex) { MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private string InformacionDelRegistro(ConfiguracionEN oRegistroEN) { string Cadena = @"IdConfiguracion: {0}, Configuracion: {1}"; Cadena = string.Format(Cadena, oRegistroEN.IdConfiguracion, oRegistroEN.RutaDeRespaldo); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
private string InformacionDelRegistro(ConfiguracionEN oRegistroEN) { string Cadena = @"IdConfiguracion: {0}, RutaRespaldos: {1}, RutaRespaldosDeExcel: {2}, NivelesDeLaCuenta: {3}, PathMysSQLDump: {4}, PathMySQL: {5}"; Cadena = string.Format(Cadena, oRegistroEN.IdConfiguracion, oRegistroEN.RutaRespaldos, oRegistroEN.RutaRespaldosDeExcel, oRegistroEN.NivelesDeLaCuenta, oRegistroEN.PathMysSQLDump, oRegistroEN.PathMySQL); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
private string InformacionDelRegistro(ConfiguracionEN oRegistroEN) { string Cadena = @"IdConfiguracion: {0}, RutaRespaldos: {1}, RutaRespaldosDeExcel: {2}, PathMysSQLDump: {3}, PathMySQL: {4},NombreDelSistema: {5}, PrecioPorDefecto: {6}"; Cadena = string.Format(Cadena, oRegistroEN.IdConfiguracion, oRegistroEN.RutaRespaldos, oRegistroEN.RutaRespaldosDeExcel, oRegistroEN.PathMysSQLDump, oRegistroEN.PathMySQL, oRegistroEN.NombreDelSistema, oRegistroEN.PrecioPorDefecto); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
private string InformacionDelRegistro(ConfiguracionEN oRegistroEN) { string Cadena = @"IdConfiguracion: {0}, RutaRespaldos: {1}, RutaRespaldosDeExcel: {2}, NivelesDeLaCuenta: {3}, PathMysSQLDump: {4}, PathMySQL: {5}, CuentaPrincipalDeBanco: {6}, NombreDelSistema: {7}, UtilidadOPerdidaDelEjercicio: {8},NivelDeLaCuentaAOcultar: {9},CuentaQueSeVaOcultarNivel,{10},NivelDelaCuentaQueSeVaAMostrar: {11}, CuentaQueSeVaAMostrar: {12}"; Cadena = string.Format(Cadena, oRegistroEN.IdConfiguracion, oRegistroEN.RutaRespaldos, oRegistroEN.RutaRespaldosDeExcel, oRegistroEN.NivelesDeLaCuenta, oRegistroEN.PathMysSQLDump, oRegistroEN.PathMySQL, oRegistroEN.CuentaPrincipalDeBanco, oRegistroEN.NombreDelSistema, oRegistroEN.UtilidadOPerdidaDelEjercicio, oRegistroEN.NivelDeLaCuentaAOcultar, oRegistroEN.CuentaQueSeVaOcultarNivel, oRegistroEN.NivelDelaCuentaQueSeVaAMostrar, oRegistroEN.CuentaQueSeVaAMostrar); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
public bool Actualizar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = @"UPDATE configuracion SET RutaRespaldos = @RutaRespaldos, RutaRespaldosDeExcel = @RutaRespaldosDeExcel, NivelesDeLaCuenta = @NivelesDeLaCuenta, PathMysSQLDump = @PathMysSQLDump, PathMySQL= @PathMySQL WHERE IdConfiguracion = @IdConfiguracion;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdConfiguracion", MySqlDbType.Int32)).Value = oRegistroEN.IdConfiguracion; Comando.Parameters.Add(new MySqlParameter("@RutaRespaldos", MySqlDbType.VarChar, oRegistroEN.RutaRespaldos.Trim().Length)).Value = oRegistroEN.RutaRespaldos.Trim(); Comando.Parameters.Add(new MySqlParameter("@RutaRespaldosDeExcel", MySqlDbType.VarChar, oRegistroEN.RutaRespaldosDeExcel.Trim().Length)).Value = oRegistroEN.RutaRespaldosDeExcel.Trim(); Comando.Parameters.Add(new MySqlParameter("@NivelesDeLaCuenta", MySqlDbType.Int32)).Value = oRegistroEN.NivelesDeLaCuenta; Comando.Parameters.Add(new MySqlParameter("@PathMysSQLDump", MySqlDbType.VarChar, oRegistroEN.PathMysSQLDump.Trim().Length)).Value = oRegistroEN.PathMysSQLDump.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySQL", MySqlDbType.VarChar, oRegistroEN.PathMySQL.Trim().Length)).Value = oRegistroEN.PathMySQL.Trim(); Comando.ExecuteNonQuery(); DescripcionDeOperacion = string.Format("El registro fue Actualizado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ACTUALIZAR", "INFORMACIÓN DE LA CONFIGURACIÓN ACTUALIZADA", "CORRECTA", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeOperacion = string.Format("Se produjo el seguiente error: '{2}' al actualizar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ACTUALIZAR", "ERROR AL ACTUALIZAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
public bool ListadoPorIdentificador(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { if (oConfiguracionAD.ListadoPorIdentificador(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oConfiguracionAD.Error; return(false); } }
public bool Agregar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { if (oConfiguracionAD.Agregar(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oConfiguracionAD.Error; return(false); } }
public bool ListadoParaReportes(ConfiguracionEN oREgistroEN, DatosDeConexionEN oDatos) { if (oConfiguracionAD.ListadoParaReportes(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oConfiguracionAD.Error; return(false); } }
public bool Eliminar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = @"Delete from Configuracion where IdConfiguracion = @IdConfiguracion;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdConfiguracion", MySqlDbType.Int32)).Value = oRegistroEN.IdConfiguracion; Comando.ExecuteNonQuery(); DescripcionDeOperacion = string.Format("El registro fue Eliminado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ELIMINAR", "INFORMACIÓN DE LA CONFIGURACIÓN ELIMINADA", "CORRECTA", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeOperacion = string.Format("Se produjo el seguiente error: '{2}' al eliminar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ELIMINAR", "ERROR AL ELIMINAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
public bool Actualizar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { if (string.IsNullOrEmpty(oRegistroEN.IdConfiguracion.ToString()) || oRegistroEN.IdConfiguracion == 0) { this.Error = @"Se debe seleccionar un elemento de la lista"; return(false); } if (oConfiguracionAD.Actualizar(oRegistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oConfiguracionAD.Error; return(false); } }
private TransaccionesEN InformacionDeLaTransaccion(ConfiguracionEN oConfiguracionEN, string TipoDeOperacion, string Descripcion, string Estado) { TransaccionesEN oRegistroEN = new TransaccionesEN(); oRegistroEN.IdRegistro = oConfiguracionEN.IdConfiguracion; oRegistroEN.Modelo = "ConfiguracionAD"; oRegistroEN.Tabla = "Configuracion"; oRegistroEN.TipoDeOperacion = TipoDeOperacion; oRegistroEN.Estado = Estado; oRegistroEN.IP = oConfiguracionEN.oLoginEN.NumeroIP; oRegistroEN.IdUsuario = oConfiguracionEN.oLoginEN.IdUsuario; oRegistroEN.IdUsuarioAPrueva = oConfiguracionEN.oLoginEN.IdUsuario; oRegistroEN.DescripcionDelUsuario = DescripcionDeLaOperacion; oRegistroEN.DescripcionInterna = Descripcion; oRegistroEN.nombredelequipo = oConfiguracionEN.oLoginEN.NombreDelEquipo; return(oRegistroEN); }
public bool ListadoParaCombos(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = string.Format(@"Select IdConfiguracion, RutaRespaldos, RutaRespaldosDeExcel,NivelesDeLaCuenta,PathMysSQLDump,PathMySQL,CuentaPrincipalDeBanco,NombreDelSistema,UtilidadOPerdidaDelEjercicio, TiempoDeRespaldo,NivelDeLaCuentaAOcultar,CuentaQueSeVaOcultarNivel,NivelDelaCuentaQueSeVaAMostrar, CuentaQueSeVaAMostrar from configuracion where IdConfiguracion > 0 {0} {1}; ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; } }
public bool ListadoParaReportes(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = string.Format(@"Select IdConfiguracion, RutaRespaldos, RutaRespaldosDeExcel,NivelesDeLaCuenta,PathMysSQLDump,PathMySQL from configuracion where IdConfiguracion > 0 {0} {1} ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; } }
public bool ListadoPorIdentificador(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = string.Format(@"Select IdConfiguracion, RutaRespaldos, RutaRespaldosDeExcel,PathMysSQLDump,PathMySQL,NombreDelSistema,TiempoDeRespaldo,PrecioPorDefecto from configuracion where IdConfiguracion = {0} ", oRegistroEN.IdConfiguracion); Comando.CommandText = Consultas; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); return(true); } catch (Exception ex) { this.Error = ex.Message; return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; } }
public bool Agregar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = @"insert into configuracion (RutaRespaldos, RutaRespaldosDeExcel,NivelesDeLaCuenta,PathMysSQLDump,PathMySQL) values (@RutaRespaldos, @RutaRespaldosDeExcel,@NivelesDeLaCuenta, @PathMysSQLDump, @PathMySQL); Select last_insert_id() as 'ID';"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@RutaRespaldos", MySqlDbType.VarChar, oRegistroEN.RutaRespaldos.Trim().Length)).Value = oRegistroEN.RutaRespaldos.Trim(); Comando.Parameters.Add(new MySqlParameter("@RutaRespaldosDeExcel", MySqlDbType.VarChar, oRegistroEN.RutaRespaldosDeExcel.Trim().Length)).Value = oRegistroEN.RutaRespaldosDeExcel.Trim(); Comando.Parameters.Add(new MySqlParameter("@NivelesDeLaCuenta", MySqlDbType.Int32)).Value = oRegistroEN.NivelesDeLaCuenta; Comando.Parameters.Add(new MySqlParameter("@PathMysSQLDump", MySqlDbType.VarChar, oRegistroEN.PathMysSQLDump.Trim().Length)).Value = oRegistroEN.PathMysSQLDump.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySQL", MySqlDbType.VarChar, oRegistroEN.PathMySQL.Trim().Length)).Value = oRegistroEN.PathMySQL.Trim(); Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); oRegistroEN.IdConfiguracion = Convert.ToInt32(DT.Rows[0].ItemArray[0].ToString()); DescripcionDeOperacion = string.Format("El registro fue Insertado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "AGREGAR", "INFORMACIÓN DE LA CONFIGURACIÓN AGREGADA CORRECTAMENTE", "CORRECTA", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(true); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeOperacion = string.Format("Se produjo el seguiente error: '{2}' al insertar el registro. {0} {1} ", Environment.NewLine, InformacionDelRegistro(oRegistroEN), ex.Message); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.idUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "AGREGAR", "ERROR AL AGREGAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeOperacion, oRegistroEN.oLoginEN.idUsuario, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
public bool Actualizar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = @"update configuracion set RutaDeRespaldo = @RutaDeRespaldo, RutaDeRespaldoDeEcxel = @RutaDeRespaldoDeEcxel, PathMySqlDump = @PathMySqlDump, PathMySql = @PathMySql, NombreDelSistema = @NombreDelSistema, TiempoDeRespaldo = @TiempoDeRespaldo, ImpuestoDeValorAgregado = @ImpuestoDeValorAgregado, CorreoDelRemitente = @CorreoDelRemitente, ServicioSmtp = @ServicioSmtp, ContrasenaDelRemitente = @ContrasenaDelRemitente, PuertoDelServidor = @PuertoDelServidor, AsuntoDelCorreo = @AsuntoDelCorreo, MensageDelCorreo = @MensageDelCorreo where IdConfiguracion = @IdConfiguracion;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@IdConfiguracion", MySqlDbType.Int32)).Value = oRegistroEN.IdConfiguracion; Comando.Parameters.Add(new MySqlParameter("@RutaDeRespaldo", MySqlDbType.VarChar, oRegistroEN.RutaDeRespaldo.Trim().Length)).Value = oRegistroEN.RutaDeRespaldo.Trim(); Comando.Parameters.Add(new MySqlParameter("@RutaDeRespaldoDeEcxel", MySqlDbType.VarChar, oRegistroEN.RutaRespaldosDeExcel.Trim().Length)).Value = oRegistroEN.RutaRespaldosDeExcel.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySqlDump", MySqlDbType.VarChar, oRegistroEN.PathMySQLDump.Trim().Length)).Value = oRegistroEN.PathMySQLDump.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySql", MySqlDbType.VarChar, oRegistroEN.PathMySQL.Trim().Length)).Value = oRegistroEN.PathMySQL.Trim(); Comando.Parameters.Add(new MySqlParameter("@NombreDelSistema", MySqlDbType.VarChar, oRegistroEN.NombreDelSistema.Trim().Length)).Value = oRegistroEN.NombreDelSistema.Trim(); Comando.Parameters.Add(new MySqlParameter("@TiempoDeRespaldo", MySqlDbType.Int32)).Value = oRegistroEN.TiempoDeRespaldo; Comando.Parameters.Add(new MySqlParameter("@ImpuestoDeValorAgregado", MySqlDbType.Decimal)).Value = oRegistroEN.ImpuestoDeValorAgrgado; Comando.Parameters.Add(new MySqlParameter("@CorreoDelRemitente", MySqlDbType.VarChar, oRegistroEN.CorreoDelRemitente.Trim().Length)).Value = oRegistroEN.CorreoDelRemitente.Trim(); Comando.Parameters.Add(new MySqlParameter("@ServicioSmtp", MySqlDbType.VarChar, oRegistroEN.ServicioSmtp.Trim().Length)).Value = oRegistroEN.ServicioSmtp.Trim(); Comando.Parameters.Add(new MySqlParameter("@ContrasenaDelRemitente", MySqlDbType.VarChar, oRegistroEN.ContrasenaDelRemitente.Trim().Length)).Value = oRegistroEN.ContrasenaDelRemitente.Trim(); Comando.Parameters.Add(new MySqlParameter("@PuertoDelServidor", MySqlDbType.Int32)).Value = oRegistroEN.PuertoDelServidor; Comando.Parameters.Add(new MySqlParameter("@AsuntoDelCorreo", MySqlDbType.VarChar, oRegistroEN.AsuntoDelCorreo.Trim().Length)).Value = oRegistroEN.AsuntoDelCorreo.Trim(); Comando.Parameters.Add(new MySqlParameter("@MensageDelCorreo", MySqlDbType.VarChar, oRegistroEN.MensageDelCorreo.Trim().Length)).Value = oRegistroEN.MensageDelCorreo.Trim(); Comando.ExecuteNonQuery(); DescripcionDeLaOperacion = string.Format("El registro fue Actualizado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ACTUALIZAR", "INFORMACIÓN DE LA CONFIGURACIÓN ACTUALIZADA", "CORRECTA", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, 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); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "ACTUALIZAR", "ERROR AL ACTUALIZAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, oDatos); return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }
public bool Agregar(ConfiguracionEN oRegistroEN, DatosDeConexionEN oDatos) { try { InicializarVariablesGlovales(oDatos); Consultas = @"insert into configuracion (RutaDeRespaldo, RutaDeRespaldoDeEcxel, PathMySqlDump, PathMySql, NombreDelSistema, TiempoDeRespaldo, ImpuestoDeValorAgregado, CorreoDelRemitente, ServicioSmtp, ContrasenaDelRemitente, PuertoDelServidor, AsuntoDelCorreo, MensageDelCorreo) value (@RutaDeRespaldo, @RutaDeRespaldoDeEcxel, @PathMySqlDump, @PathMySql, @NombreDelSistema, @TiempoDeRespaldo, @ImpuestoDeValorAgregado, @CorreoDelRemitente, @ServicioSmtp, @ContrasenaDelRemitente, @PuertoDelServidor, @AsuntoDelCorreo, @MensageDelCorreo); select last_insert_id() as 'ID';"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@RutaDeRespaldo", MySqlDbType.VarChar, oRegistroEN.RutaDeRespaldo.Trim().Length)).Value = oRegistroEN.RutaDeRespaldo.Trim(); Comando.Parameters.Add(new MySqlParameter("@RutaDeRespaldoDeEcxel", MySqlDbType.VarChar, oRegistroEN.RutaRespaldosDeExcel.Trim().Length)).Value = oRegistroEN.RutaRespaldosDeExcel.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySqlDump", MySqlDbType.VarChar, oRegistroEN.PathMySQLDump.Trim().Length)).Value = oRegistroEN.PathMySQLDump.Trim(); Comando.Parameters.Add(new MySqlParameter("@PathMySql", MySqlDbType.VarChar, oRegistroEN.PathMySQL.Trim().Length)).Value = oRegistroEN.PathMySQL.Trim(); Comando.Parameters.Add(new MySqlParameter("@NombreDelSistema", MySqlDbType.VarChar, oRegistroEN.NombreDelSistema.Trim().Length)).Value = oRegistroEN.NombreDelSistema.Trim(); Comando.Parameters.Add(new MySqlParameter("@TiempoDeRespaldo", MySqlDbType.Int32)).Value = oRegistroEN.TiempoDeRespaldo; Comando.Parameters.Add(new MySqlParameter("@ImpuestoDeValorAgregado", MySqlDbType.Decimal)).Value = oRegistroEN.ImpuestoDeValorAgrgado; Comando.Parameters.Add(new MySqlParameter("@CorreoDelRemitente", MySqlDbType.VarChar, oRegistroEN.CorreoDelRemitente.Trim().Length)).Value = oRegistroEN.CorreoDelRemitente.Trim(); Comando.Parameters.Add(new MySqlParameter("@ServicioSmtp", MySqlDbType.VarChar, oRegistroEN.ServicioSmtp.Trim().Length)).Value = oRegistroEN.ServicioSmtp.Trim(); Comando.Parameters.Add(new MySqlParameter("@ContrasenaDelRemitente", MySqlDbType.VarChar, oRegistroEN.ContrasenaDelRemitente.Trim().Length)).Value = oRegistroEN.ContrasenaDelRemitente.Trim(); Comando.Parameters.Add(new MySqlParameter("@PuertoDelServidor", MySqlDbType.Int32)).Value = oRegistroEN.PuertoDelServidor; Comando.Parameters.Add(new MySqlParameter("@AsuntoDelCorreo", MySqlDbType.VarChar, oRegistroEN.AsuntoDelCorreo.Trim().Length)).Value = oRegistroEN.AsuntoDelCorreo.Trim(); Comando.Parameters.Add(new MySqlParameter("@MensageDelCorreo", MySqlDbType.VarChar, oRegistroEN.MensageDelCorreo.Trim().Length)).Value = oRegistroEN.MensageDelCorreo.Trim(); InicializarAdaptador(); oRegistroEN.IdConfiguracion = Convert.ToInt32(DT.Rows[0].ItemArray[0].ToString()); DescripcionDeLaOperacion = string.Format("El registro fue insertado correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "AGREGAR", "INFORMACIÓN DE LA CONFIGURACIÓN AGREGADA CORRECTAMENTE", "CORRECTA", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, oDatos); /*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); oTransaccionesAD.Agregar(oRegistroEN.oLoginEN.IdUsuario, oRegistroEN.oLoginEN.NumeroIP, oRegistroEN.IdConfiguracion, "AGREGAR", "ERROR AL AGREGAR LA INFORMACIÓN DE LA CONFIGURACIÓN", "ERROR", DescripcionDeLaOperacion, oRegistroEN.oLoginEN.IdUsuario, oDatos); /*//Agregamos la Transacción.... * TransaccionesEN oTransacciones = InformacionDeLaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "ERROR"); * oTransaccionesAD.Agregar(oTransacciones, oDatos);*/ return(false); } finally { FinalizarConexion(); oTransaccionesAD = null; } }