예제 #1
0
        private void btnRemove_Click_1(object sender, EventArgs e)
        {
            if (row >= 0)
            {
                if (isAdminActive == false)
                {
                    FrmPassAdmin frm = new FrmPassAdmin(this);
                    frm.ShowDialog();
                }
                else
                {
                    ProductsSelectedSell item = _productsSelectedSellController.ListALL()[gVProductsSelected.FocusedRowHandle];

                    if (item.Quantidade > 1)
                    {
                        item.Quantidade--;
                        _productsSelectedSellController.update(item);
                    }
                    else
                    {
                        _productsSelectedSellController.delete(item);
                    }
                    updateGrid(gVProductsSelected.FocusedRowHandle);
                }
            }
            else
            {
                MessageBox.Show("Selecione um produto");
            }
            row = -1;
        }
예제 #2
0
 private void btnReset_Click_1(object sender, EventArgs e)
 {
     if (isAdminActive == false)
     {
         FrmPassAdmin frm = new FrmPassAdmin(this);
         frm.ShowDialog();
     }
     else
     {
         foreach (ProductsSelectedSell item in _productsSelectedSellController.ListALL())
         {
             _productsSelectedSellController.delete(item);
         }
         updateGrid(0);
     }
 }
예제 #3
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (gVProductsSelected.RowCount > 0)
            {
                int rowSelected = gVProductsSelected.GetSelectedRows()[0];
                _productsSelectedSellController.delete(_productsSelectedSellController.ListALL()[rowSelected]);

                if (_productsSelectedSellController.ListALLAsNoTracking().Count > 0)
                {
                    // a linha seleciona passa a ser a asseguir da linha apagada
                    if ((rowSelected + 1) < gVProductsSelected.RowCount && rowSelected != 0)
                    {
                        rowSelected += 1;
                    }
                    else if (rowSelected > 0)
                    {
                        rowSelected -= 1;
                    }
                    //
                    updateGrid(rowSelected);

                    rowSelected = gVProductsSelected.GetSelectedRows()[0];

                    ProductsSelectedSell ps = _productsSelectedSellController.ListALL()[rowSelected];
                    Product p = _productController.getOne(ps.ProdutoId);

                    toCmbPreco(p);
                    cmbPreco.Text = ps.Preco.ToString("n2");

                    txtProduct.Text = p.Descricao;
                    txtQdade.Text   = ps.Quantidade.ToString("n2");
                    toPicture(p.UrlImg);

                    txtBarCodeProduct.Focus();
                }
                else
                {
                    clearData();
                }
            }
        }