예제 #1
0
        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 oContacto, a);

                            oContacto[a - 1]                   = new ContactoEN();
                            oContacto[a - 1].idContacto        = Convert.ToInt32(Fila.Cells["idContacto"].Value);
                            oContacto[a - 1].Codigo            = Fila.Cells["Codigo"].Value.ToString();
                            oContacto[a - 1].Nombre            = Fila.Cells["Nombre"].Value.ToString();
                            oContacto[a - 1].Direccion         = Fila.Cells["Direccion"].Value.ToString();
                            oContacto[a - 1].Telefono          = Fila.Cells["Telefono"].Value.ToString();
                            oContacto[a - 1].Movil             = Fila.Cells["Movil"].Value.ToString();
                            oContacto[a - 1].Observaciones     = Fila.Cells["Observaciones"].Value.ToString();
                            oContacto[a - 1].Correo            = Fila.Cells["Correo"].Value.ToString();
                            oContacto[a - 1].FechaDeCumpleanos = Fila.Cells["FechaDeCumpleanos"].Value.ToString();
                            oContacto[a - 1].Messenger         = Fila.Cells["Messenger"].Value.ToString();
                            oContacto[a - 1].Skype             = Fila.Cells["Skype"].Value.ToString();
                            oContacto[a - 1].Twitter           = Fila.Cells["Twitter"].Value.ToString();
                            oContacto[a - 1].Facebook          = Fila.Cells["Facebook"].Value.ToString();
                            oContacto[a - 1].Estado            = Fila.Cells["Estado"].Value.ToString();
                            oContacto[a - 1].Sexo              = Fila.Cells["Sexo"].Value.ToString();
                            oContacto[a - 1].Cedula            = Fila.Cells["Cedula"].Value.ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Seleccionar registros", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally {
                AgregarRegistrosAlDTUsuario();
                this.Cursor = Cursors.Default;
                this.Close();
            }
        }
예제 #2
0
        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;
                    }

                    ContactoEN oRegistroEN = InformacionDelRegistro();
                    ContactoLN oRegistroLN = new ContactoLN();

                    if (Controles.IsNullOEmptyElControl(txtIdProveedorContacto) == false)
                    {
                        EliminarRegistroDelaVinculacion();
                    }

                    if (oRegistroLN.Eliminar(oRegistroEN, Program.oDatosDeConexion))
                    {
                        EvaluarErrorParaMensajeAPantalla(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;
            }
        }
예제 #3
0
        private string InformacionDelRegistro(ContactoEN oRegistroEN)
        {
            string Cadena = @"idContacto, Codigo, Nombre, Direccion, Telefono, Movil, Observaciones, Correo, FechaDeCumpleanos, Messenger, Skype, Twitter, Facebook, Estado, idUsuarioDeCreacion, FechaDeCreacion, idUsuarioModificacion, FechaDeModificacion";

            Cadena = string.Format(Cadena, oRegistroEN.idContacto, oRegistroEN.Codigo, oRegistroEN.Nombre, oRegistroEN.Direccion, 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);
        }
예제 #4
0
        public bool Eliminar(ContactoEN 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 Contacto Where idContacto = @idContacto;";
                Comando.CommandText = Consultas;

                Comando.Parameters.Add(new MySqlParameter("@idContacto", MySqlDbType.Int32)).Value = oRegistroEN.idContacto;

                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;
            }
        }
예제 #5
0
        public bool ListadoParaCombos(ContactoEN 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 idContacto, Codigo, c.Nombre, c.Cedula, Direccion, Telefono, Movil, Sexo,
                Observaciones, Correo, FechaDeCumpleanos, Messenger, Skype, 
                Twitter, Facebook, c.Estado, Foto, 
                c.idUsuarioDeCreacion, c.FechaDeCreacion, u.Nombre as 'UsuarioDeCreacion',
                c.idUsuarioModificacion, c.FechaDeModificacion, c1.Nombre as 'UsuarioDeModificacion'
                from contacto as c
                inner join usuario as u on u.idUsuario = c.idUsuarioDeCreacion
                left join usuario as c1 on c1.idUsuario = c.idUsuarioModificacion
                where c.idContacto > 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 Listado(ContactoEN oREgistroEN, DatosDeConexionEN oDatos)
 {
     if (oContactoAD.Listado(oREgistroEN, oDatos))
     {
         Error = string.Empty;
         return(true);
     }
     else
     {
         Error = oContactoAD.Error;
         return(false);
     }
 }
 public bool AgregarUtilizandoLaMismaConexion(ContactoEN oREgistroEN, DatosDeConexionEN oDatos)
 {
     if (oContactoAD.AgregarUtilizandoLaMismaConexion(oREgistroEN, oDatos))
     {
         Error = string.Empty;
         return(true);
     }
     else
     {
         Error = oContactoAD.Error;
         return(false);
     }
 }
 public bool ValidarSiElRegistroEstaVinculado(ContactoEN oREgistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion)
 {
     if (oContactoAD.ValidarSiElRegistroEstaVinculado(oREgistroEN, oDatos, TipoDeOperacion))
     {
         Error = oContactoAD.Error;
         return(true);
     }
     else
     {
         Error = string.Empty;
         return(false);
     }
 }
 public bool GenerarCodigoDelContacto(ContactoEN oREgistroEN, DatosDeConexionEN oDatos)
 {
     if (oContactoAD.GenerarCodigoDelContacto(oREgistroEN, oDatos))
     {
         Error = string.Empty;
         return(true);
     }
     else
     {
         Error = oContactoAD.Error;
         return(false);
     }
 }
 public bool ValidarRegistroDuplicadoParaCedula(ContactoEN oREgistroEN, DatosDeConexionEN oDatos, string TipoDeOperacion)
 {
     if (oContactoAD.ValidarRegistroDuplicadoParaCedula(oREgistroEN, oDatos, TipoDeOperacion))
     {
         Error = oContactoAD.Error;
         return(true);
     }
     else
     {
         Error = string.Empty;
         return(false);
     }
 }
예제 #11
0
 private void tsbRegistroLocal_Click(object sender, EventArgs e)
 {
     try
     {
         oContacto     = InformacionDelRegistro();
         VariableLocal = true;
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Registro local", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #12
0
        private void GenerarCodigoDelContacto()
        {
            try
            {
                ContactoEN oRegistroEN = new ContactoEN();
                ContactoLN oRegistroLN = new ContactoLN();

                if (oRegistroLN.GenerarCodigoDelContacto(oRegistroEN, Program.oDatosDeConexion))
                {
                    txtCodigo.Text = oRegistroEN.Codigo;
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Generar codigo Automatico", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #13
0
        public bool GenerarCodigoDelContacto(ContactoEN 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 GenerarCodigoDelContacto() as 'Codigo'; ", oRegistroEN.Where, oRegistroEN.OrderBy);
                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;
            }
        }
        public bool Eliminar(ContactoEN oREgistroEN, DatosDeConexionEN oDatos)
        {
            if (string.IsNullOrEmpty(oREgistroEN.idContacto.ToString()) || oREgistroEN.idContacto == 0)
            {
                this.Error = @"Se debe de seleccionar un elemento de la lista";
                return(false);
            }

            if (oContactoAD.Eliminar(oREgistroEN, oDatos))
            {
                Error = string.Empty;
                return(true);
            }
            else
            {
                Error = oContactoAD.Error;
                return(false);
            }
        }
예제 #15
0
        private TransaccionesEN InformacionDelaTransaccion(ContactoEN oContacto, String TipoDeOperacion, String Descripcion, String Estado)
        {
            TransaccionesEN oRegistroEN = new TransaccionesEN();

            oRegistroEN.idregistro      = oContacto.idContacto;
            oRegistroEN.Modelo          = "TransaccionAD";
            oRegistroEN.Modulo          = "Transacciones";
            oRegistroEN.Tabla           = "Contactos";
            oRegistroEN.tipodeoperacion = TipoDeOperacion;
            oRegistroEN.Estado          = Estado;
            oRegistroEN.ip                    = oContacto.oLoginEN.NumeroIP;
            oRegistroEN.idusuario             = oContacto.oLoginEN.idUsuario;
            oRegistroEN.idusuarioaprueba      = oContacto.oLoginEN.idUsuario;
            oRegistroEN.descripciondelusuario = DescripcionDeOperacion;
            oRegistroEN.descripcioninterna    = Descripcion;
            oRegistroEN.NombreDelEquipo       = oContacto.oLoginEN.NombreDelComputador;

            return(oRegistroEN);
        }
예제 #16
0
        private void LLenarListado()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                ContactoEN oRegistrosEN = new ContactoEN();
                ContactoLN oRegistrosLN = new ContactoLN();

                oRegistrosEN.Where = WhereDinamico();

                if (oRegistrosLN.Listado(oRegistrosEN, Program.oDatosDeConexion))
                {
                    dgvLista.Columns.Clear();

                    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;
            }
        }
예제 #17
0
        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 oContacto, a);

                        oContacto[a - 1]                   = new ContactoEN();
                        oContacto[a - 1].idContacto        = Convert.ToInt32(Fila.Cells["idContacto"].Value);
                        oContacto[a - 1].Codigo            = Fila.Cells["Codigo"].Value.ToString();
                        oContacto[a - 1].Nombre            = Fila.Cells["Nombre"].Value.ToString();
                        oContacto[a - 1].Direccion         = Fila.Cells["Direccion"].Value.ToString();
                        oContacto[a - 1].Telefono          = Fila.Cells["Telefono"].Value.ToString();
                        oContacto[a - 1].Movil             = Fila.Cells["Movil"].Value.ToString();
                        oContacto[a - 1].Observaciones     = Fila.Cells["Observaciones"].Value.ToString();
                        oContacto[a - 1].Correo            = Fila.Cells["Correo"].Value.ToString();
                        oContacto[a - 1].FechaDeCumpleanos = Fila.Cells["FechaDeCumpleanos"].Value.ToString();
                        oContacto[a - 1].Messenger         = Fila.Cells["Messenger"].Value.ToString();
                        oContacto[a - 1].Skype             = Fila.Cells["Skype"].Value.ToString();
                        oContacto[a - 1].Twitter           = Fila.Cells["Twitter"].Value.ToString();
                        oContacto[a - 1].Facebook          = Fila.Cells["Facebook"].Value.ToString();
                        oContacto[a - 1].Estado            = Fila.Cells["Estado"].Value.ToString();
                        oContacto[a - 1].Sexo              = Fila.Cells["Sexo"].Value.ToString();
                        oContacto[a - 1].Cedula            = Fila.Cells["Cedula"].Value.ToString();
                    }
                }

                this.Cursor = Cursors.Default;
                this.Close();
            }
        }
예제 #18
0
        private ContactoEN InformacionDelRegistro()
        {
            ContactoEN oRegistroEN = new ContactoEN();

            oRegistroEN.idContacto        = 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.Cedula            = txtCedula.Text.Trim();

            if (pbxImagen.Image != null)
            {
                oRegistroEN.AFoto = Imagenes.ProcesarImagenToByte((Bitmap)(pbxImagen.Image));
            }
            else
            {
                oRegistroEN.AFoto = null;
            }

            oRegistroEN.Sexo = cmbSexo.Text.Trim();

            //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);
        }
예제 #19
0
        public bool ValidarRegistroDuplicadoParaCedula(ContactoEN 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 idContacto from Contacto where upper( trim(Cedula) ) = upper(trim(@Cedula))) THEN 1 ELSE 0 END AS 'RES'";
                    Comando.Parameters.Add(new MySqlParameter("@Cedula", MySqlDbType.VarChar, oRegistroEN.Cedula.Trim().Length)).Value = oRegistroEN.Cedula;

                    break;

                case "ACTUALIZAR":

                    Consultas = @"SELECT CASE WHEN EXISTS(Select idContacto from Contacto where upper( trim(Cedula) ) = upper(trim(@Cedula)) and idContacto <> @idContacto) THEN 1 ELSE 0 END AS 'RES'";
                    Comando.Parameters.Add(new MySqlParameter("@Cedula", MySqlDbType.VarChar, oRegistroEN.Cedula.Trim().Length)).Value = oRegistroEN.Cedula;
                    Comando.Parameters.Add(new MySqlParameter("@idContacto", MySqlDbType.Int32)).Value = oRegistroEN.idContacto;

                    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;
            }
        }
예제 #20
0
        public bool ValidarSiElRegistroEstaVinculado(ContactoEN 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 = "idContacto";
                Comando.Parameters.Add(new MySqlParameter("@ValorCampoABuscar", MySqlDbType.Int32)).Value    = oRegistroEN.idContacto;
                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;
            }
        }
예제 #21
0
        private void LlenarCamposDesdeBaseDatosSegunID()
        {
            this.Cursor = Cursors.WaitCursor;

            ContactoEN oRegistrosEN = new ContactoEN();
            ContactoLN oRegistrosLN = new ContactoLN();

            oRegistrosEN.idContacto = 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();
                    txtCedula.Text            = Fila["Cedula"].ToString();

                    if (Controles.IsNullOEmptyElControl(txtFechaDeCumpleanos) == false)
                    {
                        dtpkFecha.Value = Convert.ToDateTime(txtFechaDeCumpleanos.Text);
                    }

                    if (Fila["Foto"] != DBNull.Value)
                    {
                        pbxImagen.Image = Imagenes.ProcesarImagenToBitMap((object)(Fila["Foto"]));
                    }

                    //LLenarCampoDeBaseDeDatosSegundContacto();
                    LLenarListBoxDeBaseDeDatosSegundContacto();

                    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;
        }
예제 #22
0
        public bool Agregar(ContactoEN 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 = @"AgregarInformacionDelContacto";

                Comando.CommandText = Consultas;

                Comando.Parameters.Add(new MySqlParameter("@idContacto_", MySqlDbType.Int32)).Value = oRegistroEN.idContacto;
                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("@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("@Sexo_", MySqlDbType.VarChar, oRegistroEN.Sexo.Trim().Length)).Value     = oRegistroEN.Sexo.Trim();
                Comando.Parameters.Add(new MySqlParameter("@Cedula_", MySqlDbType.VarChar, oRegistroEN.Cedula.Trim().Length)).Value = oRegistroEN.Cedula.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;
            }
        }
예제 #23
0
        public bool AgregarUtilizandoLaMismaConexion(ContactoEN 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        = "Contacto";
                oEntidadEN.oTipoDeEntidadEN.NombreInterno = "contacto";
                EntidadAD oEntidadAD = new EntidadAD();

                if (oEntidadAD.Agregar(oEntidadEN, oDatos, ref Cnn, ref oMySqlTransaction))
                {
                    oRegistroEN.idContacto = 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);
                }

                oEntidadAD = null;
                oEntidadEN = null;

                if (Agregar(oRegistroEN, oDatos, ref Cnn, ref oMySqlTransaction))
                {
                    oRegistroEN.idContacto = oEntidadEN.idEntidad;
                    Errores = EvaluarTextoError(Errores, "GUARDAR", this.Error);
                }
                else
                {
                    mensaje = String.Format("Error : '{1}', {0} producido al intentar guardar la información del concto. ", Environment.NewLine, this.Error);
                    throw new System.ArgumentException(mensaje);
                }

                this.Error = Errores;

                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;
            }
        }
예제 #24
0
        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;
                    }

                    ContactoEN oRegistroEN = InformacionDelRegistro();
                    ContactoLN oRegistroLN = new ContactoLN();

                    /*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(txtCedula) == false)
                    {
                        if (oRegistroLN.ValidarRegistroDuplicadoParaCedula(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);
            }
        }
예제 #25
0
        public bool Actualizar(ContactoEN 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 contacto set

                Nombre = @Nombre, Direccion = @Direccion, 
                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(),
                Sexo = @Sexo, Cedula = @Cedula

                where idContacto = @idContacto;";

                Comando.CommandText = Consultas;

                Comando.Parameters.Add(new MySqlParameter("@idContacto", MySqlDbType.Int32)).Value = oRegistroEN.idContacto;
                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("@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("@Sexo", MySqlDbType.VarChar, oRegistroEN.Sexo.Trim().Length)).Value     = oRegistroEN.Sexo.Trim();
                Comando.Parameters.Add(new MySqlParameter("@Cedula", MySqlDbType.VarChar, oRegistroEN.Cedula.Trim().Length)).Value = oRegistroEN.Cedula.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;
            }
        }
예제 #26
0
        private void tsbGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                if (LosDatosIngresadosSonCorrectos())
                {
                    ContactoEN oRegistroEN = InformacionDelRegistro();
                    ContactoLN oRegistroLN = new ContactoLN();

                    if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "AGREGAR"))
                    {
                        MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (Controles.IsNullOEmptyElControl(txtCedula) == false)
                    {
                        if (oRegistroLN.ValidarRegistroDuplicadoParaCedula(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.idContacto = oEntidadEN.idEntidad;

                        if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexion))
                        {
                            txtIdentificador.Text     = oRegistroEN.idContacto.ToString();
                            ValorLlavePrimariaEntidad = oRegistroEN.idContacto;
                            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 Contacto: {0} {1} {0} Desea continuar ingresando la información del Contacto", 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;
            }
        }