// funcionalidades public Estatistica get_estatistica_tempo_real(int id_servico) { Estatistica result = new Estatistica(0, 0, 0); MySqlCommand comm = new MySqlCommand("estatistica_servico_tempo_real", connection.get_connector()); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("_servico_id", MySqlDbType.Int16).Value = id_servico; MySqlDataReader executer; executer = comm.ExecuteReader(); if (!executer.HasRows) { ; } else { executer.Read(); int congestao = (int)executer.GetValue(1); TimeSpan tempo_espera = (TimeSpan)executer.GetValue(2); TimeSpan tempo_atendimento = (TimeSpan)executer.GetValue(3); double tempoAtendimento = tempo_atendimento.TotalMinutes; double tempoEspera = tempo_espera.TotalMinutes; result.set_tempo_espera(tempoEspera); result.set_tempo_atendimento(tempoAtendimento); result.set_congestao(congestao); } executer.Dispose(); executer.Close(); return(result); }
// funcionalidades // método que retorna lista de todos os serviços da app public List <Servico> get_servicos() { List <Servico> result = new List <Servico>(); MySqlCommand comm = new MySqlCommand("iqueue.servicos_get_All", connection.get_connector()); comm.CommandType = CommandType.StoredProcedure; MySqlDataReader executer; executer = comm.ExecuteReader(); if (!executer.HasRows) { ; } else { while (executer.Read()) { int id = (int)executer.GetValue(0); string nome = (string)executer.GetValue(1); string categoria = (string)executer.GetValue(2); Boolean estado = (Boolean)executer.GetValue(3); TimeSpan horaAbertura = (TimeSpan)executer.GetValue(4); TimeSpan horaFecho = (TimeSpan)executer.GetValue(5); double latitude = (double)executer.GetValue(6); double longitude = (double)executer.GetValue(7); string localizacao = (string)executer.GetValue(8); float reputacaoMinima = (float)executer.GetValue(9); int ticketAtual; if (executer.GetValue(10) == DBNull.Value) { ticketAtual = 0; } else { ticketAtual = (int)executer.GetValue(10); } string email = (string)executer.GetValue(11); string numero = ((int)executer.GetValue(12)).ToString(); Servico s = new Servico(id, nome, localizacao, latitude, longitude, email, numero, horaAbertura, horaFecho, estado, reputacaoMinima, ticketAtual, categoria); result.Add(s); } executer.Dispose(); executer.Close(); } return(result); }