protected static AtributosConsultaCod[] AuxConsultasOcorrendoEmHorario(DateTime horarioRedondo, bool umaHora,
                                                                               string emailMedico, string emailPaciente, ConexaoBD conexaoBD)
        {
            DateTime horarioConsultaDe1HAntes;

            if (horarioRedondo.Minute == 0)
            {
                horarioConsultaDe1HAntes = new DateTime(horarioRedondo.Year, horarioRedondo.Month,
                                                        horarioRedondo.Day, horarioRedondo.Hour - 1, 30, 0);
            }
            else
            {
                horarioConsultaDe1HAntes = new DateTime(horarioRedondo.Year, horarioRedondo.Month,
                                                        horarioRedondo.Day, horarioRedondo.Hour, 0, 0);
            }

            string cmdSelect = "select codConsulta, proposito, horario, umaHora, observacoes, status, " +
                               "emailMedico, emailPac, satisfacao, comentario, horarioSatisfacao from consulta where ";

            if (!String.IsNullOrEmpty(emailMedico))
            {
                cmdSelect += " emailMedico = '" + emailMedico + "' and ";
            }
            if (!String.IsNullOrEmpty(emailPaciente))
            {
                cmdSelect += " emailPac = '" + emailPaciente + "' and ";
            }
            cmdSelect += " (horario = '" + horarioRedondo + "' " +
                         " or (horario = '" + horarioConsultaDe1HAntes + "' and umaHora = 1)";
            if (umaHora)
            {
                DateTime horarioConsultaDe1HoraDepois = new DateTime(horarioRedondo.Year, horarioRedondo.Month,
                                                                     horarioRedondo.Day, (horarioRedondo.Minute == 0)?horarioRedondo.Hour:horarioRedondo.Hour + 1,
                                                                     (horarioRedondo.Minute == 0)?30:0, 0);
                cmdSelect += " or horario = '" + horarioConsultaDe1HoraDepois + "'";
            }
            cmdSelect += ")";

            DataSet dadosConsulta = conexaoBD.ExecuteSelect(cmdSelect);

            if (dadosConsulta.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }

            AtributosConsultaCod[] atributosConsultas = new AtributosConsultaCod[dadosConsulta.Tables[0].Rows.Count];
            for (int i = 0; i < dadosConsulta.Tables[0].Rows.Count; i++)
            {
                atributosConsultas[i] = Consulta.AtributosConsultaFromDataSet(dadosConsulta, i, conexaoBD);
            }

            return(atributosConsultas);
        }
示例#2
0
        //todos os medicos
        public static string[,] GetTodosMedicos(ConexaoBD conexaoBD)
        {
            DataSet data = conexaoBD.ExecuteSelect("select email, nomeCompleto from medico");

            string[,] ret = new string[data.Tables[0].Rows.Count, 2];
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                ret[i, 0] = (string)data.Tables[0].Rows[i].ItemArray[0];
                ret[i, 1] = (string)data.Tables[0].Rows[i].ItemArray[1];
            }

            return(ret);
        }
示例#3
0
        //outros dados de medicos especificos (STATIC)
        public static AtributosMedico DeEmail(string email, ConexaoBD conexaoBD)
        {
            DataSet data = conexaoBD.ExecuteSelect("select email, nomeCompleto, crm, celular, telefoneResidencial, endereco, dataDeNascimento, caminhoFoto " +
                                                   " from medico where email='" + email + "'");

            if (data.Tables[0].Rows.Count <= 0)
            {
                throw new Exception("Esse medico nao existe!");
            }

            AtributosMedico atributos = new AtributosMedico();

            Medico.ColocarAtributosFromDs(ref atributos, 0, data);
            return(atributos);
        }
        public static AtributosConsultaCod DeCodigo(int codConsulta, ConexaoBD conexaoBD)
        {
            DataSet dataSet = conexaoBD.ExecuteSelect("select codConsulta, proposito, horario, umaHora, observacoes, status, " +
                                                      "emailMedico, emailPac, satisfacao, comentario, horarioSatisfacao, medicoJahViuSatisfacao " +
                                                      "from consulta where codConsulta = " + codConsulta);

            if (dataSet.Tables[0].Rows.Count != 1)
            {
                return(null);
            }

            AtributosConsultaCod atributos = Consulta.AtributosConsultaFromDataSet(dataSet, 0, conexaoBD);

            return(atributos);
        }
示例#5
0
        protected bool Login(string email, string senha, ConexaoBD conexaoBD)
        {
            this.atributos = new AtributosMedico();
            this.atributos.AdicionarSenha(senha);

            DataSet data = conexaoBD.ExecuteSelect("select email, nomeCompleto, crm, celular, telefoneResidencial, endereco, dataDeNascimento, caminhoFoto " +
                                                   " from medico where email='" + email + "' and senha='" + this.atributos.SenhaCriptografada + "'");

            if (data.Tables[0].Rows.Count <= 0)
            {
                return(false);
            }

            Medico.ColocarAtributosFromDs(ref this.atributos, 0, data);
            return(true);
        }
示例#6
0
        protected bool Login(string email, string senha, ConexaoBD conexaoBD)
        {
            this.atributos = new AtributosSecretaria();
            this.atributos.AdicionarSenha(senha);

            DataSet data = conexaoBD.ExecuteSelect("select nomeCompleto, endereco " +
                                                   " from secretaria where email='" + email + "' and senha='" + this.atributos.SenhaCriptografada + "'");

            if (data.Tables[0].Rows.Count <= 0)
            {
                return(false);
            }

            this.atributos.NomeCompleto = (string)data.Tables[0].Rows[0].ItemArray[0];
            this.atributos.Endereco     = (string)data.Tables[0].Rows[0].ItemArray[1];

            return(true);
        }
        public static AtributosConsultaCod[] TodasAsConsultas(ConexaoBD conexaoBD)
        {
            DataSet dataSet = conexaoBD.ExecuteSelect("select codConsulta, proposito, horario, umaHora, observacoes, status, " +
                                                      "emailMedico, emailPac, satisfacao, comentario, horarioSatisfacao, medicoJahViuSatisfacao from consulta " +
                                                      "order by horario desc");

            if (dataSet.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }

            AtributosConsultaCod[] atributos = new AtributosConsultaCod[dataSet.Tables[0].Rows.Count];
            for (int i = 0; i < atributos.Length; i++)
            {
                atributos[i] = Consulta.AtributosConsultaFromDataSet(dataSet, i, conexaoBD);
            }

            return(atributos);
        }
        public static AtributosConsultaCod[] ConsultasDe(string email, bool ehMedico, bool ordenarPorSatisfacao, ConexaoBD conexaoBD)
        {
            DataSet dataSet = conexaoBD.ExecuteSelect("select codConsulta, proposito, horario, umaHora, observacoes, status, " +
                                                      "emailMedico, emailPac, satisfacao, comentario, horarioSatisfacao, medicoJahViuSatisfacao from consulta " +
                                                      "where " + (ehMedico?"emailMedico":"emailPac") + " = '" + email + "' order by "
                                                      + (ordenarPorSatisfacao? "horarioSatisfacao" : "horario") + " desc");

            if (dataSet.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }

            AtributosConsultaCod[] atributos = new AtributosConsultaCod[dataSet.Tables[0].Rows.Count];
            for (int i = 0; i < atributos.Length; i++)
            {
                atributos[i] = Consulta.AtributosConsultaFromDataSet(dataSet, i, conexaoBD);
            }

            return(atributos);
        }
        public static AtributosPaciente DeEmail(string email, ConexaoBD conexaoBD)
        {
            try
            {
                DataSet data = conexaoBD.ExecuteSelect("select email, nomeCompleto, celular, telefoneResidencial, endereco, dataDeNascimento, caminhoFoto " +
                                                       " from paciente where email='" + email + "'");
                if (data.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }

                AtributosPaciente atributos = new AtributosPaciente();
                Paciente.ColocarAtributosFromDs(ref atributos, 0, data);
                return(atributos);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
示例#10
0
        //cadastro
        public static bool Existe(string email, ConexaoBD conexaoBD)
        {
            DataSet data = conexaoBD.ExecuteSelect("select * from medico where email='" + email + "'");

            return(data.Tables[0].Rows.Count > 0);
        }