/// <summary> /// Add class / Display class in the table with color highlighting. (Method is overridable) /// </summary> /// <param name="Class">The school class object. (from acschedule library)</param> /// <param name="Data1">1st string to display in the report.</param> /// <param name="Data2">2nd string to display in the report.</param> /// <param name="Data3">3rd string to display in the report.</param> /// <param name="Highlight">Color highlight of the class.</param> public virtual void AddClass(School_Class Class, string Data1, string Data2, string Data3, Color Highlight) { // Locate the appropriate row number. int row = int.Parse((new TimeSpan(Class.Class_TimeStart.Hour - 6, Class.Class_TimeStart.Minute, Class.Class_TimeStart.Second).TotalMinutes / 30).ToString()) + 2; // Count the number or rows to be highlighted. int time_includes = int.Parse((new TimeSpan(Class.Class_TimeEnd.Hour - Class.Class_TimeStart.Hour, Class.Class_TimeEnd.Minute - Class.Class_TimeStart.Minute, Class.Class_TimeEnd.Second - Class.Class_TimeStart.Second).TotalMinutes / 30).ToString()); int day = 0; // Determine the class day switch (Class.Day) { case "Monday": day = 2; break; case "Tuesday": day = 3; break; case "Wednesday": day = 4; break; case "Thursday": day = 5; break; case "Friday": day = 6; break; case "Saturday": day = 7; break; case "Sunday": day = 8; break; } // Display the class information (data1, data2). _p = _tbl.Rows[row].Cells[day].AddParagraph(string.Concat(Data1, '(', Data2, ')')); _p.Format.Font.Size = 9; _p.Format.Font.Bold = true; // Add shading to the class. for (int i = row; i <= row + time_includes - 1; i++) { _tbl.Rows[i].Cells[day].Shading.Color = Highlight; } // Display the 3rd data _p = _tbl.Rows[row + time_includes - 1].Cells[day].AddParagraph(Data3); _p.Format.Font.Size = 8; }
public ActionResult DeleteConfirmed(string id) { School_Class account = db.School_Class.Find(id); LogManager.createlog("delete", account.ToString()); School_Class school_Class = db.School_Class.Find(id); db.School_Class.Remove(school_Class); db.SaveChanges(); return(RedirectToAction("Index")); }
private void GetIndexClassCourse(School_Class Class) { for (int i = 0; i < courses.Count; i++) { if (Class.Course.Coursecode == courses[i].Coursecode) { index_ClassCourse = i; break; } } }
public ActionResult Create([Bind(Include = "Class_Number,Profile,Employee_Id")] School_Class school_Class) { LogManager.createlog("create", school_Class.ToString()); if (ModelState.IsValid) { db.School_Class.Add(school_Class); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "First_Name", school_Class.Employee_Id); ViewBag.Class_Number = new SelectList(db.Lesson, "Class_Number", "Subject_Name", school_Class.Class_Number); return(View(school_Class)); }
// GET: School_Class/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } School_Class school_Class = db.School_Class.Find(id); if (school_Class == null) { return(HttpNotFound()); } return(View(school_Class)); }
// GET: School_Class/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } School_Class school_Class = db.School_Class.Find(id); if (school_Class == null) { return(HttpNotFound()); } ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "First_Name", school_Class.Employee_Id); ViewBag.Class_Number = new SelectList(db.Lesson, "Class_Number", "Subject_Name", school_Class.Class_Number); return(View(school_Class)); }
public ActionResult Edit([Bind(Include = "Class_Number,Profile,Employee_Id")] School_Class school_Class) { String accountTemp = ""; using (MojDziennikEntities tempdb = new MojDziennikEntities()) { accountTemp = tempdb.School_Class.Find(school_Class.Class_Number).ToString(); } LogManager.createlog("Edit", accountTemp); if (ModelState.IsValid) { db.Entry(school_Class).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_Id = new SelectList(db.Employee, "Employee_ID", "First_Name", school_Class.Employee_Id); ViewBag.Class_Number = new SelectList(db.Lesson, "Class_Number", "Subject_Name", school_Class.Class_Number); return(View(school_Class)); }
internal void DisplayVisual_wRoom(School_Class Class, ListView Day_listview, Color course_Color) { for (int x = 0; x < Day_listview.Items.Count; x++) { if (Day_listview.Items[x].Text == Class.Class_TimeStart.ToShortTimeString()) { // // display class info to listview // Day_listview.Items[x].SubItems[1].Text = Class.Course.Coursecode; // display section(s) for (int y = 0; y < Class.Sections.Count; y++) { if (y == 0) { Day_listview.Items[x].SubItems[2].Text = Class.Sections[0].SectionName; } else { Day_listview.Items[x].SubItems[2].Text += string.Concat(", ", Class.Sections[y].SectionName); } } Day_listview.Items[x].SubItems[3].Text = Class.Class_Type; Day_listview.Items[x].SubItems[4].Text = string.Concat(Class.Instructor.FirstName, " ", Class.Instructor.LastName); Day_listview.Items[x].SubItems[5].Text = Class.Room.Name; int z = x; do { Day_listview.Items[z].BackColor = course_Color; z += 1; } while (DateTime.Compare(DateTime.Parse(Day_listview.Items[z].Text), DateTime.Parse(Class.Class_TimeEnd.ToShortTimeString())) < 0); } else if (DateTime.Parse(Day_listview.Items[x].Text) == DateTime.Parse(Class.Class_TimeEnd.ToShortTimeString())) { Day_listview.Items[x].BackColor = course_Color; } } Day_listview.SelectedItems.Clear(); }