예제 #1
0
        private void btnHome_Click(object sender, EventArgs e)
        {
            if (this.accion.Equals(5))
            {
                this.Hide();
                Productos product = new Productos();
                product.Id          = this.id;
                product.Nombre      = this.nombre;
                product.Rol         = this.rol;
                product.IdProve     = this.idprove;
                product.NombreProve = this.nombreprove;
                product.Accion      = this.accion;
                product.Show();
            }
            else if (this.accion.Equals(6))
            {
                this.Hide();
                Productos product = new Productos();
                product.Id          = this.id;
                product.Nombre      = this.nombre;
                product.Rol         = this.rol;
                product.IdProve     = this.idprove;
                product.NombreProve = this.nombreprove;
                product.Accion      = this.accion;
                /**/
                product.Codigo       = this.codigo;
                product.Nombreproduc = this.nombreproduc;
                product.Marca        = this.marca;
                product.Modelo       = this.modelo;
                product.Serie        = this.serie;
                product.Idproduc     = this.idproduc;
                product.Categoria    = this.categoria;
                product.Maxima       = this.maxima;
                product.Minima       = this.minima;
                product.Pv           = this.pv;
                product.Pc           = this.pc;

                product.Show();
            }
            else
            {
                this.Hide();
                Menu menu = new Ventas.Menu();
                menu.Id     = this.id;
                menu.Nombre = this.nombre;
                menu.Rol    = this.rol;
                menu.Show();
            }
        }

        private void Proveedor_Load(object sender, EventArgs e)
        {
            todo();

            if (this.accion.Equals(1))
            {
                lblTitulo.Text           = "Registro de Proveedor";
                lblRazon.Text            = "Proveedor";
                lblReg.Text              = "# DUI";
                lblId.Visible            = false;
                txtId.Visible            = false;
                lblClasificacion.Visible = false;
                txtClasificacion.Visible = false;
                btnActualizar.Visible    = false;
                btnEliminar.Visible      = false;
                lblTipo.Visible          = false;
                checGrande.Visible       = false;
                chekMediano.Visible      = false;
                chekPeque.Visible        = false;
                /*para buscar*/
                lblBuscar.Visible = false;
                btnBuscar.Visible = false;
                btnTodos.Visible  = false;
                txtbuscar.Visible = false;
                /*para avilitar los campos*/
                txtNombre.Enabled    = true;
                txtDireccion.Enabled = true;
                txtRazon.Enabled     = true;
                txtNIt.Enabled       = true;
                txtReg.Enabled       = true;
                txtCorreo.Enabled    = true;
                txtTelefono.Enabled  = true;
                btnGuardar.Enabled   = true;
            }
            else if (this.accion.Equals(2))
            {
                lblTitulo.Text           = "Registro de Proveedor";
                lblReg.Text              = "# Registro";
                lblId.Visible            = false;
                txtId.Visible            = false;
                lblClasificacion.Visible = false;
                txtClasificacion.Visible = false;
                btnActualizar.Visible    = false;
                btnEliminar.Visible      = false;
                lblBuscar.Visible        = false;
                btnBuscar.Visible        = false;
                btnTodos.Visible         = false;
                /*para buscar*/
                lblBuscar.Visible = false;
                btnBuscar.Visible = false;
                btnTodos.Visible  = false;
                txtbuscar.Visible = false;
                /*para avilitar los campos*/
                txtNombre.Enabled    = true;
                txtDireccion.Enabled = true;
                txtRazon.Enabled     = true;
                txtNIt.Enabled       = true;
                txtReg.Enabled       = true;
                txtCorreo.Enabled    = true;
                txtTelefono.Enabled  = true;
                btnGuardar.Enabled   = true;
            }
            else if (this.accion.Equals(3))
            {
                lblTitulo.Text        = "Busqueda de Proveedor";
                lblBuscar.Text        = "Busqueda x Registro o DUI";
                groupBox1.Visible     = false;
                btnActualizar.Visible = false;
                btnEliminar.Visible   = false;
                btnGuardar.Visible    = false;
            }
            else if (this.accion.Equals(4))
            {
                lblTitulo.Text      = "Mantenimiento de Proveedor";
                lblBuscar.Text      = "Busqueda x Registro o DUI";
                lblTipo.Visible     = false;
                checGrande.Visible  = false;
                chekMediano.Visible = false;
                chekPeque.Visible   = false;
                btnGuardar.Visible  = false;
            }
            else if (this.accion.Equals(5))
            {
                lblTitulo.Text        = "Agregar  Proveedor";
                lblBuscar.Text        = "Busqueda x Registro o DUI";
                btnActualizar.Visible = false;
                btnEliminar.Visible   = false;
                lblTipo.Visible       = false;
                checGrande.Visible    = false;
                chekMediano.Visible   = false;
                chekPeque.Visible     = false;
            }
            else if (this.accion.Equals(6))
            {
                lblTitulo.Text        = "Agregar  Proveedor";
                lblBuscar.Text        = "Busqueda Nombre de proveedor";
                btnActualizar.Visible = false;
                btnEliminar.Visible   = false;
                lblTipo.Visible       = false;
                checGrande.Visible    = false;
                chekMediano.Visible   = false;
                chekPeque.Visible     = false;
                txtbuscar.Text        = this.nombreprove;
            }
        }
예제 #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text.Equals("") || txtDireccion.Text.Equals("") || txtRazon.Text.Equals("") || txtNIt.Text.Equals("") || txtReg.Text.Equals("") || txtCorreo.Equals("") || txtTelefono.Equals(""))
            {
                MessageBox.Show("Tiene campos Vacios");
            }
            else if (this.accion.Equals(1))
            {
                modelo.Proveedor prove = new modelo.Proveedor();
                prove.Nombre        = txtNombre.Text;
                prove.Direccion     = txtDireccion.Text;
                prove.Razon         = txtRazon.Text;
                prove.Nit           = txtNIt.Text;
                prove.Registro      = txtReg.Text;
                prove.Email         = txtCorreo.Text;
                prove.Telefono      = txtTelefono.Text;
                prove.Clasificacion = 4;
                prove.insertar();
                if (prove.Msg.Equals("Proveedor Creado"))
                {
                    MessageBox.Show(prove.Msg);
                    todo();
                    limipar();
                }
                else
                {
                    MessageBox.Show(prove.Msg);
                }
            }
            else if (this.accion.Equals(2))
            {
                if (checGrande.Checked && chekMediano.Checked && chekPeque.Checked || checGrande.Checked && chekMediano.Checked || checGrande.Checked && chekPeque.Checked || chekMediano.Checked && chekPeque.Checked)
                {
                    MessageBox.Show("Solo deve de selecciona un tipo ");
                }
                else if (chekPeque.Checked.Equals(false) && checGrande.Checked.Equals(false) && chekMediano.Checked.Equals(false))
                {
                    MessageBox.Show("Selecione un Tipo de Proveedor");
                }
                else
                {
                    modelo.Proveedor prove = new modelo.Proveedor();
                    prove.Nombre    = txtNombre.Text;
                    prove.Direccion = txtDireccion.Text;
                    prove.Razon     = txtRazon.Text;
                    prove.Nit       = txtNIt.Text;
                    prove.Registro  = txtReg.Text;
                    prove.Email     = txtCorreo.Text;
                    prove.Telefono  = txtTelefono.Text;
                    if (chekPeque.Checked)
                    {
                        prove.Clasificacion = 1;
                    }
                    else if (chekMediano.Checked)
                    {
                        prove.Clasificacion = 2;
                    }
                    else
                    {
                        prove.Clasificacion = 3;
                    }
                    prove.insertar();
                    if (prove.Msg.Equals("Proveedor Creado"))
                    {
                        MessageBox.Show(prove.Msg);
                        todo();
                        limipar();
                    }
                    else
                    {
                        MessageBox.Show(prove.Msg);
                    }
                }
            }
            else if (this.accion.Equals(5))
            {
                this.Hide();
                MessageBox.Show("Proveedor agregado");
                Productos product = new Productos();
                product.Id          = this.id;
                product.Nombre      = this.nombre;
                product.Rol         = this.rol;
                product.IdProve     = Convert.ToInt32(txtId.Text);
                product.NombreProve = txtNombre.Text;
                product.Accion      = this.accion;
                product.Show();
            }
            else if (this.accion.Equals(6))
            {
                this.Hide();
                Productos product = new Productos();
                product.Id          = this.id;
                product.Nombre      = this.nombre;
                product.Rol         = this.rol;
                product.IdProve     = Convert.ToInt32(txtId.Text);
                product.NombreProve = txtNombre.Text;
                product.Accion      = this.accion;
                /**/
                product.Codigo       = this.codigo;
                product.Nombreproduc = this.nombreproduc;
                product.Marca        = this.marca;
                product.Modelo       = this.modelo;
                product.Serie        = this.serie;
                product.Idproduc     = this.idproduc;
                product.Categoria    = this.categoria;
                product.Maxima       = this.maxima;
                product.Minima       = this.minima;
                product.Pv           = this.pv;
                product.Pc           = this.pc;

                product.Show();
            }
        }