/// <summary> /// Hora1 debe ser anterior a hora2 /// </summary> public static bool esMultiplo30(CustomHour hora1, CustomHour hora2) { if (hora1.esDespues(hora2)) { return(false); } return(((hora1.toMinutes() - hora2.toMinutes()) % 30) == 0); }
private void generarTurnos(CustomHour horaInicio, CustomHour horaFin, DateTime fecha) { int cantTurnos = ((horaInicio.toMinutes() - horaFin.toMinutes()) / 30) * -1; int i; for (i = 0; i < cantTurnos; i++) { CustomHour aux = CustomHour.FromMinutes(horaInicio.toMinutes() + 30 * i); fecha = fecha.AddHours(aux.hora); fecha = fecha.AddMinutes(aux.minuto); //Genero el turno Dictionary <string, object> parametros = new Dictionary <string, object>() { { "@matricula", profesional.Matricula }, { "@especialidad", profesional.Especialidades[listaEspecialidades.SelectedIndex].Id }, { "@fecha", fecha } }; ConexionesDB.ExecuteNonQuery("Turno_Agregar", parametros); fecha = fecha.AddHours(-aux.hora); fecha = fecha.AddMinutes(-aux.minuto); } }