public void modificar()
        {
            try
            {
                String       Fecha = CuentaC1.Text + "/" + CuentaC2.Text + "/" + CuentaC3.Text;
                OleDbCommand aaq   = new OleDbCommand("UPDATE `Cuenta` SET `Nombre` ='" + Cuenta2.Text
                                                      + "', `Paterno` ='" + Cuenta3.Text
                                                      + "', `Materno` = '" + Cuenta4.Text
                                                      + "',`FechaNacimiento` = '" + Fecha
                                                      + "', `Sexo` = '" + sexo
                                                      + "', `Nick` = '" + Cuenta5.Text
                                                      + "', `CorreoElectronico` = '" + Cuenta6.Text
                                                      + "', `ContraseƱa` = '" + Cuenta7.Text
                                                      + "', `Tipo` = '" + tipo
                                                      + "',`Foto` = '" + Metodos2.Objeto_Image_A_Bytes(Pintura.Image, System.Drawing.Imaging.ImageFormat.Jpeg)
                                                      + "' WHERE `Codigo` = " + int.Parse(Cuenta1.Text) + "", cone);

                cone.Open();
                aaq.ExecuteNonQuery();
                cone.Close();
                MessageBox.Show("Modificado correctamentre");
            }
            catch (Exception b)
            {
                MessageBox.Show("Error al Modificar");
                cone.Close();
            }
        }
Example #2
0
 private void cargarData()
 {
     Data10.AutoGenerateColumns = false;
     Data10.DataSource          = CargarImagenes();
     try
     {
         foreach (DataGridViewRow row in Data10.Rows)
         {
             row.Height = 150;
             DataRowView rows = row.DataBoundItem as DataRowView;
             if (rows == null)
             {
                 Image IM = this.picturenulo.Image;
                 row.Cells["Foto"].Value = IM;
             }
             else
             {
                 Image IM = Metodos2.Bytes_A_Imagen((byte[])rows["Foto"]);
                 row.Cells["Foto"].Value = IM;
             }
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.ToString()); }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                int c = this.Data10.RowCount;

                if (i >= 0)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    PictureBox       aux = new PictureBox();
                    aux.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                    this.InsertaPrincipio(aux.Image);
                    i     = i - 1;
                    medio = medio - 1;
                    this.buscardatos(medio);
                }
                else
                {
                    this.RotarInvertido();
                    medio = medio - 1;
                    this.buscardatos(medio);
                }
            }
            catch (Exception ee)
            { MessageBox.Show("" + ee); }
        }
Example #4
0
        public void buscar2(String Nombre)
        {
            try{
                OleDbDataAdapter adp = new OleDbDataAdapter("SELECT * FROM DatosPersonales  WHERE NombresApellidos='" + Nombre + "'", cone);
                DataSet          ds  = new DataSet();
                adp.Fill(ds, "DatosPersonales");


                int codigo = int.Parse(ds.Tables[0].Rows[0]["CodigoPersona"].ToString());
                L1.Text = ds.Tables[0].Rows[0]["NombresApellidos"].ToString();
                T1.Text = ds.Tables[0].Rows[0]["Nombres"].ToString();
                T2.Text = ds.Tables[0].Rows[0]["Paterno"].ToString();
                T3.Text = ds.Tables[0].Rows[0]["Materno"].ToString();
                T4.Text = ds.Tables[0].Rows[0]["Sexo"].ToString();


                T5.Text  = ds.Tables[0].Rows[0]["FechaNacimiento"].ToString();
                T6.Text  = ds.Tables[0].Rows[0]["LugarNacimiento"].ToString();
                T7.Text  = ds.Tables[0].Rows[0]["FechaFallecimiento"].ToString();
                T8.Text  = ds.Tables[0].Rows[0]["LugarFallecimiento"].ToString();
                T9.Text  = ds.Tables[0].Rows[0]["CausaMuerte"].ToString();
                T10.Text = ds.Tables[0].Rows[0]["Apodos"].ToString();
                T11.Text = ds.Tables[0].Rows[0]["Etnia"].ToString();
                T12.Text = ds.Tables[0].Rows[0]["ConocidoPor"].ToString();
                T13.Text = ds.Tables[0].Rows[0]["Religion"].ToString();
                T14.Text = ds.Tables[0].Rows[0]["Departamento"].ToString();
                T15.Text = ds.Tables[0].Rows[0]["Nacionalidad"].ToString();



                this.cargarData();



                DataGridViewCell dgc;
                DataGridViewCell dgc2;
                for (int i = 0; i < Data10.Rows.Count; i++)
                {
                    dgc2 = Data10.Rows[i].Cells["CodigoPersona"];
                    if (dgc2.Value == null)
                    {
                    }
                    else
                    {
                        int aux = (int)dgc2.Value;
                        dgc = Data10.Rows[i].Cells["Foto"];
                        if (aux == codigo)
                        {
                            Image IM = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                            this.pictureBox1.Image = IM;
                        }
                    }
                }
            }
            catch (Exception ex)
            {  }
        }
        private void cargar()
        {
            Data1.AutoGenerateColumns = false;
            Data1.DataSource          = Cargar();

            foreach (DataGridViewRow row in Data1.Rows)
            {
                row.Height = 70;
                DataRowView rows = row.DataBoundItem as DataRowView;
                if (rows == null)
                {
                    Image IM = this.Picture2.Image;
                    row.Cells["Foto"].Value = IM;
                }
                else
                {
                    Image IM = Metodos2.Bytes_A_Imagen((byte[])rows["Foto"]);
                    row.Cells["Foto"].Value = IM;
                }
            }
        }
        public void buscar()
        {
            OleDbDataAdapter adp = new OleDbDataAdapter("SELECT * FROM Cuenta WHERE Codigo=" + int.Parse(Cuenta1.Text) + "", cone);
            DataSet          ds  = new DataSet();

            adp.Fill(ds, "Cuenta");

            Cuenta2.Text = ds.Tables[0].Rows[0]["Nombre"].ToString();
            Cuenta3.Text = ds.Tables[0].Rows[0]["Paterno"].ToString();
            Cuenta4.Text = ds.Tables[0].Rows[0]["Materno"].ToString();
            Text         = ds.Tables[0].Rows[0]["FechaNacimiento"].ToString();

            String sexo = ds.Tables[0].Rows[0]["Sexo"].ToString();

            if (sexo.Equals("Masculino"))
            {
                CuentaR1.Select();
            }
            else
            {
                CuentaR2.Select();
            }

            Cuenta5.Text = ds.Tables[0].Rows[0]["Nick"].ToString();
            Cuenta6.Text = ds.Tables[0].Rows[0]["CorreoElectronico"].ToString();
            Cuenta7.Text = ds.Tables[0].Rows[0]["ContraseƱa"].ToString();
            String tipo = ds.Tables[0].Rows[0]["Tipo"].ToString();

            if (tipo.Equals("Usuario"))
            {
                CuentaR3.Select();
            }
            else
            {
                CuentaR4.Select();
            }



            int aux2 = int.Parse(Cuenta1.Text);


            DataGridViewCell dgc;
            DataGridViewCell dgc2;

            for (int i = 0; i < Data1.Rows.Count; i++)
            {
                dgc2 = Data1.Rows[i].Cells["Codigo"];
                if (dgc2.Value == null)
                {
                }
                else
                {
                    int aux = (int)dgc2.Value;
                    dgc = Data1.Rows[i].Cells["Foto"];
                    if (aux == aux2)
                    {
                        Image IM = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                        this.Pintura.Image = IM;
                    }
                }
            }
        }
        private void InsertarCuenta()
        {
            String Fecha = CuentaC1.Text + "/" + CuentaC2.Text + "/" + CuentaC3.Text;

            Insert(Cuenta2.Text, Cuenta3.Text, Cuenta4.Text, Fecha, sexo, Cuenta5.Text, Cuenta6.Text, Cuenta7.Text, tipo, Metodos2.Objeto_Image_A_Bytes(this.Pintura.Image, System.Drawing.Imaging.ImageFormat.Jpeg));
        }
Example #8
0
        public void InsertarNuevo()
        {
            String Fecha = CrearC1.Text + "/" + CrearC2.Text + "/" + CrearC3.Text;


            Insert(Crear1.Text, Crear2.Text, Crear3.Text, Fecha, Sexo, Crear4.Text, Crear5.Text, Crear6.Text, Tipo, Metodos2.Objeto_Image_A_Bytes(pictureBox1.Image, System.Drawing.Imaging.ImageFormat.Jpeg));
        }
        private void cargarData()
        {
            Data10.AutoGenerateColumns = false;
            DataTable di = new DataTable();

            di = CargarImagenes();
            Data10.DataSource = CargarImagenes();

            try
            {
                foreach (DataGridViewRow row in Data10.Rows)
                {
                    row.Height = 150;
                    DataRowView rows = row.DataBoundItem as DataRowView;
                    if (rows == null)
                    {
                        Image IM = this.PictureNulo.Image;
                        row.Cells["Foto"].Value = IM;
                    }
                    else
                    {
                        Image IM = Metodos2.Bytes_A_Imagen((byte[])rows["Foto"]);
                        row.Cells["Foto"].Value = IM;
                    }
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.ToString()); }


            for (int i = 0; i < Data10.RowCount; i++)
            {
                if (i == 0)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P1.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 1)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P2.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 2)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P3.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 3)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P4.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 4)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P5.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 5)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P6.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
                if (i == 6)
                {
                    DataGridViewCell dgc = Data10.Rows[i].Cells["Foto"];
                    P7.Image = Metodos2.Bytes_A_Imagen((byte[])dgc.Value);
                }
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     Insert(int.Parse(T1.Text), Metodos2.Objeto_Image_A_Bytes(pictureBox2.Image, System.Drawing.Imaging.ImageFormat.Jpeg));
 }