Exemplo n.º 1
0
 private void button14_Click(object sender, EventArgs e)//Desbloquear usuario
 {
     if (MessageBox.Show("¿Seguro que desea desbloquear el cliente?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (txtDesbloquear.Text != "" && txtDesbloquear.Text != _user.Login)
         {
             string  _res = "";
             Usuario _aux = new Usuario();
             _aux.Login = txtDesbloquear.Text;
             _co.Abrir();
             bool _encontrado = _co.BuscarUsuario(_aux, ref _res);
             _co.Cerrar();
             if (_encontrado)
             {
                 this.Enabled = false;
                 _eli         = new Eliminar();
                 string _texto = "Escriba su contraseña para confirmar";
                 _eli.InicializarDesbloquear(_co, _aux, this, _texto, _user.Password);
                 _eli.Show();
                 txtDesbloquear.Clear();
             }
             else
             {
                 MessageBox.Show("El usuario no se encuentra en el sistema", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Error en el login", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 2
0
        private void dgvNota_CellContentClick(object sender, DataGridViewCellEventArgs e)//Notas
        {
            DataGridView dgv = (DataGridView)sender;

            if (dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                switch (e.ColumnIndex)
                {
                //Abonar
                case 5:
                    _cantidad = new Cantidad();
                    int max = Convert.ToInt32(Convert.ToDouble(dgv[2, e.RowIndex].Value));
                    _cantidad.InicializarMain(this, max, e.RowIndex, 1);
                    _cantidad.Show();
                    this.Enabled = false;
                    break;

                //Detalles
                case 6:
                    this.Enabled = false;
                    Nota _aux = new Nota();
                    _aux.Id_Nota = Convert.ToInt32(dgv[0, e.RowIndex].Value);
                    string _res = "";

                    _co.Abrir();
                    _co.AtraparNota(_aux.Id_Nota, ref _aux, ref _res);
                    _co.Cerrar();

                    _deNota = new DetallesNota();
                    _deNota.Inicializar(this, _co, _cli, _aux);
                    _deNota.Show();
                    break;

                //Liquidar
                case 7:
                    if (_user.NumTipo == 0)
                    {
                        Nota _no = new Nota();
                        _no.Id_Nota = Convert.ToInt32(dgv[0, e.RowIndex].Value);
                        string _clave = "LIQUIDAR";
                        string _texto = "Escriba \"LIQUIDAR\" para Confirmar";
                        _eli = new Eliminar();
                        _eli.InicializarNota(_co, _no, this, _texto, _clave);
                        _eli.Show();
                        this.Enabled = false;
                        break;
                    }
                    else
                    {
                        MessageBox.Show("No se cuenta con permisos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;
                }
            }
        }
Exemplo n.º 3
0
        private void dgvPedidos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            if (dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                switch (e.ColumnIndex)
                {
                case 7:
                    string _res = "";
                    _ped           = new Pedido();
                    _ped.Id_Pedido = Convert.ToInt32(dgv[0, e.RowIndex].Value);
                    _co.Abrir();
                    _co.AtraparPedido(_ped.Id_Pedido, ref _ped, ref _res);
                    _co.Cerrar();

                    _co.Abrir();
                    _co.AtraparCliente(_ped.Id_Cliente, ref _cli, ref _res);
                    _co.Cerrar();

                    this.Enabled = false;
                    _dePed       = new DetallesPedido();
                    _dePed.Inicializar(this, _co, _ped, _cli);
                    _dePed.Show();
                    break;

                case 8:
                    if (_user.NumTipo == 0)
                    {
                        _res           = "";
                        _ped           = new Pedido();
                        _ped.Id_Pedido = Convert.ToInt32(dgv[0, e.RowIndex].Value);
                        _co.Abrir();
                        _co.AtraparPedido(_ped.Id_Pedido, ref _ped, ref _res);
                        _co.Cerrar();
                        this.Enabled = false;
                        _eli         = new Eliminar();
                        _eli.InicializarPedido(_co, _ped, this, "Escribir \"LIQUIDAR\" para confirmar", "LIQUIDAR");
                        _eli.Show();
                        break;
                    }
                    else
                    {
                        MessageBox.Show("el usuario no tiene permisos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    break;
                }
            }
        }
Exemplo n.º 4
0
        private void dgvPredido_CellContentClick(object sender, DataGridViewCellEventArgs e)//Clic en Pedidos
        {
            DataGridView dgv = (DataGridView)sender;

            if (dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                switch (e.ColumnIndex)
                {
                //caso Detalles
                case 7:
                    this.Enabled = false;
                    _dePed       = new DetallesPedido();

                    string _res = "";
                    _co.Abrir();
                    _co.AtraparPedido(Convert.ToInt32(dgv[0, e.RowIndex].Value), ref _ped, ref _res);
                    _co.Cerrar();

                    _dePed.Inicializar(this, _co, _ped, _cli);
                    _dePed.Show();
                    break;

                //caso Liquidar
                case 8:
                    if (_user.NumTipo == 0)
                    {
                        this.Enabled = false;
                        _res         = "";
                        _co.Abrir();
                        _co.AtraparPedido(Convert.ToInt32(dgv[0, e.RowIndex].Value), ref _ped, ref _res);
                        _co.Cerrar();

                        _eli = new Eliminar();
                        string _clave = "LIQUIDAR";
                        string _text  = "Escriba \"LIQUIDAR\" para confirmar";
                        _eli.InicializarPedido(_co, _ped, this, _text, _clave);
                        _eli.Show();
                        break;
                    }
                    else
                    {
                        MessageBox.Show("el usuario no tiene permisos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;
                }
            }
        }