private void SalvarIngredientes() { DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); if (dgvFicha.Rows.Count > 0) { DTOIngredientes dto = new DTOIngredientes(); BLLIngredientes bll = new BLLIngredientes(cx); //Excluir ingredientes salvos no prato bll.ExcluirPorPrato(txtCodigoPrato.Text); for (int i = 0; i < dgvFicha.Rows.Count; i++) { dto.CodItem = dgvFicha.Rows[i].Cells[0].Value.ToString(); dto.CodPrato = txtCodigoPrato.Text; dto.QuantIngrediente = Convert.ToDouble(dgvFicha.Rows[i].Cells[2].Value); bll.Incluir(dto); } } }
private void AddIngrediente() { double custoUnit = 0; double custoTotal = 0; DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLIngredientes bll = new BLLIngredientes(cx); Augoritmos a = new Augoritmos(); custoUnit = a.CustoIngrediente(txtCodItem.Text, Convert.ToInt32(cbUnidade.SelectedValue)); custoTotal = custoUnit * Convert.ToDouble(txtQuant.Text); String[] V = new string[] { txtCodItem.Text, txtNomeItem.Text, txtQuant.Text, txtUm.Text, txtFc.Text, custoUnit.ToString("#,0.00"), custoTotal.ToString("#,0.00") }; dgvFicha.Rows.Add(V); RecalcularCusto(); txtCodItem.Clear(); txtNomeItem.Clear(); txtQuant.Clear(); txtUm.Clear(); txtFc.Clear(); txtCodItem.Focus(); btAddIngrediente.Enabled = false; txtQuant.Enabled = false; }
private Double UltimaBaixaItem(string codigo, int unidade) { double custoMedio = 0; DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLIngredientes blli = new BLLIngredientes(cx); DataTable tabela = new DataTable(); tabela = blli.Custo01(codigo, unidade); try { custoMedio = Convert.ToDouble(tabela.Rows[0][1]); } catch { custoMedio = 0; } return(custoMedio); }
public void ExcluirPrato(string cod) { DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); // Exclui prato BLLPratos bllp = new BLLPratos(cx); try { bllp.Excluir(cod); } catch { throw new Exception("Erro ao excluir Prato!"); } //Exclui ingredientes referentes ao prato BLLIngredientes blli = new BLLIngredientes(cx); try { blli.ExcluirPorPrato(cod); } catch { throw new Exception("Erro ao excluir Ingrediente!"); } //excluir prato da tabela AEB BLLAeB bllaeb = new BLLAeB(cx); try { bllaeb.ExcluirPorCod(cod); } catch { throw new Exception("Erro ao excluir Aeb!"); } //Exclui imagem referente ao prato (se houver) IncluiFoto(cod, "del"); }