Exemplo n.º 1
0
        public ClsGrud(int id)
        {
            ClsGrud aux = listaLG.Find(lc => lc.ID == id);

            _Id         = aux.ID;
            _Cliente    = aux.CLIENTE;
            _Pedido     = aux.PEDIDO;
            _Quantidade = aux.QUANTIDADE;
            _Preco      = aux.PREÇO;
            _Total      = aux.TOTAL;
        }
Exemplo n.º 2
0
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int id;

            id = (int)dgv["ID", e.RowIndex].Value;
            ClsGrud aux = new ClsGrud(id);

            txtid.Text      = aux.ID.ToString();
            txtcliente.Text = aux.CLIENTE;
            txtpedido.Text  = aux.PEDIDO;
            txtquantde.Text = aux.QUANTIDADE.ToString();
            txtvalor.Text   = aux.PREÇO.ToString();
            txttotal.Text   = aux.TOTAL.ToString();
        }
Exemplo n.º 3
0
 private void btnsalvar_Click(object sender, EventArgs e)
 {
     txtcliente.Focus();
     if (txtid.Text.Length == 0)
     {
         ClsGrud aux = new ClsGrud(
             txtcliente.Text, txtpedido.Text, int.Parse(txtquantde.Text), float.Parse(txtvalor.Text),
             float.Parse(txttotal.Text = Convert.ToString(int.Parse(txtquantde.Text) * float.Parse(txtvalor.Text))));
         aux.Inserir();
     }
     else
     {
         ClsGrud aux = new ClsGrud(int.Parse(txtid.Text),
                                   txtcliente.Text, txtpedido.Text, int.Parse(txtquantde.Text), float.Parse(txtvalor.Text),
                                   float.Parse(txttotal.Text = Convert.ToString(int.Parse(txtquantde.Text) * float.Parse(txtvalor.Text))));
         aux.Alterar();
     }
     Preencherdgv(ClsGrud.Consultar());
     LimpaTextBox();
 }
Exemplo n.º 4
0
 private void btnpesquisar_Click(object sender, EventArgs e)
 {
     Preencherdgv(ClsGrud.Consultar(txtcliente_pesquisar.Text));
 }
Exemplo n.º 5
0
 private void frmGRUD_Load(object sender, EventArgs e)
 {
     dgv.DataSource = ClsGrud.Consultar();
 }