IList <TimeTableModel> GetAllTimeTable() { IList <TimeTableModel> timeTable = new List <TimeTableModel>(); using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = @"SELECT * FROM TimeTables"; using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["Id"]); string day = reader["Day"].ToString(); var classId = reader["ClassId"] == DBNull.Value ? null : (object)reader["ClassId"].ToString(); var subjectId = reader["SubjectId"] == DBNull.Value ? null : (object)reader["SubjectId"].ToString(); ClassModel clazzz = this.GetClassById(classId.ToString()); SubjectModel sub = this.GetSubjectById(subjectId.ToString()); var timetable = new TimeTableModel(id, day, clazzz, sub); timeTable.Add(timetable); } } } } return(timeTable); }
public ActionResult Delete(int SeqNo) { TimeTableModel TModel = new TimeTableModel(); TModel.SeqNo = SeqNo; return(PartialView("DeleteTimeSlot", TModel)); }
TimeTableModel GetTimeTableById(int timetableId) { TimeTableModel timeTable = null; using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = @"SELECT * FROM TimeTables WHERE Id =@id"; cmd.Parameters.AddWithValue("@id", timetableId); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { int id = Convert.ToInt32(reader["Id"]); string day = reader["Day"].ToString(); var classId = reader["ClassId"] == DBNull.Value ? null : (object)reader["ClassId"].ToString(); var subjectId = reader["SubjectId"] == DBNull.Value ? null : (object)reader["SubjectId"].ToString(); ClassModel clazzz = this.GetClassById(classId.ToString()); SubjectModel sub = this.GetSubjectById(subjectId.ToString()); timeTable = new TimeTableModel(id, day, clazzz, sub); } } } } return(timeTable); }
public ActionResult ShowEditTimeTbl(long SeqNo) { TimeTableModel TModel = new TimeTableModel(); tblTimeTable TCtable = Connection.tblTimeTables.SingleOrDefault(x => x.SeqNo == SeqNo); DateTime F = DateTime.Parse(TCtable.FromTime.ToString()); DateTime T = DateTime.Parse(TCtable.ToTime.ToString()); TModel.FromTime_String = F.ToString("hh:mm tt"); TModel.ToTime_String = T.ToString("hh:mm tt"); TModel.SubjectId = TCtable.SubjectId; TModel.GradeId = TCtable.GradeId; TModel.ClassId = TCtable.ClassId; TModel.SchoolId = TCtable.SchoolId; var GradeSubject = Connection.SMGTgetGradeSubjects(TModel.GradeId, "CKC").ToList();//Need to Pass a Session Schoolid List <tblSubject> EGradeSubjectList = GradeSubject.Select(x => new tblSubject { SubjectId = x.SubjectId, ShortName = x.ShortName, SubjectName = x.SubjectName, IsActive = x.IsActive }).ToList(); ViewBag.SubjectEdit = new SelectList(EGradeSubjectList, "SubjectId", "SubjectName"); return(PartialView("EditTimeTbl", TModel)); }
public DetailRouteViewModel(TimeTableModel route) { _viewId = Guid.NewGuid(); db = new BusStationContext(); idRoute = route.idRoute; isEdit = false; NameDeparturePlace = route.DeparturePlace; NameArrivalPlace = route.ArrivalPlace; CostRoute = Convert.ToDecimal(route.Cost); timesList = new ObservableCollection <TimeSpan>(); foreach (var item in route.DepartureTime.OrderBy(i => i)) { timesList.Add(item); } selectedTime = timesList[0] == null ? default(TimeSpan) : timesList[0]; stopsList = new ObservableCollection <Stop>(); foreach (var item in route.StopList) { stopsList.Add(new Stop() { Id = item.Id, Name = item.Name, Cost = item.Cost }); } }
public ActionResult DisplayTimeTable(string ClassId, string GreadId) { TimeTableModel Model = new TimeTableModel(); Model.ClassId = ClassId; Model.GradeId = GreadId; return(PartialView("Display", Model)); }
void UpdateTable(TimeTableModel timeTableModel) { var curTrip = ListTrips.Where(i => i.idRoute == timeTableModel.idRoute).FirstOrDefault(); var idx = ListTrips.IndexOf(curTrip); ListTrips.Remove(curTrip); ListTrips.Insert(idx, timeTableModel); }
private TimeTable __populateValues(TimeTable entity, TimeTableModel model) { if (null == entity) { entity = new TimeTable(); } entity.ClassId = model.ClassId; entity.SectionId = model.SectionId; entity.LectureId = model.LectureId; entity.SubjectId = model.SubjectId; entity.Days = model.Days; return(entity); }
//repozytorium Timetable public void AddNewTimeTable(TimeTableModel timetable) { using (var connection = new System.Data.SQLite.SQLiteConnection(this.connString)) { connection.Open(); using (var cmd = connection.CreateCommand()) { cmd.CommandText = "INSERT INTO TimeTables (Day, ClassId, SubjectId) VALUES(@Id, @Day, @ClassId, @SubjectId)"; cmd.Parameters.AddWithValue("@Day", timetable.Day); cmd.Parameters.AddWithValue("@ClassId", timetable.Class.Id); cmd.Parameters.AddWithValue("@SubjectId", timetable.Subject.Id); cmd.ExecuteNonQuery(); } } }
public async static Task <TimeTableModel> GenerateTimeTableModel(TableCourses tableCourses) { Debug.WriteLine("Started: Generate TimeTableModel"); TimeTableModel model = new TimeTableModel(tableCourses.Name); var week1 = ParseTableCourses(tableCourses, 1, out int weekCount); model.Weeks.Add(week1); for (int i = 2; i <= weekCount; ++i) { model.Weeks.Add(ParseTableCourses(tableCourses, i, out weekCount)); } model.CurrentWeek = (await GetCurrentWeek()) - 1; Debug.WriteLine("Finished: Generate TimeTableModel"); return(model); }
public ActionResult Delete(TimeTableModel Model) { try { tblTimeTable TCtable = Connection.tblTimeTables.Find(Model.SeqNo); Connection.tblTimeTables.Remove(TCtable); Connection.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } catch { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(TimeTableModel Model) { try { tblTimeTable TimeTbl = new tblTimeTable(); TimeTbl.CreatedBy = "ADMIN"; TimeTbl.CreatedDate = DateTime.Now; TimeTbl.AcademicYear = "2017"; // Parameter TimeTbl.SchoolId = "CKC"; //Session TimeTbl.GradeId = Model.GradeId; TimeTbl.ClassId = Model.ClassId; TimeTbl.Day = Model.Day; TimeTbl.SubjectId = Model.SubjectId; DateTime F = DateTime.Parse(Model.FromTime_String); DateTime T = DateTime.Parse(Model.ToTime_String); TimeTbl.FromTime = TimeSpan.Parse(F.ToString("HH:mm")); TimeTbl.ToTime = TimeSpan.Parse(T.ToString("HH:mm")); TimeTbl.IsActive = "Y"; TimeTbl.PeriodSequenceNo = Model.PeriodSeqNo; Connection.tblTimeTables.Add(TimeTbl); Connection.SaveChanges(); var result = new { r = "S", Grade = Model.GradeId, Class = Model.ClassId, Day = Model.Day }; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception Ex) { var result = new { r = "E" }; Errorlog.ErrorManager.LogError("@ ActionResult Create(TimeTableModel Model)", Ex); return(Json(result, JsonRequestBehavior.AllowGet)); } }
public JsonResult EditTimeTable(TimeTableModel Model) { try { tblTimeTable Newt = Connection.tblTimeTables.SingleOrDefault(x => x.SeqNo == Model.SeqNo); Newt.ModifiedBy = "ADMIN"; Newt.ModifiedDate = DateTime.Now; DateTime F = DateTime.Parse(Model.FromTime_String); DateTime T = DateTime.Parse(Model.ToTime_String); Newt.FromTime = TimeSpan.Parse(F.ToString("HH:mm")); Newt.ToTime = TimeSpan.Parse(T.ToString("HH:mm")); Newt.SubjectId = Model.SubjectId; Connection.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); raise = new InvalidOperationException(message, raise); } } throw raise; } }
/// <summary> /// Todays Timetable /// </summary> public void TodaysTimetableLayout() { try { TitleBar lblPageName = new TitleBar("Today's TimeTable"); StackLayout slTitle = new StackLayout { Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 0), BackgroundColor = Color.White, Children = { lblPageName } }; Seperator spTitle = new Seperator(); BindableRadioGroup radByTeacherOrClass = new BindableRadioGroup(); radByTeacherOrClass.ItemsSource = new[] { "By Teacher", "By Class" }; radByTeacherOrClass.HorizontalOptions = LayoutOptions.FillAndExpand; radByTeacherOrClass.Orientation = StackOrientation.Horizontal; radByTeacherOrClass.TextColor = Color.Black; StackLayout slRadio = new StackLayout { Children = { radByTeacherOrClass }, HorizontalOptions = LayoutOptions.FillAndExpand }; #region By Teacher Image imgTeacherDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand }; Label lblTeacher = new Label { TextColor = Color.Black, Text = "Teacher" }; Picker pcrTeacher = new Picker { IsVisible = false, Title = "Teacher" }; StackLayout slTeacherDisplay = new StackLayout { Children = { lblTeacher, pcrTeacher, imgTeacherDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) }; Frame frmTeacher = new Frame { Content = slTeacherDisplay, HorizontalOptions = LayoutOptions.FillAndExpand, OutlineColor = Color.Black, Padding = new Thickness(10) }; var teacherTap = new TapGestureRecognizer(); teacherTap.NumberOfTapsRequired = 1; // single-tap teacherTap.Tapped += (s, e) => { pcrTeacher.Focus(); }; frmTeacher.GestureRecognizers.Add(teacherTap); slTeacherDisplay.GestureRecognizers.Add(teacherTap); StackLayout slTeacherFrameLayout = new StackLayout { Children = { frmTeacher } }; StackLayout slTeacherLayout = new StackLayout { Children = { slTeacherFrameLayout }, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, IsVisible = false }; Label lblStandardName = new Label { Text = "Standard Name", TextColor = Color.Black }; StackLayout slStandardName = new StackLayout { Children = { lblStandardName }, VerticalOptions = LayoutOptions.CenterAndExpand, }; Label lblClassTypeName = new Label { Text = "Class Type Name", TextColor = Color.Black }; StackLayout slClassTypeName = new StackLayout { Children = { lblClassTypeName }, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; Label lblStubjectName = new Label { Text = "Subject Name", TextColor = Color.Black }; StackLayout slSubjectName = new StackLayout { Children = { lblStubjectName }, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand }; #endregion #region By Class Image imgStandardDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand }; Label lblStandard = new Label { TextColor = Color.Black, Text = "Standard" }; Picker pcrStandard = new Picker { IsVisible = false, Title = "Standard" }; StackLayout slStandardDisplay = new StackLayout { Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) }; Frame frmStandard = new Frame { Content = slStandardDisplay, HorizontalOptions = LayoutOptions.FillAndExpand, OutlineColor = Color.Black, Padding = new Thickness(10) }; var standardTap = new TapGestureRecognizer(); standardTap.NumberOfTapsRequired = 1; // single-tap standardTap.Tapped += (s, e) => { pcrStandard.Focus(); }; frmStandard.GestureRecognizers.Add(standardTap); slStandardDisplay.GestureRecognizers.Add(standardTap); StackLayout slStandardFrameLayout = new StackLayout { Children = { frmStandard } }; StackLayout slStandardLayout = new StackLayout { Children = { slStandardFrameLayout }, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, }; Image imgClassDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand }; Label lblClass = new Label { TextColor = Color.Black, Text = "Class" }; Picker pcrClass = new Picker { IsVisible = false, Title = "Class" }; StackLayout slClassDisplay = new StackLayout { Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) }; Frame frmClass = new Frame { Content = slClassDisplay, HorizontalOptions = LayoutOptions.FillAndExpand, OutlineColor = Color.Black, Padding = new Thickness(10) }; var classTap = new TapGestureRecognizer(); classTap.NumberOfTapsRequired = 1; // single-tap classTap.Tapped += (s, e) => { pcrClass.Focus(); }; frmClass.GestureRecognizers.Add(classTap); slClassDisplay.GestureRecognizers.Add(classTap); StackLayout slClassFrameLayout = new StackLayout { Children = { frmClass } }; StackLayout slClassLayout = new StackLayout { Children = { slClassFrameLayout }, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, IsVisible = false }; //Grid Header Label lblTeachername = new Label { Text = "Teacher Name", TextColor = Color.Black }; StackLayout slTeacherName = new StackLayout { Children = { lblTeachername }, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand }; Label lblStubject = new Label { Text = "Subject Name", TextColor = Color.Black }; StackLayout slSubject = new StackLayout { Children = { lblStubject }, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand }; #endregion Label lblSequensNo = new Label { Text = "No", TextColor = Color.Black }; StackLayout slSequensNo = new StackLayout { Children = { lblSequensNo }, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand }; StackLayout grid = new StackLayout { //Children = { slTeacherName, slSequensNo, slSubjectName }, Orientation = StackOrientation.Horizontal, IsVisible = false }; Seperator spDisplayHeader = new Seperator { IsVisible = false }; StackLayout slSearchinOneCol = new StackLayout { Children = { slStandardLayout, slClassLayout }, Orientation = StackOrientation.Horizontal, IsVisible = false }; _NotAvailData = new Label { Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false }; _Loader = new LoadingIndicator(); radByTeacherOrClass.CheckedChanged += (sender, e) => { Device.BeginInvokeOnMainThread(async () => { var radio = sender as CustomRadioButton; if (radio == null || radio.Id == -1) { return; } if (radio.Text == "By Teacher") { slTeacherLayout.IsVisible = true; slSearchinOneCol.IsVisible = false; foreach (TeacherModel item in _TeacherList) { pcrTeacher.Items.Add(item.Name); } grid.Children.Add(slSequensNo); grid.Children.Add(slStandardDisplay); grid.Children.Add(slClassTypeName); grid.Children.Add(slSubjectName); } else { slSearchinOneCol.IsVisible = true; slTeacherLayout.IsVisible = false; grid.Children.Add(slSequensNo); grid.Children.Add(slTeacherName); grid.Children.Add(slSubject); _StatndardList = await StandardModel.GetStandard(); foreach (StandardModel item in _StatndardList) { pcrStandard.Items.Add(item.Name); } } }); }; //List view ListView TimeTableListView = new ListView { RowHeight = 50, SeparatorColor = Color.Gray }; TimeTableListView.ItemTemplate = new DataTemplate(() => new FillUpAttendanceCell()); pcrStandard.SelectedIndexChanged += (sender, e) => { Device.BeginInvokeOnMainThread(async () => { try { _Loader.IsShowLoading = true; pcrClass.Items.Clear(); string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex]; _SelectedStandardID = _StatndardList.Where(x => x.Name == standardName).FirstOrDefault().Id; _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID); if (_ClassTypeList.Count > 0 && _ClassTypeList != null) { slClassLayout.IsVisible = true; _NotAvailData.IsVisible = false; } else { slClassLayout.IsVisible = false; _NotAvailData.IsVisible = true; } foreach (ClassTypeModel item in _ClassTypeList) { pcrClass.Items.Add(item.Name); } _Loader.IsShowLoading = false; } catch (Exception ex) { } }); }; //Class Picker Selected pcrClass.SelectedIndexChanged += (sender, e) => { Device.BeginInvokeOnMainThread(async () => { _Loader.IsShowLoading = true; _NotAvailData.IsVisible = false; string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex]; _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id; //Get time table list _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedStandardID, _SelectedClassTypeID); if (_TimeTableList != null && _TimeTableList.Count > 0) { grid.IsVisible = true; spDisplayHeader.IsVisible = true; Items = new ObservableCollection<TimeTableModel>(_TimeTableList); TimeTableListView.ItemsSource = Items; } else { grid.IsVisible = false; spDisplayHeader.IsVisible = false; _NotAvailData.Text = "There is no data for selected standard and class."; _NotAvailData.IsVisible = true; } _Loader.IsShowLoading = false; }); }; //Class Picker Selected pcrTeacher.SelectedIndexChanged += (sender, e) => { Device.BeginInvokeOnMainThread(async () => { _Loader.IsShowLoading = true; _NotAvailData.IsVisible = false; string teacherName = lblTeacher.Text = pcrTeacher.Items[pcrTeacher.SelectedIndex]; _SelectedTeacherID = _TeacherList.FirstOrDefault(x => x.Name == teacherName).ID; //Get time table list _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedTeacherID); if (_TimeTableList != null && _TimeTableList.Count > 0) { grid.IsVisible = true; spDisplayHeader.IsVisible = true; Items = new ObservableCollection<TimeTableModel>(_TimeTableList); TimeTableListView.ItemsSource = Items; } else { grid.IsVisible = false; spDisplayHeader.IsVisible = false; _NotAvailData.Text = "There is no data for selected standard and class."; _NotAvailData.IsVisible = true; } _Loader.IsShowLoading = false; }); }; StackLayout slTimeTable = new StackLayout { Children = { new StackLayout{ Padding = new Thickness(20, Device.OnPlatform(40,20,0), 20, 20), Children = {slTitle, spTitle.LineSeperatorView,slRadio,slTeacherLayout, slSearchinOneCol,grid,spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData,TimeTableListView}, VerticalOptions = LayoutOptions.FillAndExpand, }, }, BackgroundColor = LayoutHelper.PageBackgroundColor }; Content = new ScrollView { Content = slTimeTable, }; } catch (Exception ex) { throw; } }
public static TimeTable ToEntity(this TimeTableModel model, TimeTable destination) { return(model.MapTo(destination)); }
public FakeLibrusManager() { this.classes.Add(new ClassModel("IA")); this.classes.Add(new ClassModel("IB")); this.classes.Add(new ClassModel("IC")); var clazz = this.GetClassById("IA"); this.students.Add(new StudentModel(1, "Aneta", "Dams", clazz, true)); this.students.Add(new StudentModel(2, "Karolina", "Kowalska", clazz, true)); this.students.Add(new StudentModel(3, "Anna", "Nowak", clazz, true)); this.students.Add(new StudentModel(4, "Mateusz", "Brzeziński", clazz, false)); this.students.Add(new StudentModel(5, "Justyna", "Karpińska", clazz, true)); var clazz1 = this.GetClassById("IB"); this.students.Add(new StudentModel(6, "Maciej", "Sikorski", clazz1, false)); this.students.Add(new StudentModel(7, "Paweł", "Nowakowski", clazz1, false)); this.students.Add(new StudentModel(8, "Adrian", "Rydzyński", clazz1, false)); this.students.Add(new StudentModel(9, "Monika", "Kwiatkowska", clazz1, true)); var clazz2 = this.GetClassById("IC"); this.students.Add(new StudentModel(10, "Anna", "Mrozowska", clazz2, true)); this.students.Add(new StudentModel(11, "Kamila", "Boruta", clazz2, true)); this.students.Add(new StudentModel(12, "Andrzej", "Gutowski", clazz2, false)); this.students.Add(new StudentModel(13, "Szymon", "Kołodziej", clazz2, false)); this.subjects.Add(new SubjectModel("AM", "Analiza Matematyczna")); this.subjects.Add(new SubjectModel("MD", "Matematyka Dyskretna")); this.subjects.Add(new SubjectModel("AiSD", "Algorytmy i struktury danych")); this.subjects.Add(new SubjectModel("SO", "Systemy Operacyjne")); this.subjects.Add(new SubjectModel("PI", "Programowanie I (C++)")); this.subjects.Add(new SubjectModel("AL", "Algebra Liniowa")); this.subjects.Add(new SubjectModel("SOS", "Środowisko Obliczeń Symblicznych")); this.subjects.Add(new SubjectModel("TJF", "Teoria Języków Formalnych")); this.subjects.Add(new SubjectModel("PII", "Programowanie II (C#)")); this.subjects.Add(new SubjectModel("PB", "Projekt Bazodanowy")); this.subjects.Add(new SubjectModel("LG", "Laboratorium Grafiki")); this.subjects.Add(new SubjectModel("PIII", "Programowanie III (Java)")); this.subjects.Add(new SubjectModel("TO", "Teoria Obliczalności")); int id = 0; Random gen = new Random(); id++; var date = "środa"; var table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("AM")); this.timeTables.Add(table); var start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("MD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IA"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IB"), this.GetSubjectById("TJF")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date, this.GetClassById("IC"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 1, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; var date1 = "czwartek"; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("PII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IA"), this.GetSubjectById("PB")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IB"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date1, this.GetClassById("IC"), this.GetSubjectById("AM")); this.timeTables.Add(table); start = new DateTime(2014, 10, 2, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; var date2 = "piątek"; table = new TimeTableModel(id, date2, this.GetClassById("IA"), this.GetSubjectById("AiSD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IB"), this.GetSubjectById("PI")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IC"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IA"), this.GetSubjectById("TJF")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IB"), this.GetSubjectById("AM")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date2, this.GetClassById("IC"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 3, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; id++; var date3 = "poniedziałek"; table = new TimeTableModel(id, date3, this.GetClassById("IA"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IB"), this.GetSubjectById("AL")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IC"), this.GetSubjectById("MD")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IA"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IB"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date3, this.GetClassById("IC"), this.GetSubjectById("SO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 6, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; id++; var date4 = "wtorek"; table = new TimeTableModel(id, date4, this.GetClassById("IA"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IB"), this.GetSubjectById("PIII")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IC"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IA"), this.GetSubjectById("SOS")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IA")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IB"), this.GetSubjectById("LG")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IB")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } id++; table = new TimeTableModel(id, date4, this.GetClassById("IC"), this.GetSubjectById("TO")); this.timeTables.Add(table); start = new DateTime(2014, 10, 7, 8, 0, 0).Date; for (int t = 0; t < 9; t++) { var d = start.AddDays(7 * t); foreach (StudentModel student in this.GetStudentsByClass("IC")) { PresenceModel pre = new PresenceModel(student, table.Subject, d, null); int prob = gen.Next(100); if (prob < 80) { pre.Present = true; } else { pre.Present = false; } this.presences.Add(pre); } } }
public static TimeTable ToEntity(this TimeTableModel model) { return(model.MapTo <TimeTableModel, TimeTable>()); }
public DetailRouteView(TimeTableModel route) { InitializeComponent(); detail = new DetailRouteViewModel(route); DataContext = detail; }