コード例 #1
0
 private void bunifuThinButton24_Click(object sender, EventArgs e)
 {
     if (searchLookUpEdit1.GetSelectedDataRow() == null || searchLookUpEdit1.GetSelectedDataRow() != null && int.Parse(searchLookUpEdit1.Properties.View.GetFocusedRowCellValue("Id").ToString()) == idMesa)
     {
         MessageBox.Show("Selecione uma mesa válida");
     }
     else
     {
         if (prods.Count > 0)
         {
             int             idMesa           = int.Parse(searchLookUpEdit1.Properties.View.GetFocusedRowCellValue("Id").ToString());
             TableController _tableController = new TableController();
             foreach (ProductSellectedTable item in prods)
             {
                 bool have = false;
                 item.MesaId = idMesa;
                 if (item.Quantidade > 0)
                 {
                     foreach (ProductSellectedTable item2 in _tableController.listForId(item.MesaId).productsSellectedTable)
                     {
                         if (item2.StockId == item.StockId)
                         {
                             ProductSellectedTable pro = _productSelectedControllerTable.listForId(item2.Id);
                             pro.Quantidade += item.Quantidade;
                             _productSelectedControllerTable.update(pro);
                             have = true;
                         }
                     }
                     if (!have)
                     {
                         _productSelectedControllerTable.insert(item);
                     }
                 }
             }
             foreach (ProductSellectedTable item in prods2)
             {
                 if (item.Quantidade == 0)
                 {
                     _productSelectedControllerTable.remove(_productSelectedControllerTable.listForId(item.Id));
                 }
                 else
                 {
                     ProductSellectedTable pro = _productSelectedControllerTable.listForId(item.Id);
                     pro.Quantidade = item.Quantidade;
                     _productSelectedControllerTable.update(pro);
                 }
             }
             MessageBox.Show("Transferido com sucesso");
             _frm.tableSelected(_tableController.listForId(this.idMesa));
             Close();
         }
         else
         {
             MessageBox.Show("Nenhum produto selecionado");
         }
     }
 }
コード例 #2
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            ProductSellectedTable prod = prods[gridView2.FocusedRowHandle];

            if (prod.Quantidade > 0)
            {
                prod.Quantidade = prod.Quantidade - 1;
                foreach (ProductSellectedTable item in prods2)
                {
                    if (item.StockId == prod.StockId)
                    {
                        item.Quantidade = item.Quantidade + 1;
                    }
                }
            }
            foreach (ProductSellectedTable item in prods)
            {
            }
            gridControl2.DataSource = prod;
            gridControl1.DataSource = prods2;
            gridView2.RefreshData();
            gridView1.RefreshData();
        }
コード例 #3
0
        private void bunifuThinButton23_Click(object sender, EventArgs e)
        {
            ProductSellectedTable prod;
            bool have = false;

            if (table != null)
            {
                foreach (ProductSellectedTable item in table.productsSellectedTable)
                {
                    _productsSelectedTableController.removeForId(item.Id);
                }

                foreach (ProductsSelectedSell item in _productsSelectedSellController.ListALL())
                {
                    prod = new ProductSellectedTable()
                    {
                        ProdutoId  = item.ProdutoId,
                        StockId    = item.StockId,
                        Preco      = item.Preco,
                        Quantidade = item.Quantidade,
                        data       = DateTime.Now.ToShortDateString(),
                        MesaId     = table.Id,
                    };
                    _productsSelectedTableController.insert(prod);
                }

                /*
                 * foreach (ProductsSelectedSell item in _productsSelectedSellController.ListALL())
                 * {
                 *      int idStock = _stockController.getStockArmazemProduct(item.ProdutoId, 0).Id;
                 *
                 *      foreach (var item2 in _productsSelectedTableController.ListAll())
                 *      {
                 *          if (item2.ProdutoId == item.ProdutoId)
                 *          {
                 *               item2.Quantidade = item.Quantidade;
                 *               _productsSelectedTableController.update(item2);
                 *              have = true;
                 *              break;
                 *          }
                 *      }
                 *  if (!have)
                 *  {
                 *      prod = new ProductSellectedTable()
                 *      {
                 *          ProdutoId = item.ProdutoId,
                 *          StockId = idStock,
                 *          Preco = item.Preco,
                 *          Quantidade = item.Quantidade,
                 *          data = DateTime.Now.ToShortDateString(),
                 *          MesaId = table.Id,
                 *
                 *      };
                 *      _productsSelectedTableController.insert(prod);
                 *  }
                 *  _productsSelectedSellController.deleteFoId(item.Id);
                 */
                table = null;
                clearData();
                updateGrid(0);
            }
            else
            {
                MessageBox.Show("Escolha uma mesa");
            }
        }
コード例 #4
0
 public int update(ProductSellectedTable reserve)
 {
     return(_productSelectedTableRepository.update(reserve));
 }
コード例 #5
0
 public int remove(ProductSellectedTable reserve)
 {
     return(_productSelectedTableRepository.remove(reserve));
 }
コード例 #6
0
 public int insert(ProductSellectedTable productSellectedTable)
 {
     return(_productSelectedTableRepository.insert(productSellectedTable));
 }