Ejemplo n.º 1
0
        public static void EnsureCreation()
        {
            //try {
            SQLOperations.MessageExceptions = true;
            SQLOperations.ThrowExceptions   = true;
            //SQLOperations.NonQuery("Erro ao criar banco de dados.", $"create database if not exists {Name};");
            Pessoas.p.CreateTable();
            Pacientes.CreateTable();
            Funcionarios.CreateTable();
            Medicos.CreateTable();
            Recepcionista.CreateTable();
            Tecnico_Enfermagem.CreateTable();
            (new Administradores()).GetCT()();
            TempPacientes.CreateTable();
            ListaEspera.CreateTable();
            Salas.CreateTable();
            Paciente_Sala.CreateTable();
            Convenios.CreateTable();
            ProcedimentosLab.CreateTable();
            ProcedimentoConvenio.CreateTable();
            PacienteProcedimentos.CreateTable();
            Enderecos.CreateTable();
            Anexos.CreateTable();
            Especializacoes.CreateTable();
            MedicoEspecializacoes.CreateTable();
            Agendamentos.CreateTable();
            AgendamentoPaciente.CreateTable();
            AgendamentoTempPaciente.CreateTable();
            AgendamentoFuncionario.CreateTable();
            ListaEspera_Funcionario.CreateTable();
            ListaEspera_Especializacao.CreateTable();
            Historico_Consultas.CreateTable();
            Historico_ProcedimentosLab.CreateTable();
            Pagamentos.CreateTable();
            //Fonoaudiologos.CreateTable();
            Nutricionistas.CreateTable();
            Psicologos.CreateTable();
            Ausentes.CreateTable();

            /*} catch (Exception ex) {
             *  MessageBox.Show(ex.Message);
             * }
             * finally {*/
            SQLOperations.ThrowExceptions = false;
            //}
        }
Ejemplo n.º 2
0
        public static AgendamentoFuncionario Select(int agendamento)
        {
            var c = new MySqlCommand();

            c.CommandText = $"select * from {Name} where {nameof(Agendamento)} = @id;";
            c.Parameters.AddWithValue("@id", agendamento);
            AgendamentoFuncionario af = null;

            QueryR("Erro ao obter associação de médico e agendamento.", c, (r) => {
                if (r.Read())
                {
                    af = new AgendamentoFuncionario()
                    {
                        Agendamento = r.GetInt32(0),
                        Funcionario = r.GetString(1)
                    };
                }
            });
            return(af);
        }
Ejemplo n.º 3
0
        public static List <Agendamentos> Select(DateTime begin, DateTime end, string medico = null)
        {
            var agendamento = new AgendamentoFuncionario();
            var c           = new MySqlCommand();
            var a           = "";
            var b           = "";

            if (medico != null)
            {
                a = $"inner join {AgendamentoFuncionario.Name} as b on a.{nameof(ID)} = b.{nameof(agendamento.Agendamento)}";
                b = $" and b.{nameof(agendamento.Funcionario)} = @medico";
            }
            c.CommandText = $"select * " +
                            $"from {Name} as a " +
                            $"{a} " +
                            $"where ({nameof(_Data)} between @begin and @end) {b};";
            c.Parameters.AddWithValue("@begin", begin.ToString("yyyy-MM-dd"));
            c.Parameters.AddWithValue("@end", end.ToString("yyyy-MM-dd"));
            if (medico != null)
            {
                c.Parameters.AddWithValue("@medico", medico);
            }
            var result = new List <Agendamentos>();

            QueryR("Erro ao pesquisar agendamentos.", c, (r) => {
                while (r.Read())
                {
                    var agen = new Agendamentos {
                        ID     = r.GetInt32(0),
                        _Data  = r.GetMySqlDateTime(1).GetDateTime(),
                        Inicio = Database.GetTimeSpan(r.GetString(2)),
                        Fim    = Database.GetTimeSpan(r.GetString(3))
                    };
                    result.Add(agen);
                }
            });
            return(result);
        }