public TimeSlots ParseTimeSlots() { var ts = new TimeSlots(); ts.TimeSlotLockDays = GetNullInt(); if (curr.indent == 0) { return(ts); } var startindent = curr.indent; while (curr.indent == startindent) { var slot = new TimeSlots.TimeSlot(); if (curr.kw != Parser.RegKeywords.None) { throw GetException("unexpected line in TimeSlots"); } slot.Description = GetLine(); if (curr.indent <= startindent) { ts.list.Add(slot); continue; } var ind = curr.indent; while (curr.indent == ind) { switch (curr.kw) { case Parser.RegKeywords.Time: slot.Time = GetTime(); break; case Parser.RegKeywords.DayOfWeek: slot.DayOfWeek = GetInt(); break; case Parser.RegKeywords.Limit: slot.Limit = GetInt(); break; default: throw GetException("unexpected line in TimeSlot"); } } ts.list.Add(slot); } return(ts); }
public static Settings SetFakeSettings(int?regType, int orgId) { if (regType == RegistrationTypeCode.ChooseVolunteerTimes) { var m = new Settings(); var timeSlots = new TimeSlots(); var ts1 = new TimeSlots.TimeSlot() { DayOfWeek = 0, Name = "MockTimeSlot", Time = System.DateTime.Now }; timeSlots.list.Add(ts1); m.TimeSlots = timeSlots; m.OrgId = orgId; return(m); } return(null); }