Ejemplo n.º 1
0
    protected void btnBusca_Click(object sender, EventArgs e)
    {
        ChartDespesas chartDespesas = new ChartDespesas();

        try
        {
            if (txtInitialDate.Text == "__/__/____" && txtFinalDate.Text == "__/__/____")
            {
                DateTime dtinitial = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                DateTime dtfinal   = DateTime.Today;
                txtInitialDate.Text = dtinitial.ToString("dd/MM/yyyy");
                txtFinalDate.Text   = dtfinal.ToString("dd/MM/yyyy");
                chartDespesas.BindChartTipoGastosByDate(Convert.ToInt32(Session["Advogado"]), ltGastos, Convert.ToDateTime(txtInitialDate.Text), Convert.ToDateTime(txtFinalDate.Text));
                divMensagem.Attributes["class"] = "";
                lblMensagem.Text = string.Empty;
            }
            else if (txtInitialDate.Text == "__/__/____")
            {
                divMensagem.Attributes["class"] = "alert alert-danger";
                lblMensagem.Text = "Entre com a data inicial";
                txtInitialDate.Focus();
            }
            else if (txtFinalDate.Text == "__/__/____")
            {
                divMensagem.Attributes["class"] = "alert alert-danger";
                lblMensagem.Text = "Entre com a data final";
                txtFinalDate.Focus();
            }
            else if (Convert.ToDateTime(txtInitialDate.Text) >= Convert.ToDateTime(txtFinalDate.Text))
            {
                divMensagem.Attributes["class"] = "alert alert-danger";
                lblMensagem.Text = "A data incial deve ser menor que a data final";
            }
            else
            {
                Label lbl = new Label();
                lbl.Text = lt.Text;
                divMensagem.Attributes["class"] = "";
                lblMensagem.Text = string.Empty;
                chartDespesas.BindChartTipoGastosByDate(Convert.ToInt32(Session["Advogado"]), ltGastos, Convert.ToDateTime(txtInitialDate.Text), Convert.ToDateTime(txtFinalDate.Text));
            }
            CarregaDespesaEscritorio(Convert.ToInt32(Session["Advogado"]), Convert.ToDateTime(txtInitialDate.Text), Convert.ToDateTime(txtFinalDate.Text));
            CarregaTotalLabel(Convert.ToInt32(Session["Advogado"]), Convert.ToDateTime(txtInitialDate.Text), Convert.ToDateTime(txtFinalDate.Text));
        }
        catch (FormatException)
        {
            divMensagem.Attributes["class"] = "alert alert-danger";
            lblMensagem.Text = "Data invalida";
        }
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ChartDespesas chartDespesas = new ChartDespesas();
         DateTime      dtinitial     = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
         DateTime      dtfinal       = DateTime.Today;
         txtInitialDate.Text = dtinitial.ToString("dd/MM/yyyy");
         txtFinalDate.Text   = dtfinal.ToString("dd/MM/yyyy");
         chartDespesas.BindChartTipoGastosByDate(Convert.ToInt32(Session["Advogado"]), ltGastos, dtinitial, dtfinal);
         chartDespesas.BindChartGastos(Convert.ToInt32(Session["Advogado"]), lt);
         int mesAtual = DateTime.Today.Month;
         CarregaDespesaEscritorio(Convert.ToInt32(Session["Advogado"]), dtinitial, dtfinal);
         CarregaTotalLabel(Convert.ToInt32(Session["Advogado"]), dtinitial, dtfinal);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ChartProcessos  chartProcessos   = new ChartProcessos();
            ChartPagamentos chartPagamentos  = new ChartPagamentos();
            ChartDespesas   chartDespesas    = new ChartDespesas();
            ChartFinanceiro chartFincanceiro = new ChartFinanceiro();
            DateTime        dtfinal          = new DateTime();
            //bool teste = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();

            //if (teste == true)
            //{
            string mes = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(DateTime.Today.Month);
            mes = char.ToUpper(mes[0]) + mes.Substring(1);
            //lblDespesa.Text = "Despesas " + mes;
            //lblPagamento.Text = "Pagamentos " + mes;

            DateTime dtinicial = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

            if (DateTime.Now.Month == 12)
            {
                dtfinal = new DateTime(DateTime.Now.Year, 12, 31);
            }
            else
            {
                dtfinal = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-1);
            }
            chartProcessos.BindChartTipoMovimentacaoAbertas(Convert.ToInt32(Session["Advogado"]), ltProcesso);
            chartPagamentos.BindChartTipoPagamentosByDateHome(Convert.ToInt32(Session["Advogado"]), ltPagamentos, dtinicial, dtfinal);
            chartDespesas.BindChartTipoGastosByDateHome(Convert.ToInt32(Session["Advogado"]), ltGastos, dtinicial, dtfinal);
            //}
            //else
            //{
            //    lblTeste.Text = "Sem conexão!";
            //}
            Master.Page.Title = "Home Page";
            CarregaProcesso();
        }
    }