private void seleccionar()
        {
            FAdministrador oAdmin = (FAdministrador)Application.OpenForms["FAdministrador"];

            oAdmin.idClien         = Convert.ToInt32(dgvClien.SelectedRows[0].Cells[0].Value.ToString());
            oAdmin.tbFCliente.Text = dgvClien.SelectedRows[0].Cells[1].Value.ToString();
            oAdmin.tbFTel.Text     = dgvClien.SelectedRows[0].Cells[3].Value.ToString();
            oAdmin.tbFDni.Text     = dgvClien.SelectedRows[0].Cells[4].Value.ToString();
            oAdmin.tbFDirec.Text   = dgvClien.SelectedRows[0].Cells[5].Value.ToString();

            oAdmin.btnFBuscarCli.Enabled       = false;
            oAdmin.btnFBuscarProd.Enabled      = true;
            oAdmin.btnFCancelarFactura.Enabled = true;
            oAdmin.panelFDetalle.Enabled       = true;

            this.Close();
        }
        private void seleccionar()
        {
            FAdministrador oAdmin = (FAdministrador)Application.OpenForms["FAdministrador"];

            oAdmin.idProducto       = Convert.ToInt32(dgvProd.SelectedRows[0].Cells[0].Value.ToString());
            oAdmin.stock            = Convert.ToDecimal(dgvProd.SelectedRows[0].Cells[3].Value.ToString());
            oAdmin.tbFArticulo.Text = dgvProd.SelectedRows[0].Cells[1].Value.ToString();
            oAdmin.tbFPrecio.Text   = dgvProd.SelectedRows[0].Cells[5].Value.ToString();

            if (dgvProd.SelectedRows[0].Cells[4].Value.ToString() == "Ud")
            {
                oAdmin.unidadKg         = false;
                oAdmin.tbFPeso.Enabled  = false;
                oAdmin.lblFKg.Enabled   = false;
                oAdmin.lblFPeso.Enabled = false;
            }
            else if (dgvProd.SelectedRows[0].Cells[4].Value.ToString() == "Kg")
            {
                oAdmin.unidadKg         = true;
                oAdmin.tbFPeso.Enabled  = true;
                oAdmin.lblFKg.Enabled   = true;
                oAdmin.lblFPeso.Enabled = true;
            }

            foreach (DataGridViewRow row in oAdmin.dgvFacturacion.Rows)
            {
                if (Convert.ToString(row.Cells[1].Value) == oAdmin.tbFArticulo.Text)
                {
                    MessageBox.Show("Producto ya ingresado", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    oAdmin.limpiarProdFacturac();
                    oAdmin.btnFAceptar.Enabled = false;
                    oAdmin.lblFKg.Enabled      = false;
                    oAdmin.lblFPeso.Enabled    = false;
                    oAdmin.tbFPeso.Enabled     = false;
                    break;
                }
            }
            this.Close();
            oAdmin.btnFAceptar.Enabled = true;
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            using (GestionVentasEntities db = new GestionVentasEntities())
            {
                int bandera = 0;
                foreach (var user in db.usuario)
                {
                    if (user.nomusuario.Replace(" ", "") == tbUsuario.Text && user.contraseña.Replace(" ", "") == tbContraseña.Text && user.estado == 1)
                    {
                        int perfil = user.tipo_usuario.idtipousuario;
                        idusuario = user.idusuario;
                        nombre    = user.apeynom;

                        switch (perfil)
                        {
                        case 1:
                            bandera = 1;
                            this.Hide();
                            FAdministrador FAdmin = new FAdministrador(idusuario, nombre);
                            FAdmin.Show();        //FAdmin.ShowDialog();
                            //this.Close();
                            break;

                        case 2:
                            bandera = 1;
                            this.Hide();
                            FVendedor FVend = new FVendedor(idusuario, nombre);
                            FVend.Show();        //FVend.ShowDialog();
                            //this.Close();
                            break;

                        case 3:
                            bandera = 1;
                            this.Hide();
                            FSuperadministrador FSupAd = new FSuperadministrador(idusuario, nombre);
                            FSupAd.Show();        //FSupAd.ShowDialog();
                            //this.Close();
                            break;

                        case 4:
                            bandera = 1;
                            this.Hide();
                            FSupervisor FSupVi = new FSupervisor(idusuario, nombre);
                            FSupVi.Show();        //FSupVi.ShowDialog();
                            //this.Close();
                            break;

                        default:
                            bandera = 1;
                            break;
                        }
                    }
                }
                if (bandera == 0)
                {
                    MessageBox.Show("Datos incorrectos", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tbUsuario.Focus();
                    tbContraseña.Clear();
                }
            }
        }