private LaboratorioEN InformacionDelLaboratorio(DataGridViewRow Fila) { LaboratorioEN oRegistroEN = new LaboratorioEN(); oRegistroEN.Codigo = GenerarCodigoDelLaboratorio(); oRegistroEN.idLaboratorio = 0; oRegistroEN.Nombre = Fila.Cells[1].Value.ToString().Trim(); oRegistroEN.Direccion = Fila.Cells[2].Value.ToString().Trim(); oRegistroEN.NoRUC = Fila.Cells[3].Value.ToString().Trim(); oRegistroEN.SitioWeb = Fila.Cells[4].Value.ToString().Trim(); oRegistroEN.Telefono = Fila.Cells[5].Value.ToString().Trim(); oRegistroEN.Movil = Fila.Cells[6].Value.ToString().Trim(); oRegistroEN.Observaciones = Fila.Cells[7].Value.ToString().Trim(); oRegistroEN.Estado = "ACTIVO"; oRegistroEN.FechaDeCumpleanos = ""; oRegistroEN.Messenger = ""; oRegistroEN.Twitter = ""; oRegistroEN.Facebook = ""; oRegistroEN.Skype = ""; oRegistroEN.Foto = null; oRegistroEN.oLoginEN = Program.oLoginEN; oRegistroEN.Correo = ""; oRegistroEN.IdUsuarioDeCreacion = Program.oLoginEN.idUsuario; oRegistroEN.IdUsuarioDeModificacion = Program.oLoginEN.idUsuario; oRegistroEN.FechaDeCreacion = System.DateTime.Now; oRegistroEN.FechaDeModificacion = System.DateTime.Now; return(oRegistroEN); }
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 oLaboratorio, a); /**/ oLaboratorio[a - 1] = new LaboratorioEN(); oLaboratorio[a - 1].idLaboratorio = Convert.ToInt32(Fila.Cells["idLaboratorio"].Value); oLaboratorio[a - 1].Nombre = Fila.Cells["Nombre"].Value.ToString(); oLaboratorio[a - 1].Codigo = Fila.Cells["Codigo"].Value.ToString(); oLaboratorio[a - 1].Direccion = Fila.Cells["Direccion"].Value.ToString(); oLaboratorio[a - 1].NoRUC = Fila.Cells["NoRUC"].Value.ToString(); oLaboratorio[a - 1].SitioWeb = Fila.Cells["SitioWeb"].Value.ToString(); oLaboratorio[a - 1].Telefono = Fila.Cells["Telefono"].Value.ToString(); oLaboratorio[a - 1].Movil = Fila.Cells["Movil"].Value.ToString(); oLaboratorio[a - 1].Observaciones = Fila.Cells["Observaciones"].Value.ToString(); oLaboratorio[a - 1].Correo = Fila.Cells["Correo"].Value.ToString(); oLaboratorio[a - 1].FechaDeCumpleanos = Fila.Cells["FechaDeCumpleanos"].Value.ToString(); oLaboratorio[a - 1].Messenger = Fila.Cells["Messenger"].Value.ToString(); oLaboratorio[a - 1].Skype = Fila.Cells["Skype"].Value.ToString(); oLaboratorio[a - 1].Twitter = Fila.Cells["Twitter"].Value.ToString(); oLaboratorio[a - 1].Facebook = Fila.Cells["Facebook"].Value.ToString(); oLaboratorio[a - 1].Estado = Fila.Cells["Estado"].Value.ToString(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Seleccionar registros", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { AgregarRegistrosAlDTUsuario(); this.Cursor = Cursors.Default; this.Close(); } }
public bool Eliminar(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = @"Delete from Laboratorio Where idLaboratorio = @idLaboratorio;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@idLaboratorio", MySqlDbType.Int32)).Value = oRegistroEN.idLaboratorio; Comando.ExecuteNonQuery(); DescripcionDeOperacion = string.Format("El registro fue Eliminado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Eliminar", "Elminar Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTran, 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); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Eliminar", "Eliminar Registro", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
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; } LaboratorioEN oRegistroEN = InformacionDelRegistro(); LaboratorioLN oRegistroLN = new LaboratorioLN(); if (Controles.IsNullOEmptyElControl(txtIdProveedorLaboratorio) == false) { EliminarRegistroDelaVinculacion(); } if (oRegistroLN.Eliminar(oRegistroEN, Program.oDatosDeConexion)) { EvaluarErrorParaMensajeAPantalla(oRegistroLN.Error, "Eliminar"); oRegistroEN = null; oRegistroLN = null; this.Cursor = Cursors.Default; 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; } }
public bool ListadoParaReportes(LaboratorioEN 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 idLaboratorio, Codigo, Nombre, Direccion, NoRUC, SitioWeb, Telefono, Movil, Observaciones, Correo, FechaDeCumpleanos, Messenger, Skype, Twitter, Facebook, Estado, Foto, p.idUsuarioDeCreacion, p.FechaDeCreacion, u.Nombre as 'UsuarioDecreacion', p.idUsuarioModificacion, p.FechaDeModificacion , u1.Nombre as 'UsuarioDeModificacion' from Laboratorio as p inner join usuario as u on u.idUsuario = p.idUsuarioDeCreacion left join usuario as u1 on u1.idUsuario = p.idUsuarioModificacion where p.idLaboratorio > 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 AgregarUtilizandoLaMismaConexion(LaboratorioEN oREgistroEN, DatosDeConexionEN oDatos) { if (oLaboratorioAD.AgregarUtilizandoLaMismaConexion(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oLaboratorioAD.Error; return(false); } }
public bool Listado(LaboratorioEN oREgistroEN, DatosDeConexionEN oDatos) { if (oLaboratorioAD.Listado(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oLaboratorioAD.Error; return(false); } }
private void tsbRegistroLocal_Click(object sender, EventArgs e) { try { oLaboratorio = InformacionDelRegistro(); VariableLocal = true; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Registro local", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool ValidarSiElRegistroEstaVinculado(LaboratorioEN oREgistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { if (oLaboratorioAD.ValidarSiElRegistroEstaVinculado(oREgistroEN, oDatos, TipoDeOperacion)) { Error = oLaboratorioAD.Error; return(true); } else { Error = string.Empty; return(false); } }
public bool GenerarCodigoDelLaboratorio(LaboratorioEN oREgistroEN, DatosDeConexionEN oDatos) { if (oLaboratorioAD.GenerarCodigoDelLaboratorio(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oLaboratorioAD.Error; return(false); } }
private string InformacionDelRegistro(LaboratorioEN oRegistroEN) { string Cadena = @"idLaboratorio: {0}, Codigo: {1}, Nombre: {2}, Direccion: {3}, NoRUC: {4}, SitioWeb: {5}, Telefono: {6}, Movil: {7}, Observaciones: {8}, Correo: {9}, FechaDeCumpleanos: {10}, Messenger: {11}, Skype: {12}, Twitter: {13}, Facebook: {14}, Estado: {15},idUsuarioDeCreacion: {16}, FechaDeCreacion: {17}, idUsuarioModificacion: {18}, FechaDeModificacion: {19}"; Cadena = string.Format(Cadena, oRegistroEN.idLaboratorio, oRegistroEN.Codigo, oRegistroEN.Nombre, oRegistroEN.Direccion, oRegistroEN.NoRUC, oRegistroEN.SitioWeb, oRegistroEN.Telefono, oRegistroEN.Movil, oRegistroEN.Observaciones, oRegistroEN.Correo, oRegistroEN.FechaDeCumpleanos, oRegistroEN.Messenger, oRegistroEN.Skype, oRegistroEN.Twitter, oRegistroEN.Facebook, oRegistroEN.Estado, oRegistroEN.IdUsuarioDeCreacion, oRegistroEN.FechaDeCreacion, oRegistroEN.IdUsuarioDeModificacion, oRegistroEN.FechaDeModificacion); Cadena = Cadena.Replace(",", Environment.NewLine); return(Cadena); }
private void GenerarCodigoDelLaboratorio() { try { LaboratorioEN oRegistroEN = new LaboratorioEN(); LaboratorioLN oRegistroLN = new LaboratorioLN(); if (oRegistroLN.GenerarCodigoDelLaboratorio(oRegistroEN, Program.oDatosDeConexion)) { txtCodigo.Text = oRegistroEN.Codigo; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Generar codigo Automatico", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool ListadoParaCombos(LaboratorioEN 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 idLaboratorio, concat(Codigo, ' - ', Nombre) as 'NombreDelLaboratorio' from Laboratorio as p where p.idLaboratorio > 0 {0} {1} ; ", oRegistroEN.Where, oRegistroEN.OrderBy); Comando.CommandText = Consultas; System.Diagnostics.Debug.Print("Consultas de Tipo de transaccion: " + 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 GenerarCodigoDelLaboratorio(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos) { try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = "Select GenerarCodigoDelLaboratorio() as 'Codigo';"; Comando.CommandText = Consultas; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); oRegistroEN.Codigo = DT.Rows[0].ItemArray[0].ToString(); 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; } }
private void LLenarListado() { try { this.Cursor = Cursors.WaitCursor; LaboratorioEN oRegistrosEN = new LaboratorioEN(); LaboratorioLN oRegistrosLN = new LaboratorioLN(); oRegistrosEN.Where = WhereDinamico(); if (oRegistrosLN.Listado(oRegistrosEN, Program.oDatosDeConexion)) { dgvLista.Columns.Clear(); System.Diagnostics.Debug.Print(oRegistrosLN.TraerDatos().Rows.Count.ToString()); if (ActivarFiltros == true) { dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistrosLN.TraerDatos()); } else { dgvLista.DataSource = oRegistrosLN.TraerDatos(); } FormatearDGV(); this.dgvLista.ClearSelection(); tsbNoRegistros.Text = "No. Registros: " + oRegistrosLN.TotalRegistros().ToString(); } else { throw new ArgumentException(oRegistrosLN.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 Eliminar(LaboratorioEN oREgistroEN, DatosDeConexionEN oDatos) { if (string.IsNullOrEmpty(oREgistroEN.idLaboratorio.ToString()) || oREgistroEN.idLaboratorio == 0) { this.Error = @"Se debe de seleccionar un elemento de la lista"; return(false); } if (oLaboratorioAD.Eliminar(oREgistroEN, oDatos)) { Error = string.Empty; return(true); } else { Error = oLaboratorioAD.Error; return(false); } }
private TransaccionesEN InformacionDelaTransaccion(LaboratorioEN oLaboratorio, String TipoDeOperacion, String Descripcion, String Estado) { TransaccionesEN oRegistroEN = new TransaccionesEN(); oRegistroEN.idregistro = oLaboratorio.idLaboratorio; oRegistroEN.Modelo = "LaboratorioAD"; oRegistroEN.Modulo = "General"; oRegistroEN.Tabla = "Laboratorio"; oRegistroEN.tipodeoperacion = TipoDeOperacion; oRegistroEN.Estado = Estado; oRegistroEN.ip = oLaboratorio.oLoginEN.NumeroIP; oRegistroEN.idusuario = oLaboratorio.oLoginEN.idUsuario; oRegistroEN.idusuarioaprueba = oLaboratorio.oLoginEN.idUsuario; oRegistroEN.descripciondelusuario = DescripcionDeOperacion; oRegistroEN.descripcioninterna = Descripcion; oRegistroEN.NombreDelEquipo = oLaboratorio.oLoginEN.NombreDelComputador; return(oRegistroEN); }
private string GenerarCodigoDelLaboratorio() { try { string Codigo = ""; LaboratorioEN oRegistroEN = new LaboratorioEN(); LaboratorioLN oRegistroLN = new LaboratorioLN(); if (oRegistroLN.GenerarCodigoDelLaboratorio(oRegistroEN, Program.oDatosDeConexion)) { Codigo = oRegistroEN.Codigo; } return(Codigo); } catch (Exception ex) { MessageBox.Show(ex.Message, "Generar codigo Automatico", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(""); } }
private void dgvLista_DoubleClick(object sender, EventArgs e) { if (ActivarFiltros == 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 oLaboratorio, a); oLaboratorio[a - 1] = new LaboratorioEN(); oLaboratorio[a - 1].idLaboratorio = Convert.ToInt32(Fila.Cells["idLaboratorio"].Value); oLaboratorio[a - 1].Nombre = Fila.Cells["Nombre"].Value.ToString(); oLaboratorio[a - 1].Codigo = Fila.Cells["Codigo"].Value.ToString(); oLaboratorio[a - 1].Direccion = Fila.Cells["Direccion"].Value.ToString(); oLaboratorio[a - 1].NoRUC = Fila.Cells["NoRUC"].Value.ToString(); oLaboratorio[a - 1].SitioWeb = Fila.Cells["SitioWeb"].Value.ToString(); oLaboratorio[a - 1].Telefono = Fila.Cells["Telefono"].Value.ToString(); oLaboratorio[a - 1].Movil = Fila.Cells["Movil"].Value.ToString(); oLaboratorio[a - 1].Observaciones = Fila.Cells["Observaciones"].Value.ToString(); oLaboratorio[a - 1].Correo = Fila.Cells["Correo"].Value.ToString(); oLaboratorio[a - 1].FechaDeCumpleanos = Fila.Cells["FechaDeCumpleanos"].Value.ToString(); oLaboratorio[a - 1].Messenger = Fila.Cells["Messenger"].Value.ToString(); oLaboratorio[a - 1].Skype = Fila.Cells["Skype"].Value.ToString(); oLaboratorio[a - 1].Twitter = Fila.Cells["Twitter"].Value.ToString(); oLaboratorio[a - 1].Facebook = Fila.Cells["Facebook"].Value.ToString(); oLaboratorio[a - 1].Estado = Fila.Cells["Estado"].Value.ToString(); } } this.Cursor = Cursors.Default; this.Close(); } }
private LaboratorioEN InformacionDelRegistro() { LaboratorioEN oRegistroEN = new LaboratorioEN(); oRegistroEN.idLaboratorio = Convert.ToInt32((txtIdentificador.Text.Length > 0 ? txtIdentificador.Text : "0")); oRegistroEN.Nombre = txtNombre.Text.Trim(); oRegistroEN.Codigo = txtCodigo.Text.Trim(); oRegistroEN.Direccion = txtDireccion.Text.Trim(); oRegistroEN.Telefono = txtTelefono.Text.Trim(); oRegistroEN.Movil = txtMovil.Text.Trim(); oRegistroEN.Observaciones = txtObservaciones.Text.Trim(); oRegistroEN.Correo = txtCorreo.Text.Trim(); oRegistroEN.FechaDeCumpleanos = txtFechaDeCumpleanos.Text.Trim(); oRegistroEN.Messenger = txtMessenger.Text.Trim(); oRegistroEN.Skype = txtSkype.Text.Trim(); oRegistroEN.Twitter = txtTwitter.Text.Trim(); oRegistroEN.Facebook = txtFaceBook.Text.Trim(); oRegistroEN.Estado = cmbEstado.Text.Trim(); oRegistroEN.NoRUC = txtNoRUC.Text.Trim(); oRegistroEN.SitioWeb = txtSitioWeb.Text.Trim(); if (pbxImagen.Image != null) { oRegistroEN.AFoto = Imagenes.ProcesarImagenToByte((Bitmap)(pbxImagen.Image)); } else { oRegistroEN.AFoto = null; } //partes generales. oRegistroEN.oLoginEN = Program.oLoginEN; oRegistroEN.IdUsuarioDeCreacion = Program.oLoginEN.idUsuario; oRegistroEN.IdUsuarioDeModificacion = Program.oLoginEN.idUsuario; oRegistroEN.FechaDeCreacion = System.DateTime.Now; oRegistroEN.FechaDeModificacion = System.DateTime.Now; return(oRegistroEN); }
public bool AgregarUtilizandoLaMismaConexion(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); MySqlTransaction oMySqlTransaction; oMySqlTransaction = Cnn.BeginTransaction(); try { String mensaje = ""; string Errores = string.Empty; //Debemos agrear la Entidad Correspondiente EntidadEN oEntidadEN = new EntidadEN(); oEntidadEN.oTipoDeEntidadEN.Nombre = "Laboratorio"; oEntidadEN.oTipoDeEntidadEN.NombreInterno = "Laboratorio"; oEntidadEN.oLoginEN = oRegistroEN.oLoginEN; oEntidadEN.IdUsuarioDeCreacion = oRegistroEN.oLoginEN.idUsuario; oEntidadEN.IdUsuarioDeModificacion = oRegistroEN.oLoginEN.idUsuario; oEntidadEN.FechaDeCreacion = oRegistroEN.FechaDeCreacion; oEntidadEN.FechaDeModificacion = oRegistroEN.FechaDeModificacion; EntidadAD oEntidadAD = new EntidadAD(); if (oEntidadAD.Agregar(oEntidadEN, oDatos, ref Cnn, ref oMySqlTransaction)) { oRegistroEN.idLaboratorio = oEntidadEN.idEntidad; Errores = EvaluarTextoError(Errores, "GUARDAR", oEntidadAD.Error); } else { mensaje = String.Format("Error : '{1}', {0} producido al intentar guardar la información en la Entidad. ", Environment.NewLine, oEntidadAD.Error); throw new System.ArgumentException(mensaje); } if (Agregar(oRegistroEN, oDatos, ref Cnn, ref oMySqlTransaction)) { Errores = EvaluarTextoError(Errores, "GUARDAR", this.Error); } else { mensaje = String.Format("Error : '{1}', {0} producido al intentar guardar la información del Laboratorio. ", Environment.NewLine, this.Error); throw new System.ArgumentException(mensaje); } this.Error = Errores; oEntidadEN = null; oEntidadAD = null; oMySqlTransaction.Commit(); return(true); } catch (Exception ex) { this.Error = ex.Message; oMySqlTransaction.Rollback(); DescripcionDeOperacion = 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 oTran = InformacionDelaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
public bool Agregar(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.StoredProcedure; Consultas = @"AgregarInformacionDelLaboratorio"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@idLaboratorio_", MySqlDbType.Int32)).Value = oRegistroEN.idLaboratorio; Comando.Parameters.Add(new MySqlParameter("@Codigo_", MySqlDbType.VarChar, oRegistroEN.Codigo.Trim().Length)).Value = oRegistroEN.Codigo.Trim(); Comando.Parameters.Add(new MySqlParameter("@Nombre_", MySqlDbType.VarChar, oRegistroEN.Nombre.Trim().Length)).Value = oRegistroEN.Nombre.Trim(); Comando.Parameters.Add(new MySqlParameter("@Direccion_", MySqlDbType.VarChar, oRegistroEN.Direccion.Trim().Length)).Value = oRegistroEN.Direccion.Trim(); Comando.Parameters.Add(new MySqlParameter("@NoRUC_", MySqlDbType.VarChar, oRegistroEN.NoRUC.Trim().Length)).Value = oRegistroEN.NoRUC.Trim(); Comando.Parameters.Add(new MySqlParameter("@SitioWeb_", MySqlDbType.VarChar, oRegistroEN.SitioWeb.Trim().Length)).Value = oRegistroEN.SitioWeb.Trim(); Comando.Parameters.Add(new MySqlParameter("@Telefono_", MySqlDbType.VarChar, oRegistroEN.Telefono.Trim().Length)).Value = oRegistroEN.Telefono.Trim(); Comando.Parameters.Add(new MySqlParameter("@Movil_", MySqlDbType.VarChar, oRegistroEN.Movil.Trim().Length)).Value = oRegistroEN.Movil.Trim(); Comando.Parameters.Add(new MySqlParameter("@Observaciones_", MySqlDbType.VarChar, oRegistroEN.Observaciones.Trim().Length)).Value = oRegistroEN.Observaciones.Trim(); Comando.Parameters.Add(new MySqlParameter("@Correo_", MySqlDbType.VarChar, oRegistroEN.Correo.Trim().Length)).Value = oRegistroEN.Correo.Trim(); Comando.Parameters.Add(new MySqlParameter("@FechaDeCumpleanos_", MySqlDbType.VarChar, oRegistroEN.FechaDeCumpleanos.Trim().Length)).Value = oRegistroEN.FechaDeCumpleanos.Trim(); Comando.Parameters.Add(new MySqlParameter("@Messenger_", MySqlDbType.VarChar, oRegistroEN.Messenger.Trim().Length)).Value = oRegistroEN.Messenger.Trim(); Comando.Parameters.Add(new MySqlParameter("@Skype_", MySqlDbType.VarChar, oRegistroEN.Skype.Trim().Length)).Value = oRegistroEN.Skype.Trim(); Comando.Parameters.Add(new MySqlParameter("@Twitter_", MySqlDbType.VarChar, oRegistroEN.Twitter.Trim().Length)).Value = oRegistroEN.Twitter.Trim(); Comando.Parameters.Add(new MySqlParameter("@Facebook_", MySqlDbType.VarChar, oRegistroEN.Facebook.Trim().Length)).Value = oRegistroEN.Facebook.Trim(); Comando.Parameters.Add(new MySqlParameter("@Estado_", MySqlDbType.VarChar, oRegistroEN.Estado.Trim().Length)).Value = oRegistroEN.Estado.Trim(); Comando.Parameters.Add(new MySqlParameter("@Foto_", MySqlDbType.Binary)).Value = oRegistroEN.AFoto; Comando.Parameters.Add(new MySqlParameter("@idUsuarioDeCreacion_", MySqlDbType.Int32)).Value = oRegistroEN.oLoginEN.idUsuario; Comando.Parameters.Add(new MySqlParameter("@idUsuarioModificacion_", MySqlDbType.Int32)).Value = oRegistroEN.oLoginEN.idUsuario; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); oRegistroEN.Codigo = DT.Rows[0].ItemArray[0].ToString(); DescripcionDeOperacion = string.Format("El registro fue Insertado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTran, 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); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Agregar", "Agregar Nuevo Registro", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
public bool ValidarSiElRegistroEstaVinculado(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { oTransaccionesAD = new TransaccionesAD(); try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.StoredProcedure; Comando.CommandText = "ValidarSiElRegistroEstaVinculado"; Comando.Parameters.Add(new MySqlParameter("@CampoABuscar_", MySqlDbType.VarChar, 200)).Value = "idLaboratorio"; Comando.Parameters.Add(new MySqlParameter("@ValorCampoABuscar", MySqlDbType.Int32)).Value = oRegistroEN.idLaboratorio; Comando.Parameters.Add(new MySqlParameter("@ExcluirTabla_", MySqlDbType.VarChar, 200)).Value = "Entidad"; 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), oTransaccionesAD.ConvertirValorDeLaCadena(DT.Rows[0].ItemArray[0].ToString())); DescripcionDeOperacion = this.Error; //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "VALIDAR", "VALIDAR SI EL REGISTRO ESTA VINCULADO", "CORRECTO"); oTransaccionesAD.Agregar(oTran, oDatos); return(true); } } catch (Exception ex) { this.Error = ex.Message; DescripcionDeOperacion = 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 oTran = InformacionDelaTransaccion(oRegistroEN, "VALIDAR", "VALIDAR SI EL REGISTRO ESTA VINCULADO", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
private void tsbActualzar_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; } LaboratorioEN oRegistroEN = InformacionDelRegistro(); LaboratorioLN oRegistroLN = new LaboratorioLN(); /*if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexion, "ACTUALIZAR")) * { * this.Cursor = Cursors.Default; * MessageBox.Show(oRegistroLN.Error, this.OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); * return; * }*/ if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "ACTUALIZAR")) { this.Cursor = Cursors.Default; MessageBox.Show(oRegistroLN.Error, "Actualizar la información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Controles.IsNullOEmptyElControl(txtNoRUC) == false) { if (oRegistroLN.ValidarRegistroDuplicadoNoRUC(oRegistroEN, Program.oDatosDeConexion, "ACTUALIZAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (oRegistroLN.Actualizar(oRegistroEN, Program.oDatosDeConexion)) { GuardarActualizarVinculo(); EvaluarErrorParaMensajeAPantalla(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 información del registro", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool ValidarRegistroDuplicadoNoRUC(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion) { oTransaccionesAD = new TransaccionesAD(); try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; switch (TipoDeOperacion.Trim().ToUpper()) { case "AGREGAR": Consultas = @"SELECT CASE WHEN EXISTS(Select idLaboratorio from Laboratorio where upper( trim(NoRUC) ) = upper(trim(@NoRUC))) THEN 1 ELSE 0 END AS 'RES'"; Comando.Parameters.Add(new MySqlParameter("@NoRUC", MySqlDbType.VarChar, oRegistroEN.NoRUC.Trim().Length)).Value = oRegistroEN.NoRUC; break; case "ACTUALIZAR": Consultas = @"SELECT CASE WHEN EXISTS(Select idLaboratorio from Laboratorio where upper( trim(NoRUC) ) = upper(trim(@NoRUC)) and idLaboratorio <> @idLaboratorio) THEN 1 ELSE 0 END AS 'RES'"; Comando.Parameters.Add(new MySqlParameter("@NoRUC", MySqlDbType.VarChar, oRegistroEN.NoRUC.Trim().Length)).Value = oRegistroEN.NoRUC; Comando.Parameters.Add(new MySqlParameter("@idLaboratorio", MySqlDbType.Int32)).Value = oRegistroEN.idLaboratorio; break; default: throw new ArgumentException("La aperación solicitada no esta disponible"); } Comando.CommandText = Consultas; Adaptador = new MySqlDataAdapter(); DT = new DataTable(); Adaptador.SelectCommand = Comando; Adaptador.Fill(DT); if (Convert.ToInt32(DT.Rows[0]["RES"].ToString()) > 0) { DescripcionDeOperacion = string.Format("Ya existe información del Registro dentro de nuestro sistema: {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); this.Error = DescripcionDeOperacion; return(true); } return(false); } catch (Exception ex) { this.Error = ex.Message; DescripcionDeOperacion = 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 oTran = InformacionDelaTransaccion(oRegistroEN, "VALIDAR", "REGISTRO DUPLICADO DENTRO DE LA BASE DE DATOS", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }
private void tsbGuardar_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (LosDatosIngresadosSonCorrectos()) { LaboratorioEN oRegistroEN = InformacionDelRegistro(); LaboratorioLN oRegistroLN = new LaboratorioLN(); if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "AGREGAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Controles.IsNullOEmptyElControl(txtNoRUC) == false) { if (oRegistroLN.ValidarRegistroDuplicadoNoRUC(oRegistroEN, Program.oDatosDeConexion, "AGREGAR")) { MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } EntidadEN oEntidadEN = informacionDeLaEntidad(); EntidadLN oEntidadLN = new EntidadLN(); if (oEntidadLN.Agregar(oEntidadEN, Program.oDatosDeConexion)) { oRegistroEN.idLaboratorio = oEntidadEN.idEntidad; if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexion)) { txtIdentificador.Text = oRegistroEN.idLaboratorio.ToString(); ValorLlavePrimariaEntidad = oRegistroEN.idLaboratorio; txtCodigo.Text = oRegistroEN.Codigo; GuardarActualizarVinculo(); EvaluarErrorParaMensajeAPantalla(oRegistroLN.Error, "Guardar"); if (CerrarVentana == true) { this.Cursor = Cursors.Default; this.Close(); } else { OperacionARealizar = "Modificar"; ObtenerValoresDeConfiguracion(); DeshabilitarControlesSegunOperacionesARealizar(); EstablecerTituloDeVentana(); LlamarMetodoSegunOperacion(); } } else { oEntidadLN.Eliminar(oEntidadEN, Program.oDatosDeConexion); string mensaje = string.Format("Se ha encontrado el siguiente error al Guardar la iformación del Laboratorio: {0} {1} {0} Desea continuar ingresando la información del Laboratorio", Environment.NewLine, oRegistroLN.Error); throw new ArgumentException(mensaje); } } else { string mensaje = string.Format("Se ha encontrado el siguiente error: {0} {1} {0} Desea continuar ingresando la información", Environment.NewLine, oEntidadLN.Error); throw new ArgumentException(mensaje); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Guardar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
private void button1_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; btnImportarDesdeExcel.Enabled = false; btnCerrarVentana.Enabled = false; if (dgvListar.Rows.Count > 0) { pbBarra.Visible = true; lbEtiqueta.Visible = true; pbBarra.Maximum = dgvListar.Rows.Count; pbBarra.Minimum = 1; foreach (DataGridViewRow Fila in dgvListar.Rows) { pbBarra.Value = Fila.Index + 1; Fila.Selected = true; LaboratorioEN oRegistroEN = InformacionDelLaboratorio(Fila); LaboratorioLN oRegistroLN = new LaboratorioLN(); if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "AGREGAR")) { string mensaje = string.Format("Se ha encontrado el siguiente error: {0} {1} {0} Desea continuar ingresando la información", Environment.NewLine, oRegistroLN.Error); if (MessageBox.Show(mensaje, "Guardando información del proveedor", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { throw new ArgumentException("La operación asido cancelada por el usuario"); } continue; } /*Primero agregaremos la entidad mayor...*/ EntidadEN oEntidadEN = informacionDeLaEntidad(); EntidadLN oEntidadLN = new EntidadLN(); if (oEntidadLN.Agregar(oEntidadEN, Program.oDatosDeConexion)) { oRegistroEN.idLaboratorio = oEntidadEN.idEntidad; if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexion) == false) { string mensaje = string.Format("Se ha encontrado el siguiente error al Guardar la iformación del Proveedor: {0} {1} {0} Desea continuar ingresando la información", Environment.NewLine, oRegistroLN.Error); oEntidadLN.Eliminar(oEntidadEN, Program.oDatosDeConexion); if (MessageBox.Show(mensaje, "Guardando información del proveedor", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { throw new ArgumentException("La operación asido cancelada por el usuario"); } } } else { string mensaje = string.Format("Se ha encontrado el siguiente error: {0} {1} {0} Desea continuar ingresando la información", Environment.NewLine, oEntidadLN.Error); if (MessageBox.Show(mensaje, "Guardando información del proveedor", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { throw new ArgumentException("La operación asido cancelada por el usuario"); } } lbEtiqueta.Text = string.Format("{0} Registros Guardados de {1}", (Fila.Index + 1).ToString(), dgvListar.Rows.Count); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Guardar información del proveedor", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { pbBarra.Visible = false; btnImportarDesdeExcel.Enabled = true; btnCerrarVentana.Enabled = true; lbEtiqueta.Visible = false; this.Cursor = Cursors.Default; } }
private void LlenarCamposDesdeBaseDatosSegunID() { this.Cursor = Cursors.WaitCursor; LaboratorioEN oRegistrosEN = new LaboratorioEN(); LaboratorioLN oRegistrosLN = new LaboratorioLN(); oRegistrosEN.idLaboratorio = ValorLlavePrimariaEntidad; if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexion)) { if (oRegistrosLN.TraerDatos().Rows.Count > 0) { DataRow Fila = oRegistrosLN.TraerDatos().Rows[0]; txtCodigo.Text = Fila["Codigo"].ToString(); txtNombre.Text = Fila["Nombre"].ToString(); txtDireccion.Text = Fila["Direccion"].ToString(); txtTelefono.Text = Fila["Telefono"].ToString(); txtMovil.Text = Fila["Movil"].ToString(); txtObservaciones.Text = Fila["Observaciones"].ToString(); txtCorreo.Text = Fila["Correo"].ToString(); txtFechaDeCumpleanos.Text = Fila["FechaDeCumpleanos"].ToString(); txtMessenger.Text = Fila["Messenger"].ToString(); txtSkype.Text = Fila["Skype"].ToString(); txtTwitter.Text = Fila["Twitter"].ToString(); txtFaceBook.Text = Fila["Facebook"].ToString(); cmbEstado.Text = Fila["Estado"].ToString(); txtNoRUC.Text = Fila["NoRUC"].ToString(); txtSitioWeb.Text = Fila["SitioWeb"].ToString(); if (Controles.IsNullOEmptyElControl(txtFechaDeCumpleanos) == false) { dtpkFecha.Value = Convert.ToDateTime(txtFechaDeCumpleanos.Text); } if (Fila["Foto"] != DBNull.Value) { pbxImagen.Image = Imagenes.ProcesarImagenToBitMap((object)(Fila["Foto"])); } LLenarCampoDeBaseDeDatosSegundLaboratorio(); LLenarCampoDeBaseDeDatosSegunLaboratorios(); 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.", NombreEntidad); 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 Actualizar(LaboratorioEN oRegistroEN, DatosDeConexionEN oDatos) { oTransaccionesAD = new TransaccionesAD(); try { Cnn = new MySqlConnection(TraerCadenaDeConexion(oDatos)); Cnn.Open(); Comando = new MySqlCommand(); Comando.Connection = Cnn; Comando.CommandType = CommandType.Text; Consultas = @"UPDATE Laboratorio set Nombre = @Nombre, Direccion = @Direccion, NoRUC = @NoRUC, SitioWeb = @SitioWeb, Telefono = @Telefono, Movil = @Movil, Observaciones = @Observaciones, Correo = @Correo, FechaDeCumpleanos = @FechaDeCumpleanos, Messenger = @Messenger, Skype = @Skype, Twitter = @Twitter, Facebook = @Facebook, Estado = @Estado, Foto = @Foto, idUsuarioModificacion = @idUsuarioModificacion, FechaDeModificacion = current_timestamp() where idLaboratorio = @idLaboratorio;"; Comando.CommandText = Consultas; Comando.Parameters.Add(new MySqlParameter("@idLaboratorio", MySqlDbType.Int32)).Value = oRegistroEN.idLaboratorio; Comando.Parameters.Add(new MySqlParameter("@Nombre", MySqlDbType.VarChar, oRegistroEN.Nombre.Trim().Length)).Value = oRegistroEN.Nombre.Trim(); Comando.Parameters.Add(new MySqlParameter("@Direccion", MySqlDbType.VarChar, oRegistroEN.Direccion.Trim().Length)).Value = oRegistroEN.Direccion.Trim(); Comando.Parameters.Add(new MySqlParameter("@NoRUC", MySqlDbType.VarChar, oRegistroEN.NoRUC.Trim().Length)).Value = oRegistroEN.NoRUC.Trim(); Comando.Parameters.Add(new MySqlParameter("@SitioWeb", MySqlDbType.VarChar, oRegistroEN.SitioWeb.Trim().Length)).Value = oRegistroEN.SitioWeb.Trim(); Comando.Parameters.Add(new MySqlParameter("@Telefono", MySqlDbType.VarChar, oRegistroEN.Telefono.Trim().Length)).Value = oRegistroEN.Telefono.Trim(); Comando.Parameters.Add(new MySqlParameter("@Movil", MySqlDbType.VarChar, oRegistroEN.Movil.Trim().Length)).Value = oRegistroEN.Movil.Trim(); Comando.Parameters.Add(new MySqlParameter("@Observaciones", MySqlDbType.VarChar, oRegistroEN.Observaciones.Trim().Length)).Value = oRegistroEN.Observaciones.Trim(); Comando.Parameters.Add(new MySqlParameter("@Correo", MySqlDbType.VarChar, oRegistroEN.Correo.Trim().Length)).Value = oRegistroEN.Correo.Trim(); Comando.Parameters.Add(new MySqlParameter("@FechaDeCumpleanos", MySqlDbType.VarChar, oRegistroEN.FechaDeCumpleanos.Trim().Length)).Value = oRegistroEN.FechaDeCumpleanos.Trim(); Comando.Parameters.Add(new MySqlParameter("@Messenger", MySqlDbType.VarChar, oRegistroEN.Messenger.Trim().Length)).Value = oRegistroEN.Messenger.Trim(); Comando.Parameters.Add(new MySqlParameter("@Skype", MySqlDbType.VarChar, oRegistroEN.Skype.Trim().Length)).Value = oRegistroEN.Skype.Trim(); Comando.Parameters.Add(new MySqlParameter("@Twitter", MySqlDbType.VarChar, oRegistroEN.Twitter.Trim().Length)).Value = oRegistroEN.Twitter.Trim(); Comando.Parameters.Add(new MySqlParameter("@Facebook", MySqlDbType.VarChar, oRegistroEN.Facebook.Trim().Length)).Value = oRegistroEN.Facebook.Trim(); Comando.Parameters.Add(new MySqlParameter("@Estado", MySqlDbType.VarChar, oRegistroEN.Estado.Trim().Length)).Value = oRegistroEN.Estado.Trim(); Comando.Parameters.Add(new MySqlParameter("@Foto", MySqlDbType.Binary)).Value = oRegistroEN.AFoto; Comando.Parameters.Add(new MySqlParameter("@idUsuarioModificacion", MySqlDbType.Int32)).Value = oRegistroEN.oLoginEN.idUsuario; Comando.ExecuteNonQuery(); DescripcionDeOperacion = string.Format("El registro fue Actualizado Correctamente. {0} {1}", Environment.NewLine, InformacionDelRegistro(oRegistroEN)); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "CORRECTO"); oTransaccionesAD.Agregar(oTran, 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); //Agregamos la Transacción.... TransaccionesEN oTran = InformacionDelaTransaccion(oRegistroEN, "Actualizar", "Actualizar Registro", "ERROR"); oTransaccionesAD.Agregar(oTran, oDatos); return(false); } finally { if (Cnn != null) { if (Cnn.State == ConnectionState.Open) { Cnn.Close(); } } Cnn = null; Comando = null; Adaptador = null; oTransaccionesAD = null; } }