Exemple #1
0
        private void btn_buscar_Click(object sender, EventArgs e)
        {
            string       BUSCAR    = "SELECT * FROM persona WHERE Id=@Id";
            OleDbCommand CmdBuscar = new OleDbCommand(BUSCAR, Cnx);

            CmdBuscar.CommandType = CommandType.Text;
            CmdBuscar.Parameters.AddWithValue("@Id", txt_id.Text);
            Cnx.Open();
            OleDbDataReader Lectura;

            Lectura = CmdBuscar.ExecuteReader();
            if (Lectura.Read() == true)
            {
                txt_nombre.Text            = Lectura[1].ToString();
                txt_apellido.Text          = Lectura[2].ToString();
                txt_domicilio.Text         = Lectura[3].ToString();
                txt_colonia.Text           = Lectura[4].ToString();
                txt_ciudad.Text            = Lectura[5].ToString();
                txt_telcasa.Text           = Lectura[6].ToString();
                txt_telmovil.Text          = Lectura[7].ToString();
                txt_email.Text             = Lectura[8].ToString();
                txt_email_empresarial.Text = Lectura[9].ToString();
                pic_foto.ImageLocation     = Lectura[10].ToString();
            }


            else
            {
                MessageBox.Show("Los Datos a Buscar No Estan Registrados");
                txt_id.Clear();
                txt_id.Focus();
            }
            Cnx.Close();
        }
Exemple #2
0
 private void btn_eliminar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Eliminar = "DELETE FROM persona WHERE Id=@Id";
         OleDbCommand Cmd      = new OleDbCommand(Eliminar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", txt_id.Text);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("El Contacto Fue Eliminado....");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     txt_id.Clear();
     txt_nombre.Clear();
     txt_apellido.Clear();
     txt_domicilio.Clear();
     txt_colonia.Clear();
     txt_ciudad.Clear();
     txt_telcasa.Clear();
     txt_telmovil.Clear();
     txt_email.Clear();
     txt_email_empresarial.Clear();
     pic_foto.ImageLocation = "";
     txt_id.Focus();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            int    catId       = int.Parse(catID.Text);
            int    productId   = int.Parse(ID.Text);
            string productName = this.nom_du_produit.Text.Trim();
            double prix        = double.Parse(this.prix.Text);
            string description = this.description.Text.Trim();

            string query = "insert into produit values(" + productId + ",'" + productName + "'," + prix + " ," + catId + " ,'" + description + "')";

            Cnx.InsertData(sqliteCon, query);
            Cnx.populateTable(sqliteCon, "select * from produit", this.dataGridView1);

            SQLiteDataReader maxId = Cnx.getData(sqliteCon, "select MAX(id) from produit");

            if (maxId.Read())
            {
                int newId = maxId.GetInt32(0) + 1;
                this.ID.Text = newId.ToString();
            }


            this.ID.Text             = "";
            this.nom_du_produit.Text = "";
            this.prix.Text           = "";
            this.description.Text    = "";

            MessageBox.Show("Product Successfully Added");
        }
 public void Disconnect()
 {
     if (Cnx.State == ConnectionState.Open)
     {
         Cnx.Close();
     }
 }
Exemple #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    categorieId  = int.Parse(this.categorieID.Text.Trim());
            String categorieNom = this.categorie.Text.Trim();


            try
            {
                if (categorieNom == "")
                {
                    MessageBox.Show("Please Type a New Category Name to be added.");
                    Cnx.populateTable(sqliteCon, "select * from categories", this.dataGridView1);
                }
                else
                {
                    String query = "update categories set id=" + categorieId + ", nom_cat='" + categorieNom + "' where id=" + categorieId + ";";
                    Cnx.InsertData(sqliteCon, query);
                    Cnx.populateTable(sqliteCon, "select * from categories", this.dataGridView1);
                    setNeWCatId();
                    this.categorie.Text = "";
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Exemple #6
0
 private void btn_Eliminar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Eliminar = "DELETE FROM DBP WHERE Id=@Id";
         OleDbCommand Cmd      = new OleDbCommand(Eliminar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", idTextBox.Text);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("El Contacto Fue Eliminado....");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     idTextBox.Clear();
     nombreTextBox.Clear();
     apellidoTextBox.Clear();
     departamentoTextBox.Clear();
     turnoTextBox.Clear();
     contactoTextBox.Clear();
     pic_Empleado.ImageLocation = "";
     idTextBox.Focus();
 }
Exemple #7
0
        private void GestionDeCategorie_Load(object sender, EventArgs e)
        {
            setNeWCatId();
            String query = "select * from categories";

            Cnx.populateTable(sqliteCon, query, this.dataGridView1);
        }
Exemple #8
0
 private void btn_Agregar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Insertar = "Insert Into DBP Values (@Id, @Nombre,@Apellido, @Departamento, @Turno, @Contacto, @Imagen)";
         OleDbCommand Cmd      = new OleDbCommand(Insertar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", idTextBox.Text);
         Cmd.Parameters.AddWithValue("@Nombre", nombreTextBox.Text);
         Cmd.Parameters.AddWithValue("@Apellido", apellidoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Departamento", departamentoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Turno", turnoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Contacto", contactoTextBox.Text);
         pic_Empleado.ImageLocation = strFileName;
         Cmd.Parameters.AddWithValue("@Imagen", pic_Empleado.ImageLocation);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("El Contacto Fue Registrado");
     }
     catch (Exception ex)
     {
         MessageBox.Show("La Clave a Registrar Ya Existe", ex.Message);
     }
     idTextBox.Clear();
     nombreTextBox.Clear();
     apellidoTextBox.Clear();
     departamentoTextBox.Clear();
     turnoTextBox.Clear();
     contactoTextBox.Clear();
     pic_Empleado.ImageLocation = "";
     idTextBox.Focus();
 }
Exemple #9
0
        private void btn_Buscar_Click(object sender, EventArgs e)
        {
            string       BUSCAR    = "SELECT * FROM DBP WHERE Id=@Id";
            OleDbCommand CmdBuscar = new OleDbCommand(BUSCAR, Cnx);

            CmdBuscar.CommandType = CommandType.Text;
            CmdBuscar.Parameters.AddWithValue("@Id", idTextBox.Text);
            Cnx.Open();
            OleDbDataReader Lectura;

            Lectura = CmdBuscar.ExecuteReader();
            if (Lectura.Read() == true)
            {
                nombreTextBox.Text         = Lectura[1].ToString();
                apellidoTextBox.Text       = Lectura[2].ToString();
                departamentoTextBox.Text   = Lectura[3].ToString();
                turnoTextBox.Text          = Lectura[4].ToString();
                contactoTextBox.Text       = Lectura[5].ToString();
                pic_Empleado.ImageLocation = Lectura[6].ToString();
            }
            else
            {
                MessageBox.Show("Los Datos a Buscar No Estan Registrados");
                idTextBox.Clear();
                idTextBox.Focus();
            }
            Cnx.Close();
        }
Exemple #10
0
        private void BtnBuscar_Click_1(object sender, EventArgs e)
        {
            const string buscar    = "SELECT * FROM Vendedores WHERE IdVendedor=@Id";
            var          cmdBuscar = new OleDbCommand(buscar, Cnx)
            {
                CommandType = CommandType.Text
            };

            cmdBuscar.Parameters.AddWithValue("@Id", TxtId.Text);
            Cnx.Open();
            var lectura = cmdBuscar.ExecuteReader();

            if (lectura != null && lectura.Read() == true)
            {
                TxtNombre.Text            = lectura[1].ToString();
                TxtFechaAlta.Text         = lectura[2].ToString();
                TxtNIF.Text               = lectura[3].ToString();
                TxtFechaNac.Text          = lectura[4].ToString();
                TxtDireccion.Text         = lectura[5].ToString();
                TxtPoblacion.Text         = lectura[6].ToString();
                TxtTelefono.Text          = lectura[7].ToString();
                TxtEstadoCivil.Text       = lectura[8].ToString();
                pictureBox1.ImageLocation = lectura[9].ToString();
            }
            else
            {
                MessageBox.Show(@"Los Datos a Buscar No Estan Registrados");
                TxtId.Clear();
                TxtId.Focus();
            }
            Cnx.Close();
        }
Exemple #11
0
 private void BtnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         const string eliminar = "DELETE FROM Vendedores WHERE IdVendedor=@Id";
         var          cmd      = new OleDbCommand(eliminar, Cnx)
         {
             CommandType = CommandType.Text
         };
         cmd.Parameters.AddWithValue("@Id", TxtId.Text);
         Cnx.Open();
         cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show(@"El Contacto Fue Eliminado....");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     TxtId.Clear();
     TxtNombre.Clear();
     TxtFechaAlta.Clear();
     TxtNIF.Clear();
     TxtFechaNac.Clear();
     TxtDireccion.Clear();
     TxtPoblacion.Clear();
     TxtTelefono.Clear();
     TxtEstadoCivil.Clear();
     pictureBox1.ImageLocation = "";
     TxtId.Focus();
 }
Exemple #12
0
 private void btn_Modificar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Actualizar = "UPDATE DBP SET Id=@Id, Nombre=@Nombre,Apellido = @Apellido,Departamento = @Departamento,Turno = @Turno,Contacto = @Contacto,Imagen = @Imagen WHERE Id = @Id";
         OleDbCommand Cmd        = new OleDbCommand(Actualizar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", idTextBox.Text);
         Cmd.Parameters.AddWithValue("@Nombre", nombreTextBox.Text);
         Cmd.Parameters.AddWithValue("@Apellido", apellidoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Departamento", departamentoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Turno", turnoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Contacto", contactoTextBox.Text);
         Cmd.Parameters.AddWithValue("@Imagen", pic_Empleado.ImageLocation);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("Los Datos Del Contacto Fueron Actualizados");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     idTextBox.Clear();
     nombreTextBox.Clear();
     apellidoTextBox.Clear();
     departamentoTextBox.Clear();
     turnoTextBox.Clear();
     contactoTextBox.Clear();
     pic_Empleado.ImageLocation = "";
     idTextBox.Focus();
 }
        private void button3_Click(object sender, EventArgs e)
        {
            String username = this.username.Text.Trim();
            String query    = "Delete from accounts where username='******';";

            Cnx.InsertData(sqliteCon, query);

            getAccounts();
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string           selectedItem = this.comboBox1.SelectedItem.ToString();
            SQLiteDataReader dr2          = Cnx.getData(sqliteCon, "select * from categories where nom_cat='" + selectedItem + "'");

            if (dr2.Read())
            {
                this.catID.Text = dr2.GetInt32(0).ToString();
            }
        }
Exemple #15
0
 private void ItemAdd(SorteioItemInfo a, Cnx cnz)
 {
     if (a != null)
     {
         cnz.AddMySqlParameterCollection("@id", a.ID);
         cnz.AddMySqlParameterCollection("@prod", a.Prod.produtoid);
         cnz.AddMySqlParameterCollection("@sort", a.Sort.sorteioid);
         cnz.AddMySqlParameterCollection("@quant", a.Quant);
     }
 }
Exemple #16
0
 private void ProdutoAdd(ProdutoInfo a, Cnx cnz)
 {
     if (a != null)
     {
         cnz.AddMySqlParameterCollection("@id", a.produtoid);
         cnz.AddMySqlParameterCollection("@descricao", a.produtodescricao);
         cnz.AddMySqlParameterCollection("@foto", a.produtofoto);
         cnz.AddMySqlParameterCollection("@valor", a.produtovalor);
     }
 }
 private void ConcorrenteAdd(ConcorrenteInfo a, Cnx cnz)
 {
     if (a != null)
     {
         cnz.AddMySqlParameterCollection("@id", a.concorrenteid);
         cnz.AddMySqlParameterCollection("@cpf", a.concorrentecpf);
         cnz.AddMySqlParameterCollection("@nome", a.concorrentenome);
         cnz.AddMySqlParameterCollection("@email", a.concorrenteemail);
         cnz.AddMySqlParameterCollection("@tel", a.concorrentetelefone);
     }
 }
Exemple #18
0
 private void BilheteAdd(BilheteInfo a, Cnx cnz)
 {
     if (a != null)
     {
         cnz.AddMySqlParameterCollection("@id", a.bilheteid);
         cnz.AddMySqlParameterCollection("@conc", a.bilheteidconcorrente.concorrenteid);
         cnz.AddMySqlParameterCollection("@vend", a.bilheteidvendedor.concorrenteid);
         cnz.AddMySqlParameterCollection("@sort", a.bilheteidsorteio.sorteioid);
         cnz.AddMySqlParameterCollection("@num", a.bilhetenum);
     }
 }
Exemple #19
0
 private void SorteioAdd(SorteioInfo a, Cnx cnz)
 {
     if (a != null)
     {
         cnz.AddMySqlParameterCollection("@id", a.sorteioid);
         cnz.AddMySqlParameterCollection("@descricao", a.sorteiodescricao);
         cnz.AddMySqlParameterCollection("@quantb", a.sorteiobilhetequant);
         cnz.AddMySqlParameterCollection("@valor", a.sorteiobilhetevalor);
         cnz.AddMySqlParameterCollection("@sdata", a.sorteiodata);
     }
 }
Exemple #20
0
        public void ModifCase(int xPos, int yPos, int zPos, Map.TypeCase type, Cnx autoCnx)
        {
            Map map = FindMap(xPos, yPos, zPos);

            switch (type)
            {
            case Map.TypeCase.CASE_PLEINE:
                // Ajoute une salle
                if (!(xPos == xStart && yPos == yStart && zPos == nStart) && !(xPos == xGoal && yPos == yGoal && zPos == nGoal))
                {
                    SetCase(xPos, yPos, zPos, Map.TypeCase.CASE_PLEINE, autoCnx);
                }
                break;

            case Map.TypeCase.CASE_DEPART:
                // Positionne la salle de départ
                if (map == null)
                {
                    // on efface l'ancienne position et on affecte la nouvelle
                    SetCase(xStart, yStart, nStart, Map.TypeCase.CASE_VIDE, autoCnx);
                    SetCase(xPos, yPos, zPos, Map.TypeCase.CASE_DEPART, autoCnx);
                    SetStart(xPos, yPos, zPos);
                }
                break;

            case Map.TypeCase.CASE_ARRIVEE:
                // Positonne la salle d'arrivée
                if (map == null)
                {
                    // on efface l'ancienne position et on affecte la nouvelle
                    SetCase(xGoal, yGoal, nGoal, Map.TypeCase.CASE_VIDE, autoCnx);
                    SetCase(xPos, yPos, zPos, Map.TypeCase.CASE_ARRIVEE, autoCnx);
                    SetGoal(xPos, yPos, zPos);
                }
                break;

            case Map.TypeCase.CASE_VIDE:
                // Supprime une salle
                if (xPos == xStart & yPos == yStart && zPos == nStart)
                {
                    SetStart(-1, -1, -1);
                }

                if (xPos == xGoal && yPos == yGoal && zPos == nGoal)
                {
                    SetGoal(-1, -1, -1);
                }

                SetCase(xPos, yPos, zPos, Map.TypeCase.CASE_VIDE, autoCnx);
                break;
            }
        }
Exemple #21
0
        private void setNeWCatId()
        {
            String lastCategoryQuery = "SELECT * FROM categories WHERE id = (SELECT MAX(id) FROM categories);";

            SQLiteDataReader dr = Cnx.getData(sqliteCon, lastCategoryQuery);

            if (dr.Read())
            {
                int newId = dr.GetInt32(0) + 1;

                categorieID.Text = newId.ToString();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            String username = this.username.Text.Trim();
            String password = this.password.Text.Trim();
            String nom      = this.nom.Text.Trim();
            String prenom   = this.prenom.Text.Trim();
            String jobID    = this.comboBox1.SelectedItem.ToString();

            String query = "update accounts set username = '******', password='******',nom='" + nom + "',prenom='" + prenom + "',job_id='" + jobID + "' where username='******';";

            Cnx.InsertData(sqliteCon, query);

            getAccounts();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            int    productId = int.Parse(ID.Text);
            String query     = "Delete from produit where id=" + productId + ";";

            Cnx.InsertData(sqliteCon, query);
            Cnx.populateTable(sqliteCon, "select * from produit", this.dataGridView1);

            this.ID.Text             = "";
            this.nom_du_produit.Text = "";
            this.prix.Text           = "";
            this.description.Text    = "";

            MessageBox.Show("Product Successfully Deleted");
        }
        private void ManageProducts_Load(object sender, EventArgs e)
        {
            SQLiteDataReader dr    = Cnx.getData(sqliteCon, "select * from categories");
            SQLiteDataReader maxId = Cnx.getData(sqliteCon, "select MAX(id) from produit");

            while (dr.Read())
            {
                this.comboBox1.Items.Add(dr.GetString(1));
            }

            Cnx.populateTable(sqliteCon, "select * from produit", this.dataGridView1);
            if (maxId.Read())
            {
                int newId = maxId.GetInt32(0) + 1;
                this.ID.Text = newId.ToString();
            }
        }
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            foreach (DataGridViewRow dvr in dataGridView1.SelectedRows)
            {
                this.ID.Text             = dvr.Cells[0].Value.ToString();
                this.nom_du_produit.Text = dvr.Cells[1].Value.ToString();
                this.prix.Text           = dvr.Cells[2].Value.ToString();
                this.description.Text    = dvr.Cells[4].Value.ToString();

                int selectedCatId = int.Parse(dvr.Cells[3].Value.ToString());

                SQLiteDataReader dr2 = Cnx.getData(sqliteCon, "select * from categories where id=" + selectedCatId + "");
                if (dr2.Read())
                {
                    this.comboBox1.SelectedItem = dr2.GetString(1);
                }
            }
        }
Exemple #26
0
        private void button3_Click(object sender, EventArgs e)
        {
            int categorieId = int.Parse(this.categorieID.Text.Trim());



            try
            {
                String query = "Delete from categories where id=" + categorieId + ";";
                Cnx.InsertData(sqliteCon, query);
                Cnx.populateTable(sqliteCon, "select * from categories", this.dataGridView1);
                setNeWCatId();
                this.categorie.Text = "";
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Exemple #27
0
 private void btn_agregar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Insertar = "Insert Into persona Values (@Id, @Nombre,@Apellido, @CalleYNumero, @Colonia, @Ciudad, @TelCasa, @TelCel, @EmailPersonal,@EmailTrabajo, @Fotografia)";
         OleDbCommand Cmd      = new OleDbCommand(Insertar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", txt_id.Text);
         Cmd.Parameters.AddWithValue("@Nombre", txt_nombre.Text);
         Cmd.Parameters.AddWithValue("@Apellido", txt_apellido.Text);
         Cmd.Parameters.AddWithValue("@CalleYNumero", txt_domicilio.Text);
         Cmd.Parameters.AddWithValue("@Colonia", txt_colonia.Text);
         Cmd.Parameters.AddWithValue("@Ciudad", txt_ciudad.Text);
         Cmd.Parameters.AddWithValue("@TelCasa", txt_telcasa.Text);
         Cmd.Parameters.AddWithValue("@TelCel", txt_telmovil.Text);
         Cmd.Parameters.AddWithValue("@EmailPersonal",
                                     txt_email.Text);
         Cmd.Parameters.AddWithValue("@EmailTrabajo", txt_email_empresarial.Text);
         pic_foto.ImageLocation = strFileName;
         Cmd.Parameters.AddWithValue("@Fotografia", pic_foto.ImageLocation);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("El Contacto Fue Registrado");
     }
     catch (Exception ex)
     {
         MessageBox.Show("La Clave a Registrar Ya Existe", ex.Message);
     }
     txt_id.Clear();
     txt_nombre.Clear();
     txt_apellido.Clear();
     txt_domicilio.Clear();
     txt_colonia.Clear();
     txt_ciudad.Clear();
     txt_telcasa.Clear();
     txt_telmovil.Clear();
     txt_email.Clear();
     txt_email_empresarial.Clear();
     pic_foto.ImageLocation = "";
     txt_id.Focus();
 }
Exemple #28
0
 private void BtnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         const string insertar = @"Insert Into Vendedores Values (@IdVendedor, @NombreVendedor,
         @FechaAlta, @NIF, @FechaNac,@Direccion,@Poblacion,@Telefono,@EstadoCivil,@Fotografia)";
         var          cmd      = new OleDbCommand(insertar, Cnx)
         {
             CommandType = CommandType.Text
         };
         cmd.Parameters.AddWithValue("@IdVendedor", TxtId.Text);
         cmd.Parameters.AddWithValue("@NombreVendedor", TxtNombre.Text);
         cmd.Parameters.AddWithValue("@FechaAlta", TxtFechaAlta.Text);
         cmd.Parameters.AddWithValue("@NIF", TxtNIF.Text);
         cmd.Parameters.AddWithValue("@FechaNac", TxtFechaNac.Text);
         cmd.Parameters.AddWithValue("@Direccion", TxtDireccion.Text);
         cmd.Parameters.AddWithValue("@Poblacion", TxtPoblacion.Text);
         cmd.Parameters.AddWithValue("@Telefono", TxtTelefono.Text);
         cmd.Parameters.AddWithValue("@EstadoCivil", TxtEstadoCivil.Text);
         pictureBox1.ImageLocation = StrFileName;
         cmd.Parameters.AddWithValue("@Fotografia", pictureBox1.ImageLocation);
         Cnx.Open();
         cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show(@"El Contacto Fue Registrado");
     }
     catch (Exception ex)
     {
         MessageBox.Show(@"La Clave a Registrar Ya Existe", ex.Message);
     }
     TxtId.Clear();
     TxtNombre.Clear();
     TxtFechaAlta.Clear();
     TxtNIF.Clear();
     TxtFechaNac.Clear();
     TxtDireccion.Clear();
     TxtPoblacion.Clear();
     TxtTelefono.Clear();
     TxtEstadoCivil.Clear();
     pictureBox1.ImageLocation = "";
     TxtId.Focus();
 }
Exemple #29
0
 private void btn_modificar_Click(object sender, EventArgs e)
 {
     try
     {
         string       Actualizar = "UPDATE persona SET Id=@Id, Nombre=@Nombre, Apellido=@Apellido, CalleYNumero=@CalleYNumero, Colonia=@Colonia, Ciudad=@Ciudad, TelCasa=@TelCasa, TelCel=@TelCel, EmailPersonal=@EmailPersonal, EmailTrabajo=@EmailTrabajo, Fotografia=@Fotografia WHERE Id=@Id";
         OleDbCommand Cmd        = new OleDbCommand(Actualizar, Cnx);
         Cmd.CommandType = CommandType.Text;
         Cmd.Parameters.AddWithValue("@Id", txt_id.Text);
         Cmd.Parameters.AddWithValue("@Nombre", txt_nombre.Text);
         Cmd.Parameters.AddWithValue("@Apellido", txt_apellido.Text);
         Cmd.Parameters.AddWithValue("@CalleYNumero", txt_domicilio.Text);
         Cmd.Parameters.AddWithValue("@Colonia", txt_colonia.Text);
         Cmd.Parameters.AddWithValue("@Ciudad", txt_ciudad.Text);
         Cmd.Parameters.AddWithValue("@TelCasa", txt_telcasa.Text);
         Cmd.Parameters.AddWithValue("@TelCel", txt_telmovil.Text);
         Cmd.Parameters.AddWithValue("@EmailPersonal",
                                     txt_email.Text);
         Cmd.Parameters.AddWithValue("@EmailTrabajo", txt_email_empresarial.Text);
         Cmd.Parameters.AddWithValue("@Fotografia", pic_foto.ImageLocation);
         Cnx.Open();
         Cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show("Los Datos Del Contacto Fueron Actualizados");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
     txt_id.Clear();
     txt_nombre.Clear();
     txt_apellido.Clear();
     txt_domicilio.Clear();
     txt_colonia.Clear();
     txt_ciudad.Clear();
     txt_telcasa.Clear();
     txt_telmovil.Clear();
     txt_email.Clear();
     txt_email_empresarial.Clear();
     pic_foto.ImageLocation = "";
     txt_id.Focus();
 }
Exemple #30
0
 private void BtnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         const string actualizar = @"UPDATE Vendedores SET IdVendedor=@Id, NombreVendedor=@Nombre ,FechaAlta = @FechaAlta,
                             NIF = @NIF, FechaNac = @FechaNac, Direccion = @Direccion, Poblacion = @Poblacion,
                             Telefon = @Telefon, EstalCivil = @EstalCivil,Fotografia = @Fotografia WHERE IdVendedor = @Id";
         var          cmd        = new OleDbCommand(actualizar, Cnx)
         {
             CommandType = CommandType.Text
         };
         cmd.Parameters.AddWithValue("@Id", TxtId.Text);
         cmd.Parameters.AddWithValue("@Nombre", TxtNombre.Text);
         cmd.Parameters.AddWithValue("@FechaAlta", TxtFechaAlta.Text);
         cmd.Parameters.AddWithValue("@NIF", TxtNIF.Text);
         cmd.Parameters.AddWithValue("@FechaNac", TxtFechaNac.Text);
         cmd.Parameters.AddWithValue("@Direccion", TxtDireccion.Text);
         cmd.Parameters.AddWithValue("@Poblacion", TxtPoblacion.Text);
         cmd.Parameters.AddWithValue("@Telefon", TxtTelefono.Text);
         cmd.Parameters.AddWithValue("@EstalCivil", TxtEstadoCivil.Text);
         cmd.Parameters.AddWithValue("@Fotografia", pictureBox1.ImageLocation);
         Cnx.Open();
         cmd.ExecuteNonQuery();
         Cnx.Close();
         MessageBox.Show(@"Los Datos Del Contacto Fueron Actualizados");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     TxtId.Clear();
     TxtNombre.Clear();
     TxtFechaAlta.Clear();
     TxtNIF.Clear();
     TxtFechaNac.Clear();
     TxtDireccion.Clear();
     TxtPoblacion.Clear();
     TxtTelefono.Clear();
     TxtEstadoCivil.Clear();
     pictureBox1.ImageLocation = "";
     TxtId.Focus();
 }