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));
        }
        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());
        }
Example #3
0
        public ActionResult Form()
        {
            MedicoDao      me    = new MedicoDao();
            IList <Medico> lista = me.Select();

            ViewBag.Medicos = lista;
            return(View());
        }
Example #4
0
        private void tbInserir_Click(object sender, System.EventArgs e)
        {
            try
            {
                var Medico = new Medico();
                validationInsertUpdate(Medico);

                if (MedicoDao.Select(new List <Tuple <string, object, string> >()
                {
                    new Tuple <string, object, string>("CPF", Medico.CPF, "=")
                }).Count > 0)
                {
                    throw new Exception("Já existe Medico com o CPF informado");
                }

                if (!String.IsNullOrEmpty(Medico.CRM) &&
                    MedicoDao.Select(new List <Tuple <string, object, string> >()
                {
                    new Tuple <string, object, string>("CRM", Medico.CRM, "=")
                }).Count > 0)
                {
                    throw new Exception("Já existe Medico com o CRM informado");
                }

                MedicoDao.Insert(Medico);
                dgResultado.DataSource = null;
                Util.lstMedicos        = MedicoDao.Select(null);

                MessageBox.Show(this, "Medico incluido com sucesso", "Medico");

                dgResultado.DataSource = Util.lstMedicos;
                formOnEndTask();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public ActionResult GerarRelatorio()
        {
            AtendimentosDao      at           = new AtendimentosDao();
            IList <Atendimentos> atendimentos = at.Select();

            PacienteDao    dao       = new PacienteDao();
            IList <string> pacientes = new List <string>();

            MedicoDao      me      = new MedicoDao();
            IList <string> medicos = new List <string>();

            foreach (var item in at.Select())
            {
                foreach (var medico in me.Select())
                {
                    if (item.MedicoId == medico.ID)
                    {
                        medicos.Add(medico.nome);
                    }
                }
            }

            foreach (var item in at.Select())
            {
                foreach (var paciente in dao.Select())
                {
                    if (item.PacienteId == paciente.ID)
                    {
                        pacientes.Add(paciente.Nome);
                    }
                }
            }

            ViewBag.Quantidade  = atendimentos.Count;
            ViewBag.Atendiemtos = atendimentos;
            ViewBag.Pacientes   = pacientes;
            ViewBag.Medico      = medicos;

            int paginaNumero = 1;

            var pdf = new ViewAsPdf
            {
                ViewName    = "Relatorio",
                PageSize    = Size.A4,
                IsGrayScale = true,
                Model       = atendimentos.ToPagedList(paginaNumero, atendimentos.Count)
            };

            return(pdf);
        }
Example #6
0
        public ActionResult Index()
        {
            AtendimentosDao      at           = new AtendimentosDao();
            IList <Atendimentos> atendimentos = at.Select();

            PacienteDao    dao       = new PacienteDao();
            IList <string> pacientes = new List <string>();

            MedicoDao      me      = new MedicoDao();
            IList <string> medicos = new List <string>();

            foreach (var item in at.Select())
            {
                foreach (var medico in me.Select())
                {
                    if (item.MedicoId == medico.ID)
                    {
                        medicos.Add(medico.nome);
                    }
                }
            }

            foreach (var item in at.Select())
            {
                foreach (var paciente in dao.Select())
                {
                    if (item.PacienteId == paciente.ID)
                    {
                        pacientes.Add(paciente.Nome);
                    }
                }
            }

            ViewBag.Quantidade  = atendimentos.Count;
            ViewBag.Atendiemtos = atendimentos;
            ViewBag.Pacientes   = pacientes;
            ViewBag.Medico      = medicos;
            return(View());
        }