Example #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            ClsProveedor Instancia = new ClsProveedor();

            Instancia.Nombre    = txtNombre.Text.Trim();
            Instancia.Direccion = txtDireccion.Text.Trim();
            Instancia.RFC       = txtRFC.Text.Trim();
            Instancia.CP        = txtCP.Text.Trim();



            int respuesta = ClsProveedor.Guardar(Instancia);

            if (respuesta > 0)
            {
                MessageBox.Show("Datos guardados con exito!!", "Datos guardados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MostrarDatos_dgvProveedor();
                txtNombre.Text    = "";
                txtCP.Text        = "";
                txtDireccion.Text = "";
                txtRFC.Text       = "";
            }
            else
            {
                MessageBox.Show("No se pudo guardar los datos del cliente", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Esta Seguro que desea eliminar el Proveedor Actual", "Esta Seguro??", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ClsProveedor Instancia = new ClsProveedor();
                Instancia.IdProveedor = Convert.ToInt32(txtIdp.Text);

                if (ClsProveedor.Eliminar(Instancia.IdProveedor) > 0)
                {
                    MessageBox.Show("Proveedor Eliminado Correctamente!", "Proveedor Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MostrarDatos_dgvProveedor();
                    txtNombre.Text    = "";
                    txtCP.Text        = "";
                    txtDireccion.Text = "";
                    txtRFC.Text       = "";
                }
                else
                {
                    MessageBox.Show("No se pudo eliminar el Proveedor", "Proveedor No Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Se cancelo la eliminacion", "Eliminacion Cancelada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #3
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            ClsProveedor Instancia = new ClsProveedor();

            Instancia.Nombre    = txtNombre.Text.Trim();
            Instancia.Direccion = txtDireccion.Text.Trim();
            Instancia.RFC       = txtRFC.Text.Trim();
            Instancia.CP        = txtCP.Text.Trim();

            Instancia.IdProveedor = Convert.ToInt32(txtIdp.Text);


            int respuesta = ClsProveedor.Actualizar(Instancia);

            if (respuesta > 0)
            {
                MessageBox.Show("Los datos del Jefe se actualizaron", "Datos Actualizados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MostrarDatos_dgvProveedor();
                txtNombre.Text    = "";
                txtCP.Text        = "";
                txtDireccion.Text = "";
                txtRFC.Text       = "";
            }
            else
            {
                MessageBox.Show("No se pudo actualizar", "Error al Actualizar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #4
0
        //Funcion guardar
        public static int Guardar(ClsProveedor variable)
        {
            int             bandera  = 0;
            MySqlConnection conexion = ClsConexion.ObtenerConexion();
            MySqlCommand    comando  = new MySqlCommand(string.Format("INSERT INTO tblproveedor (intIdProveedor, vchNombre, vchUbicacion,vchRFC,vchCP) VALUES ('{0}','{1}','{2}', '{3}','{4}')",
                                                                      variable.IdProveedor, variable.Nombre, variable.Direccion, variable.RFC, variable.CP), conexion);

            bandera = comando.ExecuteNonQuery();
            conexion.Close();
            return(bandera);
        }
Example #5
0
        //--------------------------------------------------------------------------
        public static int Actualizar(ClsProveedor variable)
        {
            int             bandera  = 0;
            MySqlConnection conexion = ClsConexion.ObtenerConexion();

            MySqlCommand comando = new MySqlCommand(string.Format("Update tblproveedor set vchNombre='{0}', vchUbicacion='{1}',vchRFC='{2}',vchCP='{3}' where intIdProveedor={4}",
                                                                  variable.Nombre, variable.Direccion, variable.RFC, variable.CP, variable.IdProveedor), conexion);

            bandera = comando.ExecuteNonQuery();
            conexion.Close();
            return(bandera);
        }
Example #6
0
        public void MostrarDatos_dgvProveedor()
        {
            dgvProveedor.DataSource = ClsProveedor.MostrarDatos();

            dgvProveedor.Columns[0].HeaderText = "IdProveedor";
            dgvProveedor.Columns[1].HeaderText = "Nombre";
            dgvProveedor.Columns[2].HeaderText = "Ubicacion";
            dgvProveedor.Columns[3].HeaderText = "RFC";
            dgvProveedor.Columns[4].HeaderText = "CP";


            dgvProveedor.Columns[0].Visible = false;
        }