Esempio n. 1
0
        public bool Attended(int id)
        {
            var a = FamilyAttend?.SingleOrDefault(aa => aa.PeopleId == id);

            if (a == null)
            {
                return(false);
            }
            return(a.Attend);
        }
Esempio n. 2
0
        private string SummarizeFamilyAttendance()
        {
            var sb1 = new StringBuilder();

            sb1.Append("<table>");
            sb1.AppendFormat("<tr><td width='50%'>Org:</td><td width='50%'>{0}</td></tr>\n", org.OrganizationName);
            sb1.AppendFormat("<tr><td>First:</td><td>{0}</td></tr>\n", person.PreferredName);
            sb1.AppendFormat("<tr><td>Last:</td><td>{0}</td></tr>\n", person.LastName);
            var sb = sb1;

            foreach (var m in FamilyAttend.Where(m => m.Attend))
            {
                if (m.PeopleId != null)
                {
                    sb.Append($"<tr><td colspan=\"2\">{m.Name}{(m.Age.HasValue ? $" ({Person.AgeDisplay(m.Age, m.PeopleId)})" : "")}</td></tr>\n");
                }
                else
                {
                    sb.Append($"<tr><td colspan=\"2\">{m.Name}{(m.Age.HasValue ? $" ({Person.AgeDisplay(m.Age, m.PeopleId)})" : "")}");
                    if (m.Email.HasValue())
                    {
                        sb.Append($", {m.Email}");
                    }

                    if (m.Birthday.HasValue())
                    {
                        sb.Append($", {m.Birthday}");
                    }

                    if (m.MaritalId.HasValue)
                    {
                        sb.Append($", {m.Marital}");
                    }

                    if (m.GenderId.HasValue)
                    {
                        sb.Append($", {m.Gender}");
                    }

                    sb.Append("</td></tr>\n");
                }
            }

            sb.AppendLine("</table>");
            return(sb.ToString());
        }
Esempio n. 3
0
        private void ReadFamilyAttend(XElement e)
        {
            var fa = new FamilyAttendInfo();

            fa.PeopleId  = GetAttr(e, "PeopleId").ToInt2();
            fa.Attend    = GetAttr(e, "Attend").ToBool();
            fa.Name      = GetAttr(e, "Name");
            fa.Birthday  = GetAttr(e, "Birthday");
            fa.Email     = GetAttr(e, "Email");
            fa.MaritalId = GetAttr(e, "MaritalId").ToInt2();
            fa.GenderId  = GetAttr(e, "GenderId").ToInt2();
            if (FamilyAttend == null)
            {
                FamilyAttend = new List <FamilyAttendInfo>();
            }
            FamilyAttend.Add(fa);
        }
Esempio n. 4
0
        public void ReadXml(XmlReader reader)
        {
            var s = reader.ReadOuterXml();
            var x = XDocument.Parse(s);

            if (x.Root == null)
            {
                return;
            }

            var eqset   = 0;
            var menuset = 0;

            foreach (var e in x.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                case "FundItem":
                    if (FundItem == null)
                    {
                        FundItem = new Dictionary <int, decimal?>();
                    }
                    var fu = e.Attribute("fund");
                    if (fu != null)
                    {
                        FundItem.Add(fu.Value.ToInt(), e.Value.ToDecimal());
                    }
                    break;

                case "FamilyAttend":
                    var fa = new FamilyAttendInfo();
                    fa.PeopleId  = GetAttr(e, "PeopleId").ToInt2();
                    fa.Attend    = GetAttr(e, "Attend").ToBool();
                    fa.Name      = GetAttr(e, "Name");
                    fa.Birthday  = GetAttr(e, "Birthday");
                    fa.Email     = GetAttr(e, "Email");
                    fa.MaritalId = GetAttr(e, "MaritalId").ToInt2();
                    fa.GenderId  = GetAttr(e, "GenderId").ToInt2();
                    if (FamilyAttend == null)
                    {
                        FamilyAttend = new List <FamilyAttendInfo>();
                    }
                    FamilyAttend.Add(fa);
                    break;

                case "ExtraQuestion":
                    if (ExtraQuestion == null)
                    {
                        ExtraQuestion = new List <Dictionary <string, string> >();
                    }
                    var eqsetattr = e.Attribute("set");
                    if (eqsetattr != null)
                    {
                        eqset = eqsetattr.Value.ToInt();
                    }
                    if (ExtraQuestion.Count == eqset)
                    {
                        ExtraQuestion.Add(new Dictionary <string, string>());
                    }
                    var eq = e.Attribute("question");
                    if (eq != null)
                    {
                        ExtraQuestion[eqset].Add(eq.Value, e.Value);
                    }
                    break;

                case "YesNoQuestion":
                    if (YesNoQuestion == null)
                    {
                        YesNoQuestion = new Dictionary <string, bool?>();
                    }
                    var ynq = e.Attribute("question");
                    if (ynq != null)
                    {
                        YesNoQuestion.Add(ynq.Value, e.Value.ToBool());
                    }
                    break;

                case "option":
                    if (option == null)
                    {
                        option = new List <string>();
                    }
                    option.Add(e.Value);
                    break;

                case "Checkbox":
                    if (Checkbox == null)
                    {
                        Checkbox = new List <string>();
                    }
                    Checkbox.Add(e.Value);
                    break;

                case "MenuItem":
                    if (MenuItem == null)
                    {
                        MenuItem = new List <Dictionary <string, int?> >();
                    }
                    var menusetattr = e.Attribute("set");
                    if (menusetattr != null)
                    {
                        menuset = menusetattr.Value.ToInt();
                    }
                    if (MenuItem.Count == menuset)
                    {
                        MenuItem.Add(new Dictionary <string, int?>());
                    }
                    var aname  = e.Attribute("name");
                    var number = e.Attribute("number");
                    if (aname != null && number != null)
                    {
                        MenuItem[menuset].Add(aname.Value, number.Value.ToInt());
                    }
                    break;

                case "MissionTripPray":
                    MissionTripPray = e.Value.ToBool();
                    break;

                case "MissionTripGoerId":
                    MissionTripGoerId = e.Value.ToInt();
                    break;

                case "CreatingAccount":
                    CreatingAccount = e.Value.ToBool();
                    break;

                default:
                    Util.SetPropertyFromText(this, TranslateName(name), e.Value);
                    break;
                }
            }
        }
Esempio n. 5
0
        public string PrepareSummaryText(Transaction ti)
        {
            var om = GetOrgMember();
            var sb = new StringBuilder();

            sb.Append("<table>");
            sb.AppendFormat("<tr><td width='50%'>Org:</td><td width='50%'>{0}</td></tr>\n", org.OrganizationName);
            sb.AppendFormat("<tr><td>First:</td><td>{0}</td></tr>\n", person.PreferredName);
            sb.AppendFormat("<tr><td>Last:</td><td>{0}</td></tr>\n", person.LastName);

            if (ti.Amt > 0 && om != null)
            {
                //var omemb = new OrgMemberModel(om.OrganizationId, om.PeopleId);
                var ts = om.TransactionSummary(DbUtil.Db);
                if (ts != null)
                {
                    sb.AppendFormat(@"
<tr><td colspan='2'> 
<table cellpadding=4>
    <tr>
        <td>Registrant Fee</td>
        <td>Amount Paid</td>
        <td>Amount Due</td>
    </tr>
    <tr>
        <td align='right'>{0}</td>
        <td align='right'>{1}</td>
        <td align='right'>{2}</td>
    </tr>
</table>
</td></tr>
    ", ts.IndAmt.ToString2("c"),
                                    om.TotalPaid(DbUtil.Db).ToString("c"),
                                    om.AmountDue(DbUtil.Db).ToString("c"));
                }
            }

            if (Parent.SupportMissionTrip)
            {
                var goer = DbUtil.Db.LoadPersonById(MissionTripGoerId ?? 0);
                if (goer != null)
                {
                    sb.AppendFormat("<tr><td>Support Mission Trip for:</td><td>{0}</td></tr>\n", goer.Name);
                }
                if (MissionTripSupportGeneral > 0)
                {
                    sb.Append("<tr><td>Support Mission Trip:</td><td>Any other participiants</td></tr>\n");
                }
            }
            else if (RecordFamilyAttendance())
            {
                foreach (var m in FamilyAttend.Where(m => m.Attend))
                {
                    if (m.PeopleId != null)
                    {
                        sb.Append("<tr><td colspan=\"2\">{0}{1}</td></tr>\n"
                                  .Fmt(m.Name, (m.Age.HasValue ? " ({0})".Fmt(m.Age) : "")));
                    }
                    else
                    {
                        sb.Append("<tr><td colspan=\"2\">{0}{1}".Fmt(m.Name, (m.Age.HasValue ? " ({0})".Fmt(m.Age) : "")));
                        if (m.Email.HasValue())
                        {
                            sb.Append(", {0}".Fmt(m.Email));
                        }
                        if (m.Birthday.HasValue())
                        {
                            sb.Append(", {0}".Fmt(m.Birthday));
                        }
                        if (m.MaritalId.HasValue)
                        {
                            sb.Append(", {0}".Fmt(m.Marital));
                        }
                        if (m.GenderId.HasValue)
                        {
                            sb.Append(", {0}".Fmt(m.Gender));
                        }
                        sb.Append("</td></tr>\n");
                    }
                }
            }
            else
            {
                var rr = person.RecRegs.Single();

                foreach (var ask in setting.AskItems)
                {
                    switch (ask.Type)
                    {
                    case "AskTickets":
                        sb.AppendFormat("<tr><td>Tickets:</td><td>{0}</td></tr>\n", om.Tickets);
                        break;

                    case "AskSize":
                        sb.AppendFormat("<tr><td>Shirt:</td><td>{0}</td></tr>\n", om.ShirtSize);
                        break;

                    case "AskEmContact":
                        sb.AppendFormat("<tr><td>Emerg Contact:</td><td>{0}</td></tr>\n", rr.Emcontact);
                        sb.AppendFormat("<tr><td>Emerg Phone:</td><td>{0}</td></tr>\n", rr.Emphone);
                        break;

                    case "AskDoctor":
                        sb.AppendFormat("<tr><td>Physician Name:</td><td>{0}</td></tr>\n", rr.Doctor);
                        sb.AppendFormat("<tr><td>Physician Phone:</td><td>{0}</td></tr>\n", rr.Docphone);
                        break;

                    case "AskInsurance":
                        sb.AppendFormat("<tr><td>Insurance Carrier:</td><td>{0}</td></tr>\n", rr.Insurance);
                        sb.AppendFormat("<tr><td>Insurance Policy:</td><td>{0}</td></tr>\n", rr.Policy);
                        break;

                    case "AskRequest":
                        sb.AppendFormat("<tr><td>{1}:</td><td>{0}</td></tr>\n", om.Request, ((AskRequest)ask).Label);
                        break;

                    case "AskHeader":
                        sb.AppendFormat("<tr><td colspan='2'><h4>{0}</h4></td></tr>\n", ((AskHeader)ask).Label);
                        break;

                    case "AskInstruction":
                        break;

                    case "AskAllergies":
                        sb.AppendFormat("<tr><td>Medical:</td><td>{0}</td></tr>\n", rr.MedicalDescription);
                        break;

                    case "AskTylenolEtc":
                        sb.AppendFormat("<tr><td>Tylenol?: {0},", tylenol == true ? "Yes" : tylenol == false ? "No" : "");
                        sb.AppendFormat(" Advil?: {0},", advil == true ? "Yes" : advil == false ? "No" : "");
                        sb.AppendFormat(" Robitussin?: {0},", robitussin == true ? "Yes" : robitussin == false ? "No" : "");
                        sb.AppendFormat(" Maalox?: {0}</td></tr>\n", maalox == true ? "Yes" : maalox == false ? "No" : "");
                        break;

                    case "AskChurch":
                        sb.AppendFormat("<tr><td>Member:</td><td>{0}</td></tr>\n", rr.Member);
                        sb.AppendFormat("<tr><td>OtherChurch:</td><td>{0}</td></tr>\n", rr.ActiveInAnotherChurch);
                        break;

                    case "AskParents":
                        sb.AppendFormat("<tr><td>Mother's name:</td><td>{0}</td></tr>\n", rr.Mname);
                        sb.AppendFormat("<tr><td>Father's name:</td><td>{0}</td></tr>\n", rr.Fname);
                        break;

                    case "AskCoaching":
                        sb.AppendFormat("<tr><td>Coaching:</td><td>{0}</td></tr>\n", rr.Coaching);
                        break;

                    case "AskSMS":
                        sb.AppendFormat("<tr><td>Receive Texts:</td><td>{0}</td></tr>\n", person.ReceiveSMS);
                        break;

                    case "AskDropdown":
                        sb.AppendFormat("<tr><td>{1}:</td><td>{0}</td></tr>\n", ((AskDropdown)ask).SmallGroupChoice(option).Description,
                                        Util.PickFirst(((AskDropdown)ask).Label, "Options"));
                        break;

                    case "AskMenu":
                    {
                        var menulabel = ((AskMenu)ask).Label;
                        foreach (var i in ((AskMenu)ask).MenuItemsChosen(MenuItem[ask.UniqueId]))
                        {
                            string row;
                            if (i.amt > 0)
                            {
                                row = "<tr><td>{0}</td><td>{1} {2} (at {3:N2})</td></tr>\n".Fmt(menulabel, i.number, i.desc, i.amt);
                            }
                            else
                            {
                                row = "<tr><td>{0}</td><td>{1} {2}</td></tr>\n".Fmt(menulabel, i.number, i.desc);
                            }
                            sb.AppendFormat(row);
                            menulabel = string.Empty;
                        }
                    }
                    break;

                    case "AskCheckboxes":
                    {
                        var askcb     = (AskCheckboxes)ask;
                        var menulabel = askcb.Label;
                        foreach (var i in askcb.CheckboxItemsChosen(Checkbox))
                        {
                            string row;
                            if (menulabel.HasValue())
                            {
                                sb.Append("<tr><td colspan='2'><br>{0}</td></tr>\n".Fmt(menulabel));
                            }
                            if (i.Fee > 0)
                            {
                                row = "<tr><td></td><td>{0} (${1:N2})<br>({2})</td></tr>\n".Fmt(i.Description, i.Fee, i.SmallGroup);
                            }
                            else
                            {
                                row = "<tr><td></td><td>{0}<br>({1})</td></tr>\n".Fmt(i.Description, i.SmallGroup);
                            }
                            sb.Append(row);
                            menulabel = string.Empty;
                        }
                    }
                    break;

                    case "AskYesNoQuestions":
                        foreach (var a in ((AskYesNoQuestions)ask).list)
                        {
                            if (YesNoQuestion.ContainsKey(a.SmallGroup))
                            {
                                sb.AppendFormat("<tr><td>{0}:</td><td>{1}</td></tr>\n".Fmt(a.Question,
                                                                                           YesNoQuestion[a.SmallGroup] == true ? "Yes" : "No"));
                            }
                        }
                        break;

                    case "AskExtraQuestions":
                        foreach (var a in ExtraQuestion[ask.UniqueId])
                        {
                            if (a.Value.HasValue())
                            {
                                sb.AppendFormat("<tr><td>{0}:</td><td>{1}</td></tr>\n".Fmt(a.Key, a.Value));
                            }
                        }
                        break;

                    case "AskText":
                        foreach (var a in Text[ask.UniqueId])
                        {
                            if (a.Value.HasValue())
                            {
                                sb.AppendFormat("<tr><td>{0}:</td><td>{1}</td></tr>\n".Fmt(a.Key, a.Value));
                            }
                        }
                        break;

                    case "AskGradeOptions":
                        sb.AppendFormat("<tr><td>GradeOption:</td><td>{0}</td></tr>\n",
                                        GradeOptions(ask).SingleOrDefault(s => s.Value == (gradeoption ?? "00")).Text);
                        break;
                    }
                }
                if (setting.AgeGroups.Count > 0)
                {
                    sb.AppendFormat("<tr><td>AgeGroup:</td><td>{0}</td></tr>\n", AgeGroup());
                }
            }

            sb.Append("</table>");

            return(sb.ToString());
        }