Ejemplo n.º 1
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (searchLUpProduct.Text != "Id_Produto" && searchLUpProduct.Text != "" && txtQuabtidade.Text != "0" && txtMotivo.Text.Trim() != "")
            {
                ProductRetreat prodRetreat = new ProductRetreat()
                {
                    ArmazemId    = idArmazem,
                    ProdutoId    = Convert.ToInt16(searchLUpProduct.Properties.View.GetFocusedRowCellValue("Id").ToString()),
                    Quantidade   = Convert.ToInt16(txtQuabtidade.Text),
                    Motivo       = txtMotivo.Text,
                    DataCadastro = DateTime.Now
                };

                Stock st = _stockController.getStockArmazemProduct(prodRetreat.ProdutoId, prodRetreat.ArmazemId);
                st.Quantidade -= prodRetreat.Quantidade;

                if (_retretController.insert(prodRetreat) > 0)
                {
                    _stockController.update(st);
                    txtMotivo.Clear();
                    txtQuabtidade.Text = "0";
                    cmbArmazem.Focus();
                }
                Close();
            }
            else
            {
                MessageBox.Show("Preencha todos os campos..!");
            }
        }
 public int delete(ProductRetreat productRetreat)
 {
     return(_productRetreatRepository.remove(productRetreat));
 }
 public int update(ProductRetreat productRetreat)
 {
     return(_productRetreatRepository.update(productRetreat));
 }
 public int insert(ProductRetreat productRetreat)
 {
     return(_productRetreatRepository.insert(productRetreat));
 }