Example #1
0
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL();
        DataTable dataTable = agendamentoSessoesDAL.ListarAgendaMultiProfissionais(ddlProfissionais.SelectedValue);

        StringBuilder Texto = new StringBuilder("");
        //if (!e.Day.IsOtherMonth) Caso querira somente percorrer os dias do mes atual
        string Cor1 = "#E3EAEB";
        string Cor = string.Empty;
            foreach (DataRow dr in dataTable.Rows)
            {
                if ((dr["DataInicio"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = Convert.ToDateTime(dr["DataInicio"].ToString());
                    DateTime dtEventFim = Convert.ToDateTime(dr["DataFim"].ToString());
                    if (dtEvent.Equals(e.Day.Date))
                    {
                        if (Cor == Cor1) { Cor = "#E5E5E5"; } else { Cor = "#E3EAEB"; }
                        Texto.Append("<table width='100%'  border='0' cellspacing='0' cellpadding='0'  bgcolor='"+Cor+"'>");
                        Texto.Append("<tr><td align='left'>" + dr["HoraInicio"].ToString() + " - " + dr["HoraFim"].ToString() + "</td></tr>");
                        Texto.Append("<tr><td align='left'>" + dr["ProfissionalNome"].ToString() + "</td></tr>");
                        Texto.Append("<tr><td align='left'>" + dr["PacienteNome"].ToString() + "</td></tr>");
                        Texto.Append("</table>");
                        Texto.Append("<br style='font-size: 5px' >");
                        e.Cell.Controls.Clear();
                        e.Cell.Text = e.Day.DayNumberText + "<br>" + Texto;
                        e.Cell.Font.Size = FontUnit.XXSmall;
                        e.Cell.Font.Bold = true;
                    }
                }
            }
    }
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "BtnAlterarStatus")
     {
         AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL();
         agendamentoSessoesDAL.AlteraStatus(Convert.ToInt32(e.CommandArgument), Convert.ToInt32(Session["idStatus"]));
         Session["idStatus"] = string.Empty;
         Response.Redirect("AgendamentoSessoes.aspx");
     }
 }
    protected void btnGravar_Click(object sender, EventArgs e)
    {
        try
        {
            //Verifica se a Session que armazena a lista esta nulo, se estiver não grava na base
            if (Session["ObjSession"] == null)
                return;

            AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL();
            Lista = Session["ObjSession"] as List<AgendamentoSessoesBE>;
            agendamentoSessoesDAL.Incluir(Lista);

            Session["ObjSession"] = null; // Apago a lista apos inserir
            GridViewMontaTratamento(); //Atualizo o GridView de montagem das sessões
            GridView(); //Atualizo o GridView dos agendamentos

        }
        catch (Exception ex)
        {
            Label lblErro = (Label)Master.FindControl("lblErro");
            lblErro.Text = ex.ToString();
        }
    }
 public void GridView()
 {
     AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL();
     GridView1.DataSource = agendamentoSessoesDAL.Listar(string.Empty, txtNome.Text, txtRG.Text, txtCPF.Text, ddlConvenio.SelectedValue, txtNumeroConvenio.Text, txtDataInicio.Text, txtDataFim.Text,ddlProfissionais.SelectedValue,ddlEspecialidades.SelectedValue,ddlStatusAgendamento.SelectedValue);
     GridView1.DataBind();
 }
 public void GridView()
 {
     AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL();
     GridView2.DataSource = agendamentoSessoesDAL.Listar(Request.QueryString["id"], string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,string.Empty,string.Empty,string.Empty,string.Empty);
     GridView2.DataBind();
 }