Ejemplo n.º 1
0
    protected void btnLiberarPgto_Click(object sender, EventArgs e)
    {
        try
        {
            Pagamento pgto = new Pagamento();
            PagamentoBLL obj = new PagamentoBLL();

            pgto.Id_regiao = Convert.ToInt32(ddlRegiao.SelectedValue);
            pgto.Id_cooperativa = Convert.ToInt32(ddlCooperativa.SelectedValue);
            pgto.Id_propriedade = Convert.ToInt32(ddlPropriedade.SelectedValue);
            pgto.Dt_inicio = txtDataInicial.Text;
            pgto.Dt_fim = txtDataFinal.Text;

            if (txtDataInicial.Text == string.Empty || txtDataFinal.Text == string.Empty)
                throw new Exception("Preencha a data inicial e a data final");
            if (pgto.Id_propriedade == 0)
                throw new Exception("Selecione apenas uma propriedade!");

            string login = Convert.ToString(Session["LOGIN"]);

            bool existePgto = obj.LiberarPagamento(pgto, login);

            if (existePgto == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('Pagamentos liberados!');</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }
Ejemplo n.º 2
0
    protected void btnLiberarPgto_Click(object sender, EventArgs e)
    {
        try
        {
            Pagamento    pgto = new Pagamento();
            PagamentoBLL obj  = new PagamentoBLL();

            pgto.Id_regiao      = Convert.ToInt32(ddlRegiao.SelectedValue);
            pgto.Id_cooperativa = Convert.ToInt32(ddlCooperativa.SelectedValue);
            pgto.Id_propriedade = Convert.ToInt32(ddlPropriedade.SelectedValue);
            pgto.Dt_inicio      = txtDataInicial.Text;
            pgto.Dt_fim         = txtDataFinal.Text;

            if (txtDataInicial.Text == string.Empty || txtDataFinal.Text == string.Empty)
            {
                throw new Exception("Preencha a data inicial e a data final");
            }
            if (pgto.Id_propriedade == 0)
            {
                throw new Exception("Selecione apenas uma propriedade!");
            }

            string login = Convert.ToString(Session["LOGIN"]);

            bool existePgto = obj.LiberarPagamento(pgto, login);

            if (existePgto == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('Pagamentos liberados!');</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('" + ex.Message.ToString() + "');</script>");
        }
    }