Example #1
0
        public static blc.Persona buscarTestigo(string id)
        {
            blc.Persona testigo = new blc.Persona();
            System.Data.SqlClient.SqlCommand Comando;
            System.Data.SqlClient.SqlDataReader DataReader;
            string query = "SELECT * FROM Testigo WHERE ID = '" + id + "'";

            Comando = new System.Data.SqlClient.SqlCommand(query);
            Comando.Connection = Program.dt.Connecion;
            Comando.Connection.Open();
            DataReader = Comando.ExecuteReader();

            while (DataReader.Read())
            {
                testigo.ID = DataReader.GetValue(0).ToString();
                testigo.Nombre = DataReader.GetValue(1).ToString();
                testigo.Apellido = DataReader.GetValue(2).ToString();
                testigo.Nacionalidad = DataReader.GetValue(4).ToString();
                testigo.Edad = (int)DataReader.GetValue(5);
                testigo.EstadoCivil = DataReader.GetValue(6).ToString();
                testigo.Domicilio = DataReader.GetValue(7).ToString();
                testigo.Telefono = DataReader.GetValue(8).ToString();
                testigo.Celular = DataReader.GetValue(9).ToString();
                testigo.Email = DataReader.GetValue(10).ToString();
                testigo.Foto = DataReader.GetValue(11).ToString();
            }
            DataReader.Close();
            Comando.Connection.Close();
            return testigo;
        }
Example #2
0
        private void agregarTestigo()
        {
            /* Instanciar el objeto cliente */
            blc.Persona testigo = new blc.Persona();

            testigo.ID = idText.Text;
            testigo.Nombre = nameText.Text;
            testigo.Apellido = lnameText.Text;
            testigo.Nacionalidad = natText.Text;
            testigo.Edad = int.Parse(ageText.Text);
            testigo.EstadoCivil = estadoText.Text;
            testigo.Domicilio = domText.Text;
            testigo.Telefono = telText.Text;
            testigo.Celular = celText.Text;
            testigo.Email = mailText.Text;

            /* Guardar la imagen en el directorio (si se escogio una) */
            if (fotografia.ImageLocation != null)
                testigo.Foto = guardarFotografia();
            else
                testigo.Foto = null;

            /* Agregar al cliente a la BD */
            dal.ccTestigo.agregarTestigo(testigo);

            MessageBox.Show("Testigo agregado exitosamente", "Operacion exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
            resetFields();
            cargarTestigos();
        }
Example #3
0
        private void buscarTestigo()
        {
            /* Buscar el cliente en la base de datos */
            blc.Persona testigo = new blc.Persona();

            testigo = dal.ccTestigo.buscarTestigo(idText.Text);

            if (testigo.ID == null)
            {
                MessageBox.Show("Testigo no existe.", "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                resetFields();
                return;
            }

            resetFields();
            /* Despeglar la informacion en los campos */
            idText.Text = testigo.ID;
            nameText.Text = testigo.Nombre;
            lnameText.Text = testigo.Apellido;
            natText.Text = testigo.Nacionalidad;
            ageText.Text = testigo.Edad.ToString();
            estadoText.Text = testigo.EstadoCivil;
            domText.Text = testigo.Domicilio;
            telText.Text = testigo.Telefono;
            celText.Text = testigo.Celular;
            mailText.Text = testigo.Email;

            /* Cargar la fotografia */
            fotografia.ImageLocation = testigo.Foto;
        }
Example #4
0
        private void agregarPersona()
        {
            /* Instanciar el objeto persona */
            blc.Persona persona = new blc.Persona();

            persona.ID = idText.Text;
            persona.Nombre = nameText.Text;
            persona.Apellido = lnameText.Text;
            persona.Nacionalidad = natText.Text;
            persona.Edad = int.Parse(ageText.Text);
            persona.EstadoCivil = estadoText.Text;
            persona.Domicilio = domText.Text;
            persona.Telefono = telText.Text;
            persona.Celular = celText.Text;
            persona.Email = mailText.Text;

            /* Agregar al cliente a la BD */
            if (tipoCombo.SelectedItem == tipoCombo.Items[0])
                dal.ccCliente.agregarCliente(persona);
            else
                dal.ccContraparte.agregarContraparte(persona);

            /* Guardar la imagen en el directorio (si se escogio una) */
            if (fotografia.ImageLocation != null)
                persona.Foto = guardarFotografia();
            else
                persona.Foto = null;

            MessageBox.Show("Persona agregada exitosamente", "Operacion exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
            resetFields();
            cargarPersonas();
        }