protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);

                FinanceiroBLL financBLL = new FinanceiroBLL();
                FinanceiroType financ = financBLL.selectRecord(id);
                if (financ.IdFinanceiro != null && financ.IdFinanceiro > 0 && financ.IdAssociacao == Int32.Parse(Session["AssociacaoID"].ToString()))
                {
                    financBLL.delete(financ);
                    Session["FlashMsg"] = "Apagado com sucesso";
                    Session["FlashMsgType"] = "success";
                }
                else
                {
                    throw new Exception("Id invalido");
                }
            }
            catch (Exception ex)
            {
                Session["FlashMsg"] = "Ocorreu um erro ao apagar";
                Session["FlashMsgType"] = "danger";
            }

            Response.Redirect("~/Painel/Financeiro.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            url_list = "~/Painel/Financeiro.aspx";

            int id = Convert.ToInt32(Request.QueryString["id"]);
            financBLL = new FinanceiroBLL();
            if (id > 0)
            {
                _TitlePage = "Editar";
                financ = financBLL.selectRecord(id);
                if (financ.IdFinanceiro > 0 && Master.SessionAssociacaoId == financ.IdAssociacao)
                {
                    if (!IsPostBack)
                    {
                        double newValor = financ.Valor;
                        if (financ.Valor < 0)
                        {
                            newValor = financ.Valor * -1;
                        }

                        txtTitulo.Text = financ.Titulo;
                        txtValor.Text = newValor.ToString();
                        txtData.Text = financ.DataFormatSql;
                        RdoTipo.SelectedValue = financ.Tipo;
                    }
                }
                else
                {
                    Session["FlashMsg"] = "Id invalido";
                    Session["FlashMsgType"] = "danger";
                    Response.Redirect(url_list);
                }
            }
            else
            {
                _TitlePage = "Adicionar";
                financ = new FinanceiroType();
            }

            _TitlePage += " Receita ou Despesa";

            this.Title = _TitlePage;

            this.DataBind();
        }