public Boolean fitGroup(Parish parish, Boolean fitLadies) { IEnumerable<Floor> openFloors = this.floors.Where(ff => ff.full == false); if (openFloors.Count() == 0) { this.full = true; return false; } foreach (Floor f in openFloors) { if (f.fitGroup(parish, fitLadies)) { if (this.gender == null && fitLadies) { this.gender = "F"; } else if (this.gender == null) { this.gender = "M"; } return true; } } return false; }
public ActionResult Create(Parish parish) { if (ModelState.IsValid) { db.parishes.Add(parish); db.SaveChanges(); return RedirectToAction("Index"); } return View(parish); }
public Boolean fitGroup(Parish parish, Boolean fitLadies) { String gender = fitLadies ? "F" : "M"; foreach (Building b in this.buildings.Where(fb => !fb.full && (fb.gender == gender || fb.gender == null))) { if (b.fitGroup(parish, fitLadies)) { return true; } } return false; }
private string parishSVG(Parish p, int index) { Color backColor = Color.FromArgb(p.curColor.backColor); Color foreColor = Color.FromArgb(p.curColor.foreColor); Boolean isMale = this.building.gender.ToLower() == "m"; String text = String.Format("({0}/{1}) {2}", isMale?p.maleStudents:p.femaleStudents, isMale?p.maleChaperones:p.femaleChaperones, p.name); return String.Format("<g id=\"key_{0}\" class=\"parish_key\">\n" + "<rect id=\"rect_key_{0}\" height=\"20\" width=\"20\" y=\"{1}\" x=\"{2}\" fill-opacity=\"100\" stroke=\"#000000\" stroke-width=\"2\" fill=\"rgb({3},{4},{5})\" />\n" + "<text x=\"{6}\" y=\"{7}\" fill=\"rgb({8},{9},{10})\">{11}</text>\n" + "</g>\n", p.ParishID, index * 25 + 10, this.width() + 10 - 200, backColor.R, backColor.G, backColor.B, this.width() - 200 + 35, index * 25 + 22, foreColor.R, foreColor.G, foreColor.B, text ); }
public Boolean fitGroup(Parish parish, Boolean fitLadies) { int chaperoneSize = fitLadies ? parish.femaleChaperones : parish.maleChaperones; int studentSize = fitLadies ? parish.femaleStudents : parish.maleStudents; IEnumerable<Room> openRooms = this.rooms.Where(fr => fr.assignedTo == null); if (openRooms.Count() == 0) { this.full = true; return false; } foreach (Room r in this.rooms.Where(fr => fr.assignedTo == null && fr.open)) { List<Room> fittedRooms = r.fitGroup(chaperoneSize, studentSize, null); if (fittedRooms != null) { foreach (Room fr in fittedRooms) { fr.assignedTo = parish; } return true; } } return false; }
public ActionResult Edit(Parish parish) { if (ModelState.IsValid) { db.Entry(parish).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(parish); }