private void btnExcluir_Click(object sender, EventArgs e)
 {
     OdontoADMDll.BLL.Servico s = new OdontoADMDll.BLL.Servico();
     if (s.ExcluirServicosPorOrcamento(IDOrcamento))
     {
         MessageBox.Show("Serviços excluídos com sucesso!");
         listarServicos();
     }
     else
     {
         MessageBox.Show("Erro em excluir os serviços!");
     }
 }
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            IDPaciente = 0;

            // Verify that Orcamento was already saved
            OdontoADMDll.BLL.Orcamento o = new OdontoADMDll.BLL.Orcamento();
            int idO = int.Parse(lblDtOrcamento.Text);

            o.OrcamentoID = idO;
            o             = o.GetOrcamento();
            if (o.ValorTotal == 0)
            {
                oServico = new OdontoADMDll.BLL.Servico();
                oServico.ExcluirServicosPorOrcamento(idO);
                this.Close();
            }
            else
            {
                this.Close();
            }
        }
        private void listarServicos()
        {
            decimal valorTotal = 0;

            oServico = new OdontoADMDll.BLL.Servico();
            DataTable dt = new DataTable();

            lServicos = new List <OdontoADMDll.BLL.Servico>();
            dt        = oServico.ListarServicosPorOrcamento(IDOrcamento);
            gridServicos.DataSource = dt;

            if (gridServicos.Rows.Count > 0)
            {
                foreach (DataGridViewRow dr in gridServicos.Rows)
                {
                    valorTotal += decimal.Parse(dr.Cells["valor"].Value.ToString());
                }
                btnImprimir.Visible = true;
            }

            lblValorTotalDt.Text = valorTotal.ToString();
        }
        private void carregarOrcamento(OdontoADMDll.BLL.Orcamento o)
        {
            lblValorTotalDt.Text = o.ValorTotal.ToString();
            lblDtData.Text       = DateTime.Parse(o.DataOrcamento.ToString()).ToShortDateString();
            lblDtOrcamento.Text  = o.OrcamentoID.ToString();

            DataTable dt = new DataTable();

            OdontoADMDll.BLL.Servico s = new OdontoADMDll.BLL.Servico();
            dt = s.ListarServicosPorOrcamento(o.OrcamentoID);

            gridServicos.DataSource = dt;

            // Carregar Imagem
            string     imageUrl = o.GetImagemPorOrcamento(o.OrcamentoID);
            FileStream fs       = new FileStream(imageUrl, FileMode.Open);

            MyImagem = (Bitmap)Image.FromStream(fs);
            fs.Flush();
            fs.Close();

            loadImage();
        }