public static AskCheckboxes Parse(Parser parser) { var cb = new AskCheckboxes(); cb.Label = parser.GetString("CheckBoxes"); cb.Min = parser.GetInt(Parser.RegKeywords.Minimum); cb.Max = parser.GetInt(Parser.RegKeywords.Maximum); cb.Cols = parser.GetInt(Parser.RegKeywords.Columns) ?? 1; cb.list = new List<CheckboxItem>(); if (parser.curr.indent == 0) return cb; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = CheckboxItem.Parse(parser, startindent); cb.list.Add(m); } var q = (from i in cb.list where i.SmallGroup != "nocheckbox" where i.SmallGroup != "comment" group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q))); return cb; }
public static AskCheckboxes Parse(Parser parser) { var cb = new AskCheckboxes(); cb.Label = parser.GetString("CheckBoxes"); cb.Min = parser.GetInt(Parser.RegKeywords.Minimum); cb.Max = parser.GetInt(Parser.RegKeywords.Maximum); cb.Cols = parser.GetInt(Parser.RegKeywords.Columns) ?? 1; cb.list = new List <CheckboxItem>(); if (parser.curr.indent == 0) { return(cb); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = CheckboxItem.Parse(parser, startindent); cb.list.Add(m); } var q = (from i in cb.list where i.SmallGroup != "nocheckbox" where i.SmallGroup != "comment" group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) { throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q))); } return(cb); }
public static OrgFee Parse(Parser parser, int startindent) { if (parser.curr.kw != Parser.RegKeywords.None) { throw parser.GetException("expected orgid only"); } var oid = parser.GetInt(); if (oid == 0) { parser.lineno--; throw parser.GetException("invalid orgid"); } var f = new OrgFee { OrgId = oid }; if (parser.curr.indent > startindent) { if (parser.curr.kw != Parser.RegKeywords.Fee) { throw parser.GetException("expected fee"); } f.Fee = parser.GetDecimal(); } return(f); }
public static TimeSlot Parse(Parser parser, int startindent) { var timeslot = new TimeSlot(); if (parser.curr.kw != Parser.RegKeywords.None) { throw parser.GetException("unexpected line in TimeSlots"); } timeslot.Description = parser.GetLine(); if (parser.curr.indent <= startindent) { return(timeslot); } var ind = parser.curr.indent; while (parser.curr.indent == ind) { switch (parser.curr.kw) { case Parser.RegKeywords.Time: timeslot.Time = parser.GetTime(); break; case Parser.RegKeywords.DayOfWeek: timeslot.DayOfWeek = parser.GetInt(); break; case Parser.RegKeywords.Limit: timeslot.Limit = parser.GetInt(); break; default: throw parser.GetException("unexpected line in TimeSlot"); } } return(timeslot); }
public static TimeSlot Parse(Parser parser, int startindent) { var timeslot = new TimeSlot(); if (parser.curr.kw != Parser.RegKeywords.None) throw parser.GetException("unexpected line in TimeSlots"); timeslot.Description = parser.GetLine(); if (parser.curr.indent <= startindent) return timeslot; var ind = parser.curr.indent; while (parser.curr.indent == ind) { switch (parser.curr.kw) { case Parser.RegKeywords.Time: timeslot.Time = parser.GetTime(); break; case Parser.RegKeywords.DayOfWeek: timeslot.DayOfWeek = parser.GetInt(); break; case Parser.RegKeywords.Limit: timeslot.Limit = parser.GetInt(); break; default: throw parser.GetException("unexpected line in TimeSlot"); } } return timeslot; }
public static OrgFee Parse(Parser parser, int startindent) { if (parser.curr.kw != Parser.RegKeywords.None) throw parser.GetException("expected orgid only"); var oid = parser.GetInt(); if (oid == 0) { parser.lineno--; throw parser.GetException("invalid orgid"); } var f = new OrgFee { OrgId = oid }; if (parser.curr.indent > startindent) { if (parser.curr.kw != Parser.RegKeywords.Fee) throw parser.GetException("expected fee"); f.Fee = parser.GetDecimal(); } return f; }