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; //} }
public static Anexos Select(string funcionario, string fileName) { var c = new MySqlCommand(); c.CommandText = $"select * from {Name} where {nameof(CPF)} = @cpf and {nameof(Nome)} = @fn;"; c.Parameters.AddWithValue("@cpf", funcionario); c.Parameters.AddWithValue("@fn", fileName); Anexos anexo = null; QueryR("Erro ao obter anexo.", c, (r) => { if (r.Read()) { anexo = new Anexos() { CPF = funcionario, Nome = fileName, Tamanho = r.GetInt32(2) }; anexo._Data = new byte[anexo.Tamanho]; r.GetBytes(3, 0, anexo._Data, 0, anexo.Tamanho); } }); return(anexo); }