public void ApplyDragDrop( string target, int?week, DateTime?time, DragDropInfo i) { List <int> volids = null; switch (i.source) { case "nocommits": volids = (from p in Volunteers() where p.commits == 0 select p.PeopleId).ToList(); break; case "commits": volids = (from p in Volunteers() where p.commits > 0 select p.PeopleId).ToList(); break; case "all": volids = (from p in Volunteers() select p.PeopleId).ToList(); break; case "registered": case "person": volids = new List <int>() { i.pid.ToInt() }; break; default: return; } if (target == "week") { var slots = (from s in FetchSlots() where s.Time.TimeOfDay == time.Value.TimeOfDay where s.Week == week || week == 0 select s).ToList(); foreach (var PeopleId in volids) { if (i.source == "registered") { DropFromAll(PeopleId); } foreach (var s in slots) { Attend.MarkRegistered(DbUtil.Db, OrgId, PeopleId, s.Time, AttendCommitmentCode.Attending, AvoidRegrets: true); } } } else if (target == "meeting") { foreach (var PeopleId in volids) { if (i.source == "registered") { DropFromMeeting(i.mid.Value, PeopleId); } Attend.MarkRegistered(DbUtil.Db, OrgId, PeopleId, time.Value, AttendCommitmentCode.Attending, AvoidRegrets: true); } } else if (target == "clear") { foreach (var PeopleId in volids) { if (i.source == "registered") { DropFromMeeting(i.mid.Value, PeopleId); } else { DropFromAll(PeopleId); } } } }
public void ApplyDragDrop( string target, int? week, DateTime? time, DragDropInfo i) { List<int> volids = null; switch (i.source) { case "nocommits": volids = (from p in Volunteers() where p.commits == 0 select p.PeopleId).ToList(); break; case "commits": volids = (from p in Volunteers() where p.commits > 0 select p.PeopleId).ToList(); break; case "all": volids = (from p in Volunteers() select p.PeopleId).ToList(); break; case "registered": case "person": volids = new List<int>() { i.pid.ToInt() }; break; default: return; } if (target == "week") { var slots = (from s in FetchSlots() where s.Time.TimeOfDay == time.Value.TimeOfDay where s.Week == week || week == 0 select s).ToList(); foreach (var PeopleId in volids) { if (i.source == "registered") DropFromAll(PeopleId); foreach (var s in slots) Attend.MarkRegistered(DbUtil.Db, OrgId, PeopleId, s.Time, AttendCommitmentCode.Attending, AvoidRegrets: true); } } else if (target == "meeting") { foreach (var PeopleId in volids) { if (i.source == "registered") DropFromMeeting(i.mid.Value, PeopleId); Attend.MarkRegistered(DbUtil.Db, OrgId, PeopleId, time.Value, AttendCommitmentCode.Attending, AvoidRegrets: true); } } else if (target == "clear") { foreach (var PeopleId in volids) { if (i.source == "registered") DropFromMeeting(i.mid.Value, PeopleId); else DropFromAll(PeopleId); } } }