Beispiel #1
0
        public ActionResult Lookups(string id)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content($"<Lookups error=\"{ret.Substring(1)}\" />"));
            }
            if (!id.HasValue())
            {
                return(Content("Lookups error=\"not found\">"));
            }
            var q = DbUtil.Db.ExecuteQuery <LookupController.Row>("select * from lookup." + id);
            var w = new APIWriter();

            w.Start("Lookups");
            w.Attr("name", id);
            foreach (var i in q)
            {
                w.Start("Lookup");
                w.Attr("Id", i.Id);
                w.AddText(i.Description);
                w.End();
            }
            w.End();
            DbUtil.LogActivity("APIMeta Lookups");
            return(Content(w.ToString(), "text/xml"));
        }
Beispiel #2
0
        public void WriteXml(XmlWriter writer)
        {
            var w = new APIWriter(writer);

            writer.WriteComment(DateTime.Now.ToString());
            foreach (var pi in typeof(OnlineRegModel).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                     .Where(vv => vv.CanRead && vv.CanWrite))
            {
                switch (pi.Name)
                {
                case "List":
                    w.Start("List");
                    foreach (var i in list)
                    {
                        Util.Serialize(i, writer);
                    }
                    w.End();
                    break;

                case "History":
                    w.Start("History");
                    foreach (var i in History)
                    {
                        w.Add("item", i);
                    }
                    w.End();
                    break;

                case "password":
                    break;

                case "testing":
                    if (testing == true)
                    {
                        w.Add(pi.Name, testing);
                    }
                    break;

                case "prospect":
                    if (prospect)
                    {
                        w.Add(pi.Name, prospect);
                    }
                    break;

                default:
                    w.Add(pi.Name, pi.GetValue(this, null));
                    break;
                }
            }
        }
Beispiel #3
0
 public void WriteXml(APIWriter w)
 {
     w.Start("Size")
     .Add("Description", Description)
     .Add("SmallGroup", SmallGroup)
     .End();
 }
Beispiel #4
0
        public void WriteXml(XmlWriter writer)
        {
            var w = new APIWriter(writer);

            writer.WriteComment(DateTime.Now.ToString());
            foreach (PropertyInfo pi in typeof(OnlineRegModel).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                     .Where(vv => vv.CanRead && vv.CanWrite))
            {
                Debug.WriteLine(pi.Name);
                switch (pi.Name)
                {
                case "List":
                    w.Start("List");
                    foreach (var i in list)
                    {
                        Util.Serialize(i, writer);
                    }
                    w.End();
                    break;

                case "password":
                    break;

                default:
                    w.Add(pi.Name, pi.GetValue(this, null));
                    break;
                }
            }
        }
Beispiel #5
0
 public void WriteXml(APIWriter w)
 {
     w.Start("YesNoQuestion")
     .Add("Question", Question ?? "need a question here")
     .Add("SmallGroup", SmallGroup)
     .End();
 }
Beispiel #6
0
 public void WriteXml(APIWriter w)
 {
     w.Start("GradeOption")
     .Attr("Code", Code)
     .AddText(Description)
     .End();
 }
Beispiel #7
0
 public void WriteXml(APIWriter w)
 {
     w.Start("OrganizationDocument")
     .Add("DocumentName", DocumentName ?? "document name here")
     .Add("Required", Required == true ? "true" : "false")
     .End();
 }
Beispiel #8
0
        public ActionResult SQLView(string id)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content($"<SQLView error=\"{ret.Substring(1)}\" />"));
            }

            if (!id.HasValue())
            {
                return(Content("<SQLView error\"no view name\" />"));
            }

            try
            {
                var cmd = new SqlCommand("select * from guest." + id.Replace(" ", ""));
                cmd.Connection = new SqlConnection(Util.ConnectionString);
                cmd.Connection.Open();
                var rdr = cmd.ExecuteReader();
                DbUtil.LogActivity("APIMeta SQLView " + id);
                var w = new APIWriter();
                w.Start("SQLView");
                w.Attr("name", id);

                var read = rdr.Read();
                while (read)
                {
                    w.Start("row");
                    for (var i = 0; i < rdr.FieldCount; i++)
                    {
                        w.Attr(rdr.GetName(i), rdr[i].ToString());
                    }

                    w.End();
                    read = rdr.Read();
                }
                w.End();
                return(Content(w.ToString(), "text/xml"));
            }
            catch (Exception)
            {
                return(Content($"<SQLView error=\"cannot find view guest.{id}\" />"));
            }
        }
Beispiel #9
0
 public void WriteXml(APIWriter w)
 {
     w.Start("CheckboxItem")
     .Attr("Fee", Fee)
     .Attr("Limit", Limit)
     .Attr("Time", MeetingTime.ToString2("s"))
     .Add("Description", Description)
     .Add("SmallGroup", SmallGroup.trim())
     .End();
 }
Beispiel #10
0
 private void WriteDocumentsUpload(APIWriter w)
 {
     if (OrganizationDocument != null && OrganizationDocument.Count > 0)
     {
         foreach (var q in OrganizationDocument)
         {
             w.Start("Documents");
             w.Attr("documentName", q.Key);
             w.AddText(q.Value.ToString());
             w.End();
         }
     }
 }
 private void WriteFundItems(APIWriter w)
 {
     if (FundItem != null && FundItem.Count > 0)
     {
         foreach (var f in FundItem.Where(ff => ff.Value > 0))
         {
             w.Start("FundItem");
             w.Attr("fund", f.Key);
             w.AddText(f.Value.Value.ToString());
             w.End();
         }
     }
 }
Beispiel #12
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type);
     foreach (var q in list)
     {
         q.WriteXml(w);
     }
     w.End();
 }
Beispiel #13
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type);
     foreach (var q in list)
     {
         w.Add("Question", q.Question);
     }
     w.End();
 }
Beispiel #14
0
 private void WriteSpecialTest(APIWriter w)
 {
     if (SpecialTest != null)
     {
         foreach (var d in SpecialTest)
         {
             w.Start("SpecialTest");
             w.Attr("key", d.Key);
             w.AddText(d.Value);
             w.End();
         }
     }
 }
 private void WriteYesNoChoices(APIWriter w)
 {
     if (YesNoQuestion != null && YesNoQuestion.Count > 0)
     {
         foreach (var q in YesNoQuestion)
         {
             w.Start("YesNoQuestion");
             w.Attr("question", q.Key);
             w.AddText(q.Value.ToString());
             w.End();
         }
     }
 }
Beispiel #16
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type)
     .AttrIfTrue("TargetExtraValue", TargetExtraValue);
     foreach (var q in list)
     {
         q.WriteXml(w);
     }
     w.End();
 }
Beispiel #17
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type);
     w.Add("Label", Label);
     foreach (var g in list)
     {
         g.WriteXml(w);
     }
     w.End();
 }
Beispiel #18
0
 public void WriteXml(APIWriter w)
 {
     w.StartPending("TimeSlots");
     w.Attr("LockDays", TimeSlotLockDays);
     foreach (var c in list)
     {
         w.Start("Slot")
         .Attr("Time", c.Time.ToString2("t"))
         .Attr("DayOfWeek", c.DayOfWeek)
         .Attr("Limit", c.Limit)
         .AddText(c.Description)
         .End();
     }
     w.EndPending();
 }
Beispiel #19
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type)
     .Attr("Fee", Fee)
     .Attr("AllowLastYear", AllowLastYear)
     .Add("Label", Label ?? "Size");
     foreach (var g in list)
     {
         g.WriteXml(w);
     }
     w.End();
 }
Beispiel #20
0
 private void WriteFamilyAttend(APIWriter w)
 {
     if (FamilyAttend != null && FamilyAttend.Count > 0)
     {
         foreach (var f in FamilyAttend)
         {
             w.Start("FamilyAttend");
             w.Attr("PeopleId", f.PeopleId);
             w.Attr("Name", f.Name);
             w.Attr("Attend", f.Attend);
             w.Attr("Birthday", f.Birthday);
             w.Attr("GenderId", f.GenderId);
             w.Attr("MaritalId", f.MaritalId);
             w.End();
         }
     }
 }
        public string WriteXml()
        {
            var optionsAdded   = false;
            var checkoxesAdded = false;
            var w = new APIWriter();

            w.Start("OnlineRegPersonModel");

            foreach (PropertyInfo pi in typeof(OnlineRegPersonModel0).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                     .Where(vv => vv.CanRead && vv.CanWrite))
            {
                switch (pi.Name)
                {
                case "ExtraQuestion":
                    WriteExtraAnswers(w);
                    break;

                case "Text":
                    WriteText(w);
                    break;

                case "YesNoQuestion":
                    WriteYesNoChoices(w);
                    break;

                case "option":
                    optionsAdded = WriteDropdownOptions(optionsAdded, w);
                    break;

                case "Checkbox":
                    checkoxesAdded = WriteCheckboxChoices(checkoxesAdded, w);
                    break;

                case "MenuItem":
                    WriteMenuChoices(w);
                    break;

                default:
                    w.Add(pi.Name, pi.GetValue(this, null));
                    break;
                }
            }
            w.End();
            return(w.ToString());
        }
Beispiel #22
0
        public string Export(int id, string name)
        {
            var clause = Db.LoadQueryById(id);
            var w      = new APIWriter();

            w.Start("Search");
            w.Attr("Description", name);

            //var settings = new XmlWriterSettings();
            //settings.Encoding = new System.Text.UTF8Encoding(false);
            //using (w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            //{
            //    w.WriteStartElement("Search");
            //    WriteClause(clause);
            //    w.WriteEndElement();
            //}
            return("");
        }
Beispiel #23
0
 public override void WriteXml(APIWriter w)
 {
     if (list.Count == 0)
     {
         return;
     }
     w.Start(Type)
     .Attr("Minimum", Minimum)
     .Attr("Maximum", Maximum)
     .Attr("Columns", Columns == 1 ? null : Columns)
     .AddCdata("Label", Label);
     foreach (var i in list)
     {
         i.WriteXml(w);
     }
     // todo: prevent duplicates
     w.End();
 }
 private void WriteExtraAnswers(APIWriter w)
 {
     if (ExtraQuestion != null)
     {
         for (var i = 0; i < ExtraQuestion.Count; i++)
         {
             if (ExtraQuestion[i] != null && ExtraQuestion[i].Count > 0)
             {
                 foreach (var q in ExtraQuestion[i])
                 {
                     w.Start("ExtraQuestion");
                     w.Attr("set", i);
                     w.Attr("question", q.Key);
                     w.AddText(q.Value);
                     w.End();
                 }
             }
         }
     }
 }
 private void WriteText(APIWriter w)
 {
     if (Text != null)
     {
         for (var i = 0; i < Text.Count; i++)
         {
             if (Text[i] != null && Text[i].Count > 0)
             {
                 foreach (var q in Text[i])
                 {
                     w.Start("Text");
                     w.Attr("set", i);
                     w.Attr("question", q.Key);
                     w.AddText(q.Value);
                     w.End();
                 }
             }
         }
     }
 }
 private void WriteMenuChoices(APIWriter w)
 {
     if (MenuItem != null)
     {
         for (var i = 0; i < MenuItem.Count; i++)
         {
             if (MenuItem[i] != null && MenuItem[i].Count > 0)
             {
                 foreach (var q in MenuItem[i])
                 {
                     w.Start("MenuItem");
                     w.Attr("set", i);
                     w.Attr("name", q.Key);
                     w.Attr("number", q.Value);
                     w.End();
                 }
             }
         }
     }
 }
Beispiel #27
0
        public void WriteXmlMessages(XmlWriter writer, Messages messages)
        {
            var w = new APIWriter(writer);

            w.Start("Messages");
            w.Attr("id", OrgId);
            w.AddComment($"{Util.UserPeopleId} {Util.Now:g}");

            if (messages.Confirmation)
            {
                w.Start("Confirmation")
                .Add("Subject", Subject)
                .AddCdata("Body", Body)
                .End();
            }

            if (messages.Reminder)
            {
                w.Start("Reminder")
                .Add("Subject", ReminderSubject)
                .AddCdata("Body", ReminderBody)
                .End();
            }

            if (messages.Support)
            {
                w.Start("SupportEmail")
                .Add("Subject", SupportSubject)
                .AddCdata("Body", SupportBody)
                .End();
            }

            if (messages.Support)
            {
                w.Start("SenderEmail")
                .Add("Subject", SenderSubject)
                .AddCdata("Body", SenderBody)
                .End();
            }

            w.StartPending("Instructions");
            if (messages.Login)
            {
                w.AddCdata("Login", InstructionLogin);
            }
            if (messages.Select)
            {
                w.AddCdata("Select", InstructionSelect);
            }
            if (messages.Find)
            {
                w.AddCdata("Find", InstructionFind);
            }
            if (messages.Options)
            {
                w.AddCdata("Options", InstructionOptions);
            }
            if (messages.Special)
            {
                w.AddCdata("Special", InstructionSpecial);
            }
            if (messages.Submit)
            {
                w.AddCdata("Submit", InstructionSubmit);
            }
            if (messages.Sorry)
            {
                w.AddCdata("Sorry", InstructionSorry);
            }
            w.EndPending();

            w.End();
        }
Beispiel #28
0
        public void WriteXml(XmlWriter writer)
        {
            var w = new APIWriter(writer);

            w.Attr("id", OrgId);
            w.AddComment($"{Util.UserPeopleId} {Util.Now:g}");

            w.StartPending("Confirmation")
            .Add("Subject", Subject)
            .AddCdata("Body", Body)
            .EndPending();

            w.StartPending("Reminder")
            .Add("Subject", ReminderSubject)
            .AddCdata("Body", ReminderBody)
            .EndPending();

            w.StartPending("SupportEmail")
            .Add("Subject", SupportSubject)
            .AddCdata("Body", SupportBody)
            .EndPending();

            w.StartPending("SenderEmail")
            .Add("Subject", SenderSubject)
            .AddCdata("Body", SenderBody)
            .EndPending();

            w.StartPending("Fees")
            .Add("Fee", Fee)
            .Add("Deposit", Deposit)
            .Add("ExtraFee", ExtraFee)
            .Add("MaximumFee", MaximumFee)
            .Add("ExtraValueFeeName", ExtraValueFeeName)
            .Add("AccountingCode", AccountingCode)
            .Add("PushpayFundName", PushpayFundName)
            .AddIfTrue("ApplyMaxToOtherFees", ApplyMaxToOtherFees)
            .AddIfTrue("IncludeOtherFeesWithDeposit", IncludeOtherFeesWithDeposit)
            .AddIfTrue("OtherFeesAddedToOrgFee", OtherFeesAddedToOrgFee)
            .AddIfTrue("AskDonation", AskDonation)
            .Add("DonationLabel", DonationLabel)
            .Add("DonationFundId", DonationFundId)
            .EndPending();


            w.StartPending("OrgFees");
            foreach (var i in OrgFees)
            {
                w.Start("Fee")
                .Attr("OrgId", i.OrgId)
                .Attr("Fee", i.Fee)
                .End();
            }
            w.EndPending();


            w.StartPending("AgeGroups");
            foreach (var i in AgeGroups)
            {
                w.Start("Group")
                .Attr("StartAge", i.StartAge)
                .Attr("EndAge", i.EndAge)
                .Attr("Fee", i.Fee)
                .AddText(i.SmallGroup)
                .End();
            }
            w.EndPending();

            w.StartPending("Instructions")
            .AddCdata("Login", InstructionLogin)
            .AddCdata("Select", InstructionSelect)
            .AddCdata("Find", InstructionFind)
            .AddCdata("Options", InstructionOptions)
            .AddCdata("Special", InstructionSpecial)
            .AddCdata("Submit", InstructionSubmit)
            .AddCdata("Sorry", InstructionSorry)
            .AddCdata("Thanks", ThankYouMessage)
            .AddCdata("Terms", Terms)
            .EndPending();

            w.StartPending("Options")
            .AddCdata("ConfirmationTrackingCode", ConfirmationTrackingCode)
            .Add("ValidateOrgs", ValidateOrgs)
            .Add("Shell", Shell)
            .Add("ShellBs", ShellBs)
            .Add("FinishRegistrationButton", FinishRegistrationButton)
            .Add("SpecialScript", SpecialScript)
            .Add("OnEnrollScript", OnEnrollScript)
            .Add("GroupToJoin", GroupToJoin)
            .Add("TimeOut", TimeOut)
            .AddIfTrue("AllowOnlyOne", AllowOnlyOne)
            .AddIfTrue("TargetExtraValues", TargetExtraValues)
            .AddIfTrue("AllowReRegister", AllowReRegister)
            .AddIfTrue("AllowSaveProgress", AllowSaveProgress)
            .AddIfTrue("MemberOnly", MemberOnly)
            .AddIfTrue("AddAsProspect", AddAsProspect)
            .AddIfTrue("DisallowAnonymous", DisallowAnonymous)
            .EndPending();

            w.StartPending("NotRequired")
            .AddIfTrue("NoReqBirthYear", NoReqBirthYear)
            .AddIfTrue("NotReqDOB", NotReqDOB)
            .AddIfTrue("NotReqAddr", NotReqAddr)
            .AddIfTrue("NotReqZip", NotReqZip)
            .AddIfTrue("NotReqPhone", NotReqPhone)
            .AddIfTrue("NotReqGender", NotReqGender)
            .AddIfTrue("NotReqMarital", NotReqMarital)
            .AddIfTrue("NotReqCampus", NotReqCampus)
            .AddIfTrue("ShowDOBOnFind", ShowDOBOnFind)
            .AddIfTrue("ShowPhoneOnFind", ShowPhoneOnFind)
            .EndPending();

            TimeSlots?.WriteXml(w);

            w.StartPending("AskItems");
            foreach (var a in AskItems)
            {
                a.WriteXml(w);
            }
            w.EndPending();
        }
Beispiel #29
0
        public XDocument StandardColumns(bool includeRoot = true)
        {
            var doc = new XDocument();

            using (var writer = doc.CreateWriter())
            {
                var w = new APIWriter(writer);
                if (includeRoot)
                {
                    w.Start("CustomReports");
                }

                w.Start("Report").Attr("name", "YourReportNameGoesHere");
                if (orgid.HasValue)
                {
                    w.Attr("showOnOrgId", orgid);
                }

                foreach (var c in mc.Columns.Values)
                {
                    w.Start("Column").Attr("name", c.Column).End();
                }

                var protectedevs = from value in Views.GetStandardExtraValues(db, "People")
                                   where value.VisibilityRoles.HasValue()
                                   select value.Name;

                var standards = (from value in Views.GetStandardExtraValues(db, "People")
                                 select value.Name).ToList();

                var extravalues = from ev in db.PeopleExtras
                                  where !protectedevs.Contains(ev.Field)
                                  where (ev.UseAllValues ?? false) == false
                                  group ev by new { ev.Field, ev.Type }
                into g
                orderby g.Key.Field
                select g.Key;

                var familyextravalues = from fe in db.FamilyExtras
                                        where (fe.UseAllValues ?? false) == false
                                        group fe by new { fe.Field, fe.Type }
                into fv
                orderby fv.Key.Field
                select fv.Key;

                foreach (var ev in extravalues)
                {
                    if (!Regex.IsMatch(ev.Type, @"Code|Date|Text|Int|Bit"))
                    {
                        continue;
                    }

                    w.Start("Column");
                    w.Attr("field", ev.Field).Attr("name", "ExtraValue" + ev.Type);
                    if (!standards.Contains(ev.Field))
                    {
                        w.Attr("disabled", "true");
                    }

                    w.End();
                }
                foreach (var fe in familyextravalues)
                {
                    if (!Regex.IsMatch(fe.Type, @"Code|Date|Text|Int|Bit"))
                    {
                        continue;
                    }

                    w.Start("Column");
                    w.Attr("field", fe.Field).Attr("name", "FamilyExtraValue" + fe.Type);

                    w.End();
                }
                var statusflags = from f in db.ViewStatusFlagLists
                                  where f.RoleName == null
                                  orderby f.Name
                                  select f;
                foreach (var f in statusflags)
                {
                    w.Start("Column")
                    .Attr("description", f.Name)
                    .Attr("flag", f.Flag)
                    .Attr("name", "StatusFlag")
                    .End();
                }
                if (orgid.HasValue)
                {
                    var specialcols = from c in mc.SpecialColumns.Values
                                      where c.Context == "org"
                                      where c.Column != "SmallGroup"
                                      select c;
                    foreach (var c in specialcols)
                    {
                        w.Start("Column")
                        .Attr("name", c.Column)
                        .Attr("orgid", orgid)
                        .End();
                    }

                    var smallgroups = from sg in db.MemberTags
                                      where sg.OrgId == orgid
                                      orderby sg.Name
                                      select sg;
                    foreach (var sg in smallgroups)
                    {
                        w.Start("Column")
                        .Attr("smallgroup", sg.Name)
                        .Attr("orgid", orgid)
                        .Attr("name", "SmallGroup")
                        .End();
                    }
                }
                w.End();
                if (includeRoot)
                {
                    w.End();
                }
            }
            return(doc);
        }
Beispiel #30
0
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings()
            {
                Encoding = new System.Text.UTF8Encoding(false), Indent = true
            };

            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                var x = new APIWriter(w);
                x.NoDefaults = true;
                x.Start("Attendees");
                var m = new CheckInModel();
                List <CheckinFamilyMember> q;
                if (CheckInModel.UseOldCheckin())
                {
                    q = m.FamilyMembersOld(fid, campus, thisday);
                }
                else
                {
                    q = m.FamilyMembers(fid, campus, thisday);
                }

                x.Attr("familyid", fid);
                x.Attr("waslocked", waslocked);

                var count = q.Count();

                if (page > 0)
                {
                    const int INT_PageSize = 10;
                    var       startrow     = (page - 1) * INT_PageSize;
                    if (count > startrow + INT_PageSize)
                    {
                        x.Attr("next", (page + 1));
                    }
                    else
                    {
                        x.Attr("next", "");
                    }
                    if (page > 1)
                    {
                        x.Attr("prev", (page - 1));
                    }
                    else
                    {
                        x.Attr("prev", "");
                    }
                    q = q.Skip(startrow).Take(INT_PageSize).ToList();
                }
                x.Attr("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));

                // TODO: Consider the option to numbers only. Per Braden Kok @ Granite Springs
                var code = DbUtil.Db.NextSecurityCode().Select(c => c.Code).Single();
                x.Attr("securitycode", code);

                var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

                foreach (var c in q)
                {
                    var parents = "";

                    if (c.Position == 30)
                    {
                        var child = (from e in DbUtil.Db.People
                                     where e.PeopleId == c.Id
                                     select e).SingleOrDefault();

                        if (child.Family.HeadOfHouseholdId != null)
                        {
                            parents = child.Family.HeadOfHousehold.FirstName;

                            if (child.Family.HeadOfHouseholdSpouseId != null)
                            {
                                parents += " & " + child.Family.HeadOfHouseholdSpouse.FirstName;
                            }
                        }
                        else if (child.Family.HeadOfHouseholdSpouseId != null)
                        {
                            parents = child.Family.HeadOfHouseholdSpouse.FirstName;
                        }
                    }

                    double hoursBeforeClassStarts = 0;
                    if (c.Hour.HasValue)
                    {
                        var midnight = c.Hour.Value.Date;
                        var now      = midnight.Add(Util.Now.TimeOfDay);
                        hoursBeforeClassStarts = c.Hour.Value.Subtract(now).TotalHours;
                        // TZOffset will be positive to the east, negative to the west
                        // but we are trying to get to central time so we subtract
                        // if tzoffset is +1 then we need to -1 to go to CentralTime.
                        hoursBeforeClassStarts -= DbUtil.Db.Setting("TZOffset", "0").ToInt();
                        // now we need to make sure we are within 24 hours (ignore the date change)
                        hoursBeforeClassStarts %= 24;
                    }
                    x.Start("attendee");
                    x.Attr("id", c.Id.ToString());
                    x.Attr("mv", c.MemberVisitor);
                    x.Attr("name", c.DisplayName);
                    x.Attr("preferredname", c.PreferredName);
                    x.Attr("first", accommodateCheckInBug ? c.PreferredName : c.First);
                    x.Attr("last", c.Last);
                    x.Attr("org", c.DisplayClass);
                    x.Attr("orgname", c.OrgName);
                    x.Attr("leader", c.Leader);
                    x.Attr("orgid", c.OrgId.ToString());
                    x.Attr("loc", c.Location);
                    x.Attr("gender", c.Genderid);
                    x.Attr("leadtime", hoursBeforeClassStarts.ToString());
                    x.Attr("age", Person.AgeDisplay(c.Age, c.Id).ToString());
                    x.Attr("numlabels", c.NumLabels.ToString());
                    x.Attr("checkedin", c.CheckedIn.ToString());
                    x.Attr("custody", c.Custody.ToString());
                    x.Attr("transport", c.Transport.ToString());
                    x.Attr("hour", c.Hour.FormatDateTm());
                    x.Attr("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
                    x.Attr("church", c.Church);

                    x.Attr("email", c.Email);
                    x.Attr("dob", c.dob);
                    x.Attr("goesby", c.Goesby);
                    x.Attr("addr", c.Addr);
                    x.Attr("zip", c.Zip);
                    x.Attr("home", c.Home);
                    x.Attr("cell", c.Cell);
                    x.Attr("marital", c.Marital.ToString());
                    x.Attr("allergies", c.Allergies);
                    x.Attr("grade", c.Grade.ToString());
                    x.Attr("parent", c.Parent);
                    x.Attr("emfriend", c.Emfriend);
                    x.Attr("emphone", c.Emphone);
                    x.Attr("activeother", c.Activeother.ToString());
                    x.Attr("haspicture", c.HasPicture.ToString());

                    x.Attr("parents", parents);

                    x.End();
                }
                x.End();
            }
        }