protected void CarregarDados()
    {
        TextBoxData.Text = DateTime.Now.ToString("dd/MM/yyyy");
        //O paciente pode agendar atendimento em apenas uma clínica por dia
        string SqlCondicaoPaciente = "SELECT paci_id, paci_nome FROM agendamento join paciente on agendamento.agen_paciente = paciente.paci_id where agendamento.agen_data = " + TextBoxData.Text + " AND  ";

        string    SqlDadosAgendamento = @"SELECT * FROM agendamento BETWEEN CURDATE() '" + TextBoxData.Text + "' ";
        DataTable TabelaAgendamento   = _Pg.ObterTabela(SqlDadosAgendamento);

        /*
         * int maxAgenTemp = Convert.ToInt32(TabelaAgendamento.Rows[0]["max_id"]);
         * if (maxAgenTemp > 0 || string.IsNullOrEmpty(maxAgenTemp.ToString()) ){
         *  id = 1 + Convert.ToInt32(TabelaAgendamento.Rows[0]["max_id"]);
         *  LabelNumOS.Text = id.ToString();
         *  TextBoxNumOS.Text = id.ToString();
         * }*/

        //if (!String.IsNullOrEmpty(TabelaPedido.ToString()))
        string    SqlSolicitante    = "SELECT paci_id, paci_nome FROM paciente WHERE excluido=false ORDER BY paci_id DESC;";
        DataTable TabelaSolicitante = _Pg.ObterTabela(SqlSolicitante);

        DropDownListSolicitante.DataSource     = TabelaSolicitante;
        DropDownListSolicitante.DataValueField = "paci_id";
        DropDownListSolicitante.DataTextField  = "paci_nome";
        DropDownListSolicitante.DataBind();
        DropDownListSolicitante.Items.Insert(0, new ListItem("Selecione o paciente", "0"));
        DropDownListSolicitante.SelectedIndex = 0;


        string    SqlAtendente    = "SELECT usua_id, usua_nome FROM usuario WHERE excluido=false ORDER BY usua_id DESC;";
        DataTable TabelaAtendente = _Pg.ObterTabela(SqlAtendente);

        DropDownListAtendente.DataSource     = TabelaAtendente;
        DropDownListAtendente.DataValueField = "usua_id";
        DropDownListAtendente.DataTextField  = "usua_nome";
        DropDownListAtendente.DataBind();
        DropDownListAtendente.Items.Insert(0, new ListItem("Atendente responsavél", "0"));
        DropDownListAtendente.SelectedIndex = 0;
        DropDownListAtendente.SelectedValue = _IDUsuario.ToString();


        string    SqlClinica    = "SELECT clin_id, clin_nome FROM clinica WHERE excluido=false ORDER BY clin_id DESC;";
        DataTable TabelaClinica = _Pg.ObterTabela(SqlClinica);

        DropDownListClinica.DataSource     = TabelaClinica;
        DropDownListClinica.DataValueField = "clin_id";
        DropDownListClinica.DataTextField  = "clin_nome";
        DropDownListClinica.DataBind();
        DropDownListClinica.Items.Insert(0, new ListItem("Clinicas disponiveis", "0"));
        DropDownListClinica.SelectedIndex = 0;
    }
    protected void CarregarDadosParaAlterar()
    {
        string    id = Request.QueryString["id"].ToString();
        DataTable Dt = BuscarPorId(id);

        string    SqlPaciente    = "SELECT paci_id, paci_nome FROM paciente WHERE excluido=false ORDER BY paci_id DESC;";
        DataTable TabelaPaciente = _Pg.ObterTabela(SqlPaciente);

        DataTable DtPaciente = BuscarPacientePorId(id);

        DropDownListSolicitante.DataSource     = TabelaPaciente;
        DropDownListSolicitante.DataValueField = "paci_id";
        DropDownListSolicitante.DataTextField  = "paci_nome";
        DropDownListSolicitante.DataBind();
        DropDownListSolicitante.SelectedValue = DtPaciente.Rows[0]["paci_id"].ToString();

        DataTable DtUsuario = BuscarUsuarioPorId(id);

        string    SqlAtendente    = "SELECT usua_id, usua_nome FROM usuario WHERE excluido=false ORDER BY usua_id DESC;";
        DataTable TabelaAtendente = _Pg.ObterTabela(SqlAtendente);

        DropDownListAtendente.DataSource     = TabelaAtendente;
        DropDownListAtendente.DataValueField = "usua_id";
        DropDownListAtendente.DataTextField  = "usua_nome";
        DropDownListAtendente.DataBind();
        DropDownListAtendente.SelectedValue = DtUsuario.Rows[0]["usua_id"].ToString();

        DataTable DtClinica = BuscarClinicaPorId(id);

        string    SqlClinica    = "SELECT clin_id, clin_nome FROM clinica WHERE excluido=false ORDER BY clin_id DESC;";
        DataTable TabelaClinica = _Pg.ObterTabela(SqlClinica);

        DropDownListClinica.DataSource     = TabelaClinica;
        DropDownListClinica.DataValueField = "clin_id";
        DropDownListClinica.DataTextField  = "clin_nome";
        DropDownListClinica.DataBind();
        DropDownListAtendente.SelectedValue = DtClinica.Rows[0]["clin_id"].ToString();


        DropDownListStatus.SelectedValue = Dt.Rows[0]["agen_status"].ToString();

        DropDownListClinica.SelectedValue = Dt.Rows[0]["agen_clinica"].ToString();

        TextBoxData.Text = Dt.Rows[0]["agen_data"].ToString();
        TextBoxHora.Text = Dt.Rows[0]["agen_hora"].ToString();
    }
Example #3
0
    protected void CarregarDados()
    {
        string    SqlSolicitante    = "SELECT usua_id, usua_nome, usua_funcao, usua_departamento, CONCAT( usua_nome,' - ', usua_funcao,' - ',usua_departamento) AS nome FROM usuario WHERE excluido=false ORDER BY usua_id DESC;";
        DataTable TabelaSolicitante = _Pg.ObterTabela(SqlSolicitante);

        DropDownListSolicitante.DataSource     = TabelaSolicitante;
        DropDownListSolicitante.DataValueField = "usua_id";
        DropDownListSolicitante.DataTextField  = "nome";
        DropDownListSolicitante.DataBind();
        DropDownListSolicitante.Items.Insert(0, new ListItem("Selecione o solicitante", "0"));
        DropDownListSolicitante.SelectedIndex = 0;
        DropDownListSolicitante.SelectedValue = _IDUsuario.ToString();

        DropDownListAtendente.DataSource     = TabelaSolicitante;
        DropDownListAtendente.DataValueField = "usua_id";
        DropDownListAtendente.DataTextField  = "nome";
        DropDownListAtendente.DataBind();
        DropDownListAtendente.Items.Insert(0, new ListItem("Selecione o responsavél", "0"));
        DropDownListAtendente.SelectedIndex = 0;
    }