public static Horario ObtenerHorarioActualDeProfesor(Profesor profe, Dia dia, int hora, int tole) { SqlConnection con = DBInstance.Instance; List <Horario> list = new List <Horario>(); SqlCommand com = new SqlCommand("uspObtenerHorarioActualProfesor", con); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@profeid", profe.id)); com.Parameters.Add(new SqlParameter("@diaid", dia.id)); com.Parameters.Add(new SqlParameter("@hora", hora)); com.Parameters.Add(new SqlParameter("@tole", tole)); com.ExecuteNonQuery(); using (SqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { Trace.WriteLine(String.Format("{0} \t | {1} \t | {2} \t | {3} \t | {4} \t | {5}", reader[0], reader[1], reader[2], reader[3], reader[4], reader[5])); Curso curso = new Curso((int)reader[1], (string)reader[2]); Horario horario = new Horario((int)reader[0], profe, curso, dia, (int)reader[4], (int)reader[5], (bool)reader[3]); list.Add(horario); } } return(list.FirstOrDefault()); }
public Horario(int id, Profesor profesor, Curso curso, Dia dia, int horaini, int horafin) { this.id = id; this.profesor = profesor; this.curso = curso; this.dia = dia; this.horaini = HoraIntToStr(horaini); this.horafin = HoraIntToStr(horafin); }
public Horario(Profesor profesor, Curso curso, Dia dia, string horaini, string horafin, bool estado) { this.profesor = profesor; this.curso = curso; this.dia = dia; this.horaini = horaini; this.horafin = horafin; this.estado = estado; }
public static List <Dia> ObtenerDias() { SqlConnection con = DBInstance.Instance; List <Dia> list = new List <Dia>(); SqlCommand com = new SqlCommand("select * from Dia", con); com.ExecuteNonQuery(); using (SqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { Trace.WriteLine(String.Format("{0} \t | {1}", reader[0], reader[1])); Dia dia = new Dia((int)reader[0], (string)reader[1]); list.Add(dia); } } return(list); }
public static List <Profesor> ObtenerProfesoresPorDia(Dia dia) { SqlConnection con = DBInstance.Instance; SqlCommand com = new SqlCommand("uspObtenerPorDia", con); List <Profesor> list = new List <Profesor>(); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@iddia", dia.id)); com.ExecuteNonQuery(); using (SqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { Trace.WriteLine(String.Format("{0} \t | {1} \t | {2} \t | {3} \t | {4}", reader[0], reader[1], reader[2], reader[3], reader[4], reader[5])); Profesor profe = new Profesor((int)reader[0], (string)reader[1], (string)reader[2], (string)reader[3], (string)reader[4], (string)reader[5]); list.Add(profe); } } return(list); }
public static Dia ObtenerDia(int id) { SqlConnection con = DBInstance.Instance; SqlCommand com = new SqlCommand("uspObtenerDia", con); Dia dia = new Dia(); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@id", id)); com.ExecuteNonQuery(); using (SqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { Trace.WriteLine(String.Format("{0}", reader[0])); dia.id = id; dia.nombre = (string)reader[0]; } } return(dia); }
public static List <Horario> ObtenerHorariosDeProfesor(Profesor profesor) { SqlConnection con = DBInstance.Instance; List <Horario> list = new List <Horario>(); SqlCommand com = new SqlCommand("uspObtenerHorariosProfesor", con); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter("@profeid", profesor.id)); com.ExecuteNonQuery(); using (SqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { Trace.WriteLine(String.Format("{0} \t | {1} \t | {2} \t | {3} \t | {4} \t | {5} \t | {6}", reader[0], reader[1], reader[2], reader[3], reader[4], reader[5], reader[6])); Curso curso = new Curso((int)reader[1], (string)reader[2]); Dia dia = new Dia((int)reader[3], (string)reader[4]); Horario horario = new Horario((int)reader[0], profesor, curso, dia, (int)reader[5], (int)reader[6]); list.Add(horario); } } return(list); }
private void Identificacion_Activada() { SensorInstance.OpenSensorConnection(); if (sensor.Active) { fpcHandle = sensor.CreateFPCacheDB(); sensor.OnCapture += Fp_OnCapture; sensor.OnImageReceived += Fp_OnImageReceived; } else { MessageBoxResult res = MessageBox.Show("Desea cerrar el programa?", "Sensor no conectado", MessageBoxButton.YesNo); if (res == MessageBoxResult.Yes) { this.Close(); Environment.Exit(0); } } hoy = Dia.ObtenerDia(); List <Profesor> profeshoy = DBServices.ObtenerProfesoresPorDia(hoy); List <Profesor> profestodos = DBServices.ObtenerProfesores(); foreach (var profe in profeshoy) { if (!profes.ContainsKey(profe.id)) { profes.Add(profe.id, profe); Trace.WriteLine("Profesor " + profe.nombre); string huella = profe.huella; string huella10 = profe.huella10; if (sensor.Active && sensor.AddRegTemplateStrToFPCacheDBEx(fpcHandle, profe.id, huella, huella10) == 1) { Trace.WriteLine("Huella ingresada " + profe.nombre); } else { Trace.WriteLine("Huella no ingresada"); } } } foreach (var profe in profestodos) { if (!profes.ContainsKey(profe.id)) { profes.Add(profe.id, profe); Trace.WriteLine("Profesor " + profe.nombre); string huella = profe.huella; string huella10 = profe.huella10; if (sensor.Active && sensor.AddRegTemplateStrToFPCacheDBEx(fpcHandle, profe.id, huella, huella10) == 1) { Trace.WriteLine("Huella ingresada " + profe.nombre); } else { Trace.WriteLine("Huella no ingresada"); } } } }