Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String direccionTotal = txtCalle.Text + "; " + txtPiso.Text + "; " + txtDepto.Text + "; " + txtLocalidad.Text;

            if (txtRS.Text != "" && txtCUIT.Text != "" && cbxRubro.Text != "")
            {
                Proveedor miProveedor = new Proveedor(txtRS.Text,
                                                      txtEmail.Text,
                                                      Convert.ToDecimal(txtTelefono.Text),
                                                      direccionTotal,
                                                      txtCiudad.Text,
                                                      txtCUIT.Text,
                                                      cbxRubro.Text,
                                                      Convert.ToInt32(cbxRubro.SelectedValue),
                                                      txtContacto.Text,
                                                      txtPostal.Text);

                int resultado = AdmProveedores.AltaProveedor(miProveedor);
                if (resultado == -1)
                {
                    MessageBox.Show("Ya existe un proveedor con este CUIT: " + txtCUIT.Text);
                }
                limpiarcampos();
            }
            else
            {
                MessageBox.Show("Complete todos los campos obligatorios");
            }
        }
Esempio n. 2
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     if (txtRS.Text != "")
     {
         String    direccionTotal = txtCalle.Text + "; " + txtPiso.Text + "; " + txtDepto.Text + "; " + txtLocalidad.Text;
         Proveedor miProve        = new Proveedor(txtRS.Text,
                                                  txtEmail.Text,
                                                  Convert.ToDecimal(txtTelefono.Text),
                                                  direccionTotal,
                                                  txtCiudad.Text,
                                                  txtCUIT.Text,
                                                  cbxRubro.Text,
                                                  idRubroPosta,
                                                  txtContacto.Text,
                                                  txtPostal.Text);
         AdmProveedores.modificarProveedor(miProve);
         limpiarCampos();
         this.Hide();
         VerProveedores vp = new VerProveedores();
         vp.Show();
     }
     else
     {
         MessageBox.Show("Complete los campos obligatorios");
     }
 }
Esempio n. 3
0
        private void ModificarProveedor_Load(object sender, EventArgs e)
        {
            CUIT = VerProveedores.cuitSeleccionado;
            //        CUIT = "felofelipe";

            txtCUIT.Text = CUIT;

            cbxRubro.DataSource    = AdmRubro.obtenerRubros().Tables[0];
            cbxRubro.DisplayMember = "Rubro_Descripcion";
            cbxRubro.ValueMember   = "idRubro";

            Proveedor proveedor = AdmProveedores.obtenerProveedor(CUIT);

            txtRS.Text       = proveedor.razon_social;
            txtTelefono.Text = proveedor.telefono.ToString();
            txtEmail.Text    = proveedor.email;
            txtCiudad.Text   = proveedor.ciudad;
            txtContacto.Text = proveedor.contacto;
            txtPostal.Text   = proveedor.postal;
            cbxRubro.Text    = proveedor.rubro;
            idRubroPosta     = proveedor.idRubro;
            parseoDireccion(proveedor.direccion);

            this.Controls.Add(Form1.MainMenu);
        }
Esempio n. 4
0
 private void PublicarOferta_Load(object sender, EventArgs e)
 {
     this.Controls.Add(Form1.MainMenu);
     if (AdmRol.rolDerivaDe(ElegirRol.rolElegido) == 3)
     {
         dgvProve.Hide();
         lblSeleccioneProv.Hide();
     }
     else
     {
         dgvProve.DataSource = AdmProveedores.obtenerProveedoresRS().Tables[0];
     }
 }
Esempio n. 5
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            if (txtDesc.Text != "" && txtPrecioLista.Text != "" && txtPrecioOferta.Text != "" && txtCantidad.Text != "" && txtCodigo.Text != "")
            {
                Oferta of;
                if (ProveSeleccionado != "")
                {
                    of = new Oferta(txtCodigo.Text, Convert.ToDecimal(txtPrecioOferta.Text), Convert.ToDecimal(txtPrecioLista.Text),
                                    dtpFechaPub.Value.Date, dtpFechaVec.Value.Date, Convert.ToDecimal(txtCantidad.Text), txtDesc.Text,
                                    1, ProveSeleccionado, Convert.ToDecimal(txtCantxCli.Text));
                }
                else
                {
                    of = new Oferta(txtCodigo.Text, Convert.ToDecimal(txtPrecioOferta.Text), Convert.ToDecimal(txtPrecioLista.Text),
                                    dtpFechaPub.Value.Date, dtpFechaVec.Value.Date, Convert.ToDecimal(txtCantidad.Text), txtDesc.Text,
                                    1, AdmProveedores.obtenerCuitDelUsuario(Login.username), Convert.ToDecimal(txtCantxCli.Text));
                }

                int filas = AdmOfertas.altaOferta(of);
                if (filas > 0)
                {
                    MessageBox.Show("Oferta creada correctamente");
                    Form1 f1 = new Form1();
                    f1.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Error en la creacion");
                }
            }
            else
            {
                MessageBox.Show("Complete todos los campos obligatorios");
            }
        }
Esempio n. 6
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            int     retorno;
            Usuario miUser;

            switch (AdmRol.rolDerivaDe(Convert.ToInt32(AdmRol.obtenerRoles(cbxRol.Text).Tables[0].Rows[0]["id_Rol"].ToString())))
            {
            case 2:
                if (txtApellido.Text != "" && txtDNI.Text != "" && txtNombre.Text != "")
                {
                    miUser = new Usuario(txtUsuario.Text, txtContrasenia.Text, Convert.ToDecimal(txtDNI.Text), null);
                    Cliente miClie = new Cliente(Convert.ToDecimal(txtDNI.Text),
                                                 txtNombre.Text,
                                                 txtApellido.Text,
                                                 (txtEmail.Text ?? " "),
                                                 txtDireccion.Text ?? " ",
                                                 txtCiudad.Text ?? " ",
                                                 Convert.ToDateTime(dtpNacimiento.Text ?? ""),
                                                 Convert.ToDecimal(txtTelefono.Text ?? "0"),
                                                 txtPostal.Text ?? " ",
                                                 txtLocalidad.Text ?? " ");

                    int filas = AdmClientes.altaCliente(miClie);
                    if (filas > 0)
                    {
                        retorno = AdmUsuario.altaUsuario(miUser, (Convert.ToInt32(AdmRol.obtenerRoles(cbxRol.Text).Tables[0].Rows[0]["id_Rol"].ToString())));
                        if (retorno == -1)
                        {
                            MessageBox.Show("Ya existe el usuario: " + txtUsuario.Text);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error en la creacion del cliente");
                    }
                }
                else
                {
                    MessageBox.Show("Complete todos los campos obligatorios");
                }


                break;

            case 3:
                String direccionTotal = txtPisoP.Text + "; " + txtPisoP.Text + "; " + txtDeptoP.Text + "; " + txtLocalidad.Text;
                miUser = new Usuario(txtUsuario.Text, txtContrasenia.Text, Convert.ToDecimal(null), txtCUIT.Text);
                Proveedor miProvee = new Proveedor(txtRS.Text,
                                                   txtEmailP.Text,
                                                   Convert.ToDecimal(txtTelefonoP.Text),
                                                   direccionTotal,
                                                   txtCiuP.Text,
                                                   txtCUIT.Text,
                                                   cbxRubro.Text,
                                                   Convert.ToInt32(cbxRubro.SelectedValue),
                                                   txtContacto.Text,
                                                   txtPostalP.Text);
                AdmProveedores.AltaProveedor(miProvee);
                retorno = AdmUsuario.altaUsuario(miUser, (Convert.ToInt32(AdmRol.obtenerRoles(cbxRol.Text).Tables[0].Rows[0]["id_Rol"].ToString())));
                if (retorno == -1)
                {
                    MessageBox.Show("Ya existe el usuario: " + txtUsuario.Text);
                }
                break;

            case 1:
                miUser  = new Usuario(txtUsuario.Text, txtContrasenia.Text, Convert.ToDecimal(null), null);
                retorno = AdmUsuario.altaUsuario(miUser, (Convert.ToInt32(AdmRol.obtenerRoles(cbxRol.Text).Tables[0].Rows[0]["id_Rol"].ToString())));
                if (retorno == -1)
                {
                    MessageBox.Show("Ya existe el usuario: " + txtUsuario.Text);
                }
                break;
            }

            vaciarTxt();
            Login fl = new Login();

            fl.Show();
            this.Hide();
        }