public ActionResult Cadastrar(String nomePaciente, String nomeMedico, DateTime Data, String Hora, String Observacao, String Plano)
        {
            AgendamentoDao ag  = new AgendamentoDao();
            PacienteDao    dao = new PacienteDao();
            MedicoDao      me  = new MedicoDao();


            Agendamento agendamento = new Agendamento();

            agendamento.hora       = Hora;
            agendamento.data       = Data;
            agendamento.observacao = Observacao;
            agendamento.Plano      = Plano;
            foreach (var item in dao.Select())
            {
                if (item.Nome == nomePaciente)
                {
                    agendamento.PacienteId = item.ID;
                }
            }

            foreach (var item in me.Select())
            {
                if (item.nome == nomeMedico)
                {
                    agendamento.MedicoId = item.ID;
                }
            }

            string validacao = (ag.Cadastrar(agendamento) ? "Sim" : "Não");

            return(Json(validacao));
        }
Esempio n. 2
0
        public ActionResult Form(int pacienteId, int agendamentoId)
        {
            AgendamentoDao ag          = new AgendamentoDao();
            Agendamento    agendamento = ag.BuscaPorId(agendamentoId);
            //Criando atendimento
            AtendimentosDao atend       = new AtendimentosDao();
            Atendimentos    atendimento = new Atendimentos();

            atendimento.data       = agendamento.data;
            atendimento.MedicoId   = agendamento.MedicoId;
            atendimento.PacienteId = agendamento.PacienteId;
            atendimento.Plano      = agendamento.Plano;

            atend.Cadastrar(atendimento);


            Prontuario    prontuario = new Prontuario();
            ProntuarioDao dao        = new ProntuarioDao();

            foreach (var item in dao.Select())
            {
                if (item.PacienteId == (pacienteId))
                {
                    prontuario = item;
                }
            }
            Componente_PacienteDao         com = new Componente_PacienteDao();
            HistoriaPatologicaPregressaDao h   = new HistoriaPatologicaPregressaDao();
            //ComponenteDao co = new ComponenteDao();
            PacienteDao paci     = new PacienteDao();
            Paciente    paciente = paci.BuscaPorId(pacienteId);

            HistoriaPatologicaPregressa historia = h.BuscaPorId(prontuario.HistoriaPatologicaPregressaId);
            //IList<Componente> lista_componente = new List<Componente>();
            IList <Componente_Paciente> lista = new List <Componente_Paciente>();

            if (com.BuscarAgendamentos(paciente.ID) != null)
            {
                lista = com.BuscarAgendamentos(paciente.ID);
                ViewBag.Componente = lista;
            }



            ConsultaDao      con            = new ConsultaDao();
            IList <Consulta> listaConsultas = con.BuscaPorPaciente(pacienteId);
            MedicoDao        me             = new MedicoDao();
            Medico           medico         = me.BuscaPorId(agendamento.MedicoId);



            ViewBag.Medico      = medico;
            ViewBag.Agendamento = agendamento;
            ViewBag.Consultas   = listaConsultas;
            ViewBag.Historia    = historia;
            ViewBag.Prontuario  = prontuario;
            ViewBag.Paciente    = paciente;

            return(View());
        }
Esempio n. 3
0
        public static Reader <Agendamento> ListarAgendamentos(GridParams param)
        {
            var dataBase = DateTime.Now;
            List <Agendamento> agendamentos = new List <Agendamento>();

            if (param._search)
            {
                var operador = new Func <string, string, string>((op, valor) =>
                {
                    int saida;
                    bool isNum = Int32.TryParse(valor, out saida);
                    switch (op)
                    {
                    case "ne":
                        return(isNum ? string.Format(" <>{0}", valor) : string.Format(" <>\"{0}\"", valor));

                    default:
                        return(isNum ? string.Format(" = {0}", valor) : string.Format(" = \"{0}\"", valor));
                    }
                });

                var sb = new StringBuilder();
                sb.Append(param.searchField);
                sb.Append(operador(param.searchOper, param.searchString));
                agendamentos = AgendamentoDao.GetAgendamentos(dataBase);
            }
            else
            {
                agendamentos = AgendamentoDao.GetAgendamentos(dataBase);
            }

            var reader = new Reader <Agendamento>(agendamentos, param.page, param.rows);

            return(reader);
        }
        public ActionResult Index()
        {
            MedicoDao           me             = new MedicoDao();
            AgendamentoDao      ag             = new AgendamentoDao();
            IList <Agendamento> lista          = ag.Select();
            PacienteDao         dao            = new PacienteDao();
            IList <Paciente>    listaPacientes = new List <Paciente>();
            IList <Paciente>    pacientes      = dao.Select();


            foreach (var agenda in lista)
            {
                int      id       = agenda.PacienteId;
                Paciente paciente = dao.BuscaPorId(id);
                listaPacientes.Add(paciente);
            }

            listaPacientes.Count();
            ViewBag.Paciente    = listaPacientes;
            ViewBag.Pacientes   = pacientes;
            ViewBag.Agendamento = lista;
            ViewBag.Medicos     = me.Select();

            return(View());
        }
 public void SalvaAgendamentoDb(Agendamento agendamento)
 {
     using (var conexao = DependencyService.Get <ISQLite>().PegarConexao())
     {
         var dao = new AgendamentoDao(conexao);
         dao.Salvar(agendamento);
     }
 }
Esempio n. 6
0
        public FrmAgendamento()
        {
            InitializeComponent();

            cbTipoConsulta.DataSource    = null;
            cbTipoConsulta.DataSource    = setComboBoxEnumString().ToList();
            cbTipoConsulta.SelectedIndex = -1;
            AgendamentoDao = new AgendamentoDao();
        }
        public ActionResult Excluir(int id)
        {
            if (Session["Medico"] != null || Session["Funcionario"] != null)
            {
                AgendamentoDao dao         = new AgendamentoDao();
                Agendamento    agendamento = dao.BuscaPorId(id);

                string validacao = dao.excluir(agendamento) ? "Sim" : "Não";
                return(Json(validacao));
            }
            return(Json("Não"));
        }
        public ActionResult Atualizar(Agendamento agendamento, String nomePaciente)
        {
            AgendamentoDao dao  = new AgendamentoDao();
            PacienteDao    paci = new PacienteDao();

            foreach (var item in paci.Select())
            {
                if (item.Nome == nomePaciente)
                {
                    agendamento.PacienteId = item.ID;
                }
            }
            dao.Alterar(agendamento);
            return(RedirectToAction("Index"));
        }
        public ActionResult Agendamento(int id)
        {
            AgendamentoDao dao         = new AgendamentoDao();
            Agendamento    agendamento = dao.BuscaPorId(id);


            PacienteDao paci     = new PacienteDao();
            Paciente    paciente = paci.BuscaPorId(agendamento.PacienteId);

            MedicoDao m      = new MedicoDao();
            Medico    medico = m.BuscaPorId(agendamento.MedicoId);

            ViewBag.Medico      = medico;
            ViewBag.Paciente    = paciente;
            ViewBag.Agendamento = agendamento;
            return(View());
        }
Esempio n. 10
0
        private void GetAgendamentos()
        {
            var dataBase = retornaDataBase();
            List <Agendamento> agendamentos = new List <Agendamento>();

            var dataAtual = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            if (dataBase >= dataAtual && dataBase <= dataAtual.AddDays(1))
            {
                agendamentos = AgendamentoDao.GetAgendamentos(dataBase);
                grdAgendamentos.DataSource = agendamentos;
                grdAgendamentos.DataBind();
            }
            else
            {
                Response.Write("<script>alert('Data inválida para agendamento');</script>");
            }
        }
Esempio n. 11
0
      public ActionResult Dashbord()
      {
          AgendamentoDao      dao            = new AgendamentoDao();
          IList <Agendamento> lista          = dao.BuscarAgendamentosPorData(DateTime.Now.Date);
          PacienteDao         paDao          = new PacienteDao();
          IList <Paciente>    listaPacientes = new List <Paciente>();
          IList <Paciente>    pacientes      = paDao.Select();


          foreach (var agenda in lista)
          {
              int      id       = agenda.PacienteId;
              Paciente paciente = paDao.BuscaPorId(id);
              listaPacientes.Add(paciente);
          }

          listaPacientes.Count();
          ViewBag.Paciente    = listaPacientes;
          ViewBag.Pacientes   = pacientes;
          ViewBag.Agendamento = lista;


          return(View());
      }
Esempio n. 12
0
      public ActionResult Index()
      {
          Medico              medico = (Medico)Session["Medico"];
          AgendamentoDao      ag     = new AgendamentoDao();
          IList <Agendamento> lista  = ag.BuscarAgendamentos(DateTime.Now.Date, medico);

          PacienteDao      dao            = new PacienteDao();
          IList <Paciente> listaPacientes = new List <Paciente>();
          IList <Paciente> pacientes      = dao.Select();


          foreach (var agenda in lista)
          {
              int      id       = agenda.PacienteId;
              Paciente paciente = dao.BuscaPorId(id);
              listaPacientes.Add(paciente);
          }

          listaPacientes.Count();
          ViewBag.Paciente    = listaPacientes;
          ViewBag.Pacientes   = pacientes;
          ViewBag.Agendamento = lista;
          return(View());
      }