public IActionResult IsTimetableUnique(Timetables tt) { var curr = _context.TeacherSubjectGroup .Include(t => t.TeacherSubject) .Include(t => t.TeacherSubject.Subject) .Include(t => t.TeacherSubject.Teacher) .Include(t => t.Group) .Include(t => t.Group.GroupType) .Include(t => t.Group.Grade) .Where(t => t.TeacherSubjectGroupId == tt.TeacherSubjectGroupId) .FirstOrDefault(); if (_context.Timetables .Include(t => t.TeacherSubjectGroup) .Include(t => t.TeacherSubjectGroup.TeacherSubject) .Include(t => t.TeacherSubjectGroup.TeacherSubject.Subject) .Include(t => t.TeacherSubjectGroup.TeacherSubject.Teacher) .Include(t => t.TeacherSubjectGroup.Group) .Include(t => t.TeacherSubjectGroup.Group.GroupType) .Include(t => t.TeacherSubjectGroup.Group.Grade) .Any(t => t.WeekDayNumber == tt.WeekDayNumber && t.LessonNumber == tt.LessonNumber && (t.TeacherSubjectGroup.TeacherSubject.TeacherId == (curr.TeacherSubject.TeacherId) || t.TeacherSubjectGroup.Group.GradeId == (curr.Group.GradeId) && t.TeacherSubjectGroup.Group.GroupTypeId != (curr.Group.GroupTypeId) || t.TeacherSubjectGroup.GroupId == curr.GroupId) && (t.Oddness == 0 || t.Oddness + tt.Oddness != 3) && t.TimetableId != tt.TimetableId)) { return(Json(false)); } return(Json(true)); }
public ActionResult DeleteConfirmed(int id) { Timetables timetables = db.Timetables.Find(id); db.Timetables.Remove(timetables); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool ExistTimeTable(IMT_TimeTables timetablesTable, long lTariff, long dayType, COPSDate dtOper, ref bool bBlockFound, bool bConsiderCloseInterval) { trace.Write(TraceLevel.Debug, "CiMD_Tariffs::ExistTimeTable"); bool fnResult = true; try { bBlockFound = false; int minutes = dtOper.TimeToMinutes(); trace.Write(TraceLevel.Info, $"QUERY : Which are the Time Table, Init Hour, End Hour for the Tariff({lTariff}) at this Hour({minutes / 60}:{minutes % 60}) for Day({dayType})?"); int nTimIni = -1; int nTimEnd = -1; IEnumerable <Tariffs> tariffs = Data.Where(w => w.TAR_ID == lTariff && w.TAR_DDAY_ID == dayType && (w.TAR_INIDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_INIDATE <= dtOper) && (w.TAR_ENDDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_ENDDATE > dtOper) ); foreach (Tariffs tariff in tariffs) { int nDummyTimIni = -1; int nDummyTimEnd = -1; Timetables foundTimeTable = timetablesTable.GetIniEndFromTimId(tariff.TAR_TIM_ID.Value); trace.Write(TraceLevel.Info, $"Minutes ({minutes:D2}) TimTabIni ({foundTimeTable.TIM_INI:D2}) TimTabEnd ({foundTimeTable.TIM_END:D2})"); bool bGetTimetable = false; if (bConsiderCloseInterval) { bGetTimetable = ((minutes <= nDummyTimEnd) && (minutes >= nDummyTimIni)); } else { bGetTimetable = ((minutes < nDummyTimEnd) && (minutes >= nDummyTimIni)); } if (bGetTimetable) { trace.Write(TraceLevel.Info, $"Interval Found Minutes {minutes / 60:D2}:{minutes % 60:D2} < {foundTimeTable.TIM_INI / 60:D2}:{foundTimeTable.TIM_INI % 60:D2}"); bBlockFound = true; break; } } } catch (Exception error) { trace.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
public ActionResult Edit([Bind(Include = "Id,Kategoria,Numer,Nazwa,StacjaPoczątkowa,StacjaKońcowa,Odjazd,Przyjazd,Obsługa,Uwagi")] Timetables timetables) { if (ModelState.IsValid) { db.Entry(timetables).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(timetables)); }
private async Task GetFlights() { var timetables = await FlightService.GetAirportFlights(CurrentAirport.codeIataAirport, Constants.FlightTypeDeparture); timetables.ForEach(item => { item.arrival.City = Cities.FirstOrDefault(c => c.codeIataCity == item.arrival.iataCode)?.nameCity ?? "City not found"; item.departure.City = Cities.FirstOrDefault(c => c.codeIataCity == item.departure.iataCode)?.nameCity ?? "City not found"; Timetables.Add(item); }); }
public ActionResult Edit([Bind(Include = "Id,SchoolsId,LessonsId,Day,Hour,RoomsId,Size,Part")] Timetables timetables) { if (ModelState.IsValid) { db.Entry(timetables).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SchoolsId = new SelectList(db.Schools, "Id", "AspNetUsersId", timetables.SchoolsId); ViewBag.LessonsId = new SelectList(db.Lessons, "Id", "Schedule", timetables.LessonsId); ViewBag.RoomsId = new SelectList(db.Rooms, "Id", "Name", timetables.RoomsId); return(View(timetables)); }
// GET: Timetables/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Timetables timetables = db.Timetables.Find(id); if (timetables == null) { return(HttpNotFound()); } return(View(timetables)); }
private void setSchoolTimetableToDAtaBaseTimetable(Schools school, SchoolTimetable stt) { foreach (Lesson l in stt.getLessons()) { //-------------------------------- Groups gr = db.Groups.Find(l.getGroup().getName()); //-------------------------------- //-------------------------------- Teachers te = db.Teachers.Find(l.getTeacher().getName()); //-------------------------------- //-------------------------------- Rooms ro = db.Rooms.Find(l.getRoom().getName()); //-------------------------------- //-------------------------------- Lessons le = null; List <Lessons> lessons = (from b in db.Lessons where b.SchoolsId.Equals(school.Id) select b).ToList(); foreach (Lessons ls in lessons) { if (ls.Groups.Equals(gr) && ls.Teachers.Equals(te) && ls.Subjects.Id.Equals(l.getSubject().getName()) ) { le = ls; break; } } //-------------------------------- for (int i = 0; i < l.getSize(); i++) { Timetables timetable = new Timetables(); timetable.Hour = l.getSlots()[i].hour; timetable.Day = l.getSlots()[i].day; timetable.LessonsId = le.Id; timetable.Part = i + 1; timetable.SchoolsId = school.Id; timetable.RoomsId = ro.Id; timetable.Size = l.getSize(); db.Timetables.Add(timetable); db.SaveChanges(); } } }
// GET: Timetables/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Timetables timetables = db.Timetables.Find(id); if (timetables == null) { return(HttpNotFound()); } ViewBag.SchoolsId = new SelectList(db.Schools, "Id", "AspNetUsersId", timetables.SchoolsId); ViewBag.LessonsId = new SelectList(db.Lessons, "Id", "Schedule", timetables.LessonsId); ViewBag.RoomsId = new SelectList(db.Rooms, "Id", "Name", timetables.RoomsId); return(View(timetables)); }
public CreateHomeScheduleRequest(string homeId, double hgTemp, double awayTemp, string name, Timetable[] timetables = null, Zone[] zones = null) : this() { HomeId = homeId; Name = name; HgTemp = hgTemp; AwayTemp = awayTemp; if (timetables != null) { Timetables.AddRange(timetables); } if (zones != null) { Zones.AddRange(zones); } }
public async Task <IActionResult> Edit(int id, [Bind("TimetableId,WeekDayNumber,LessonNumber,Oddness,TeacherSubjectGroupId")] Timetables timetables) { if (id != timetables.TimetableId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(timetables); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimetablesExists(timetables.TimetableId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeacherSubjectGroupId"] = new SelectList(_context.TeacherSubjectGroup .Include(t => t.TeacherSubject) .Include(t => t.TeacherSubject.Subject) .Include(t => t.TeacherSubject.Teacher) .Include(t => t.Group) .Include(t => t.Group.GroupType) .Include(t => t.Group.Grade), "TeacherSubjectGroupId", "TeacherSubjectGroupName", timetables.TeacherSubjectGroupId); return(View(timetables)); }
public async Task <IActionResult> Create([Bind("TimetableId,WeekDayNumber,LessonNumber,Oddness,TeacherSubjectGroupId")] Timetables timetables) { if (ModelState.IsValid) { _context.Add(timetables); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeacherSubjectGroupId"] = new SelectList(_context.TeacherSubjectGroup .Include(t => t.TeacherSubject) .Include(t => t.TeacherSubject.Subject) .Include(t => t.TeacherSubject.Teacher) .Include(t => t.Group) .Include(t => t.Group.GroupType) .Include(t => t.Group.Grade), "TeacherSubjectGroupId", "TeacherSubjectGroupName", timetables.TeacherSubjectGroupId); return(View(timetables)); }
public ActionResult Create([Bind(Include = "Id,SchoolsId,LessonsId,Day,Hour,RoomsId,Size,Part")] Timetables timetables) { if (ModelState.IsValid) { db.Timetables.Add(timetables); db.SaveChanges(); return(RedirectToAction("Index")); } List <Schools> list = new List <Schools>(); var user = User.Identity.GetUserId(); list = (from b in db.Schools where b.AspNetUsersId.Equals(user) select b).ToList(); // .Where(s => s.SchoolsId == list.First().Id).ToList() ViewBag.SchoolsId = new SelectList(list, "Id", "AspNetUsersId", timetables.SchoolsId); ViewBag.LessonsId = new SelectList(db.Lessons.Where(s => s.SchoolsId == list.First().Id).ToList(), "Id", "Schedule", timetables.LessonsId); ViewBag.RoomsId = new SelectList(db.Rooms.Where(s => s.SchoolsId == list.First().Id).ToList(), "Id", "Name", timetables.RoomsId); return(View(timetables)); }
public TimetablesController(Timetables view) { this.view = view; this.employeeModel = new Models.Employee(); this.workingHoursModel = new Models.WorkingHours(); }
public void addLesson(Timetables tt) { days[tt.Hour].hours[tt.Day].lessons.Add(new LessonsAndRoom(tt.Lessons, tt.Rooms)); }
public bool GetTariffTimeTable(long lTariff, long dayType, COPSDate dtOper, long numDaysPassed, IMT_TimeTables timetables, bool considerCloseInterval, out Tariffs outTariff, out Timetables outTimetable) { trace.Write(TraceLevel.Debug, "IMT_Tariffs::GetTariffTimeTable"); bool fnResult = true; outTariff = null; outTimetable = null; try { Guard.IsNull(dtOper, nameof(dtOper)); int totalMinutes = dtOper.TimeToMinutes(); trace.Write(TraceLevel.Info, $@"QUERY: Which are the Time Table, Init Hour, End Hour for the Tariff({lTariff}) at this Hour({totalMinutes/60:D2}:{totalMinutes%60:D2}) for Day({dayType})?"); IEnumerable <Tariffs> tariffs = Data.Where(w => w.TAR_ID == lTariff && w.TAR_DDAY_ID == dayType && (w.TAR_INIDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_INIDATE <= dtOper) && (w.TAR_ENDDATE.GetStatus() == COPSDateStatus.Valid && w.TAR_ENDDATE > dtOper) ); bool timtableHasBeenFound = false; if (tariffs.Any()) { bool bApplyTariff = false; foreach (Tariffs tariff in tariffs) { if (numDaysPassed != GlobalDefs.DEF_UNDEFINED_VALUE) { bApplyTariff = (tariff.TAR_NUMDAYS_PASSED.HasValue && tariff.TAR_NUMDAYS_PASSED.Value == numDaysPassed); } else { bApplyTariff = !tariff.TAR_NUMDAYS_PASSED.HasValue; } if (bApplyTariff) { Timetables foundTimeTable = timetables.GetIniEndFromTimId(tariff.TAR_TIM_ID.Value); trace.Write(TraceLevel.Info, $"Minutes ({totalMinutes:D2}) TimTabIni ({foundTimeTable.TIM_INI:D2}) TimTabEnd ({foundTimeTable.TIM_END:D2})"); bool getTimetable = false; if (considerCloseInterval) { getTimetable = totalMinutes <= foundTimeTable.TIM_END && totalMinutes >= foundTimeTable.TIM_INI; } else { getTimetable = totalMinutes < foundTimeTable.TIM_END && totalMinutes >= foundTimeTable.TIM_INI; } if (getTimetable) { trace.Write(TraceLevel.Info, $"Interval Found Minutes {totalMinutes/60:D2}:{totalMinutes%60:D2} < {foundTimeTable.TIM_INI/60:D2}:{foundTimeTable.TIM_INI % 60:D2}"); outTariff = tariff; outTimetable = foundTimeTable; timtableHasBeenFound = true; break; } } } } } catch (Exception error) { trace.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.SuspendLayout(); // // Panels // LogInPanel logInPanel = new LogInPanel(); ManagerMainPanel managerMainPanel = new ManagerMainPanel(); ManagerAnalytics managerAnalyticsPanel = new ManagerAnalytics(managerMainPanel.Panel); DoctorInCharge managerDICPanel = new DoctorInCharge(managerMainPanel.Panel); Medicaments managerMedicamentsPanel = new Medicaments(managerMainPanel.Panel); Services managerServicesPanel = new Services(managerMainPanel.Panel); Timetables managerTimetablesPanel = new Timetables(managerMainPanel.Panel); Users managerUsersPanel = new Users(managerMainPanel.Panel); OperatorMainPanel operatorMainPanel = new OperatorMainPanel(); OperatorPatientCharts operatorPatientChartsPanel = new OperatorPatientCharts(operatorMainPanel.Panel); Patients operatorPatientsPanel = new Patients(operatorMainPanel.Panel); Reservations operatorReservationsPanel = new Reservations(operatorMainPanel.Panel); OperatorTimetables operatorTimeTablesPanel = new OperatorTimetables(operatorMainPanel.Panel); DoctorMainPanel doctorMainPanel = new DoctorMainPanel(); TimeTablesDoc doctorTimeTablesDocPanel = new TimeTablesDoc(doctorMainPanel.Panel); ReservationsDoc doctorReservationsDocPanel = new ReservationsDoc(doctorMainPanel.Panel); Prescription doctorPrescriptionPanel = new Prescription(doctorMainPanel.Panel); NurseMainPanel nurseMainPanel = new NurseMainPanel(); Schedule nurseSchedulePanel = new Schedule(nurseMainPanel.Panel); ReservationsNurse nurseReservationsNursePanel = new ReservationsNurse(nurseMainPanel.Panel); AnalysisNurse nurseAnalysisPanel = new AnalysisNurse(nurseMainPanel.Panel); logInPanel.initNextPanels( managerMainPanel, operatorMainPanel, doctorMainPanel, nurseMainPanel ); managerMainPanel.initNextPanels( managerUsersPanel, managerTimetablesPanel, managerServicesPanel, managerMedicamentsPanel, managerDICPanel, managerAnalyticsPanel, logInPanel ); operatorMainPanel.initNextPanels( operatorPatientsPanel, operatorPatientChartsPanel, operatorReservationsPanel, operatorTimeTablesPanel, logInPanel ); doctorMainPanel.initNextPanels( doctorTimeTablesDocPanel, doctorReservationsDocPanel, doctorPrescriptionPanel, logInPanel ); nurseMainPanel.initNextPanels( nurseSchedulePanel, logInPanel, nurseReservationsNursePanel, nurseAnalysisPanel ); // // MainForm // this.AutoScaleMode = AutoScaleMode.Font; this.Icon = ((Icon)(resources.GetObject("$this.Icon"))); this.Left = this.Top = 0; this.MaximumSize = new Size(Dimensions.VIEW_WIDTH, Dimensions.VIEW_HEIGHT); this.MinimumSize = this.MaximumSize; this.Name = "MainForm"; this.MaximizeBox = false; this.StartPosition = FormStartPosition.CenterScreen; this.Text = "E-Pacient GG"; this.ResumeLayout(false); this.PerformLayout(); this.Controls.Add(logInPanel.Panel); this.Controls.Add(managerMainPanel.Panel); this.Controls.Add(managerAnalyticsPanel.Panel); this.Controls.Add(managerDICPanel.Panel); this.Controls.Add(managerMedicamentsPanel.Panel); this.Controls.Add(managerTimetablesPanel.Panel); this.Controls.Add(managerUsersPanel.Panel); this.Controls.Add(managerServicesPanel.Panel); this.Controls.Add(operatorMainPanel.Panel); this.Controls.Add(operatorPatientsPanel.Panel); this.Controls.Add(operatorPatientChartsPanel.Panel); this.Controls.Add(operatorReservationsPanel.Panel); this.Controls.Add(operatorTimeTablesPanel.Panel); this.Controls.Add(doctorMainPanel.Panel); this.Controls.Add(doctorTimeTablesDocPanel.Panel); this.Controls.Add(doctorReservationsDocPanel.Panel); this.Controls.Add(doctorPrescriptionPanel.Panel); this.Controls.Add(nurseMainPanel.Panel); this.Controls.Add(nurseSchedulePanel.Panel); this.Controls.Add(nurseAnalysisPanel.Panel); this.Controls.Add(nurseReservationsNursePanel.Panel); }