예제 #1
0
 public static void With(TextWriter output, HelperOptions options, dynamic context, params object[] arguments)
 {
     if (arguments.Length != 1)
     {
         throw new HandlebarsException("{{with}} helper must have exactly one argument");
     }
     options.Template(output, arguments[0]);
 }
예제 #2
0
 public static void Unless(TextWriter output, HelperOptions options, dynamic context, params object[] arguments)
 {
     if (arguments.Length != 1)
     {
         throw new HandlebarsException("{{unless}} helper must have exactly one argument");
     }
     if (HandlebarsUtils.IsFalsy(arguments[0]))
     {
         options.Template(output, context);
     }
     else
     {
         options.Inverse(output, context);
     }
 }
예제 #3
0
        public static void With(TextWriter output, object root, HelperOptions options, dynamic context, params object[] arguments)
        {
            if (arguments.Length != 1)
            {
                throw new HandlebarsException("{{with}} helper must have exactly one argument");
            }

            if (HandlebarsUtils.IsTruthyOrNonEmpty(arguments[0]))
            {
                options.Template(output, arguments[0]);
            }
            else
            {
                options.Inverse(output, context);
            }
        }
예제 #4
0
 private void IfAskTextQuestions(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskText)
         return;
     var list = Person.Text[((AskText)currentAsk).UniqueId].Where(a => a.Value.HasValue()).ToList();
     if (!list.Any())
         return;
     var lastKey = list.Last().Key;
     foreach (var item in list)
     {
         RowStyle = lastKey == item.Key ? CssStyle.BottomBorder : CssStyle.PadBottom;
         options.Template(writer, new
         {
             Question = item.Key,
             Answer = item.Value,
         });
     }
 }
예제 #5
0
 private void IfAskSms(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskSms)
         options.Template(writer, new { Person.person.ReceiveSMS });
 }
예제 #6
0
 private void IfAskRequest(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskRequest)
         return;
     options.Template(writer, new
     {
         ((AskRequest)currentAsk).Label,
         OrgMember.Request,
     });
 }
예제 #7
0
 private void MenuItems(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskMenu || Person.MenuItem == null)
         return;
     var obj = (AskMenu)currentAsk;
     var list = obj.MenuItemsChosen(Person.MenuItem[obj.UniqueId]).ToList();
     if (!list.Any())
         return;
     if (Person.MenuItem == null)
         return;
     var lastDesc = list.Last().desc;
     var TopLabel = "Choices";
     foreach (var item in list)
     {
         RowStyle = lastDesc == item.desc ? CssStyle.BottomBorder : CssStyle.PadBottom;
         options.Template(writer, new
         {
             TopLabel,
             Number = item.number,
             Desc = item.desc,
             HasAmt = item.amt > 0,
             DispAmt = item.amt.ToString("N2"),
         });
         Debug.Write(this.TopLabel);
         this.TopLabel = "";
     }
 }
예제 #8
0
 private void IfShowTransaction(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     var ti = db.Transactions.SingleOrDefault(tt => tt.Id == OrgMember.TranId);
     if (ti == null || (ti.Amt ?? 0) == 0)
         return;
     var ts = OrgMember.TransactionSummary(db);
     options.Template(writer, new
     {
         IndAmt = ts.IndAmt.ToString2("c"),
         TotPaid = OrgMember.TotalPaid(db).ToString("c"),
         AmountDue = OrgMember.AmountDue(db).ToString("c"),
     });
 }
예제 #9
0
 private void IfAskYesNoQuestions(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskYesNoQuestions)
         return;
     var list = ((AskYesNoQuestions)currentAsk).list
         .Where(a => Person.YesNoQuestion.ContainsKey(a.SmallGroup)).ToList();
     if (!list.Any())
         return;
     var lastKey = list.Last().Question;
     foreach (var item in list)
     {
         RowStyle = lastKey == item.Question ? CssStyle.BottomBorder : CssStyle.PadBottom;
         options.Template(writer, new
         {
             item.Question,
             Answer = Person.YesNoQuestion[item.SmallGroup] == true ? "Yes" : "No",
         });
     }
 }
예제 #10
0
 private void IfAskDropdown(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskDropdown)
         options.Template(writer, new
         {
             OptionsLabel = Util.PickFirst(((AskDropdown)currentAsk).Label, "Options"),
             SubGroupChoice = ((AskDropdown)currentAsk).SmallGroupChoice(Person.option).Description,
         });
 }
예제 #11
0
 private void IfAskChurch(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskChurch)
         return;
     var recReg = OrgMember.Person.GetRecReg();
     options.Template(writer, new
     {
         ShowNotMember = recReg.Member == true ? "" : "Not",
         ShowNotActive = recReg.ActiveInAnotherChurch == true ? "" : "Not",
     });
 }
예제 #12
0
 private void Checkboxes(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskCheckboxes)
         return;
     var list = ((AskCheckboxes)currentAsk).CheckboxItemsChosen(Person.Checkbox).ToList();
     if (!list.Any())
         return;
     var lastDesc = list.Last().Description;
     foreach (var item in list)
     {
         RowStyle = lastDesc == item.Description ? "" : CssStyle.PadBottom;
         options.Template(writer, new
         {
             DisplayDescription = item.Fee > 0
                 ? $"{item.Description} (${item.Fee.ToString2("N2")}<br/>({item.SmallGroup})"
                 : $"{item.Description}<br/>({item.SmallGroup})",
         });
     }
 }
예제 #13
0
 private void AskItems(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (SupportMissionTrip)
         return;
     var list = Person.setting.AskItems;
     if (!list.Any())
         return;
     foreach (var item in list)
     {
         currentAsk = item;
         options.Template(writer, item);
     }
 }
예제 #14
0
        private void IfShowTransaction(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
        {
            var ti = db.Transactions.SingleOrDefault(tt => tt.Id == OrgMember.TranId);
            if (ti == null || (ti.Amt ?? 0) == 0)
                return;
            var ts = OrgMember.TransactionSummary(db);
            var amtFee = (ts.IndPaid + ts.IndDue);
            var amtDonation = ts.IndAmt - amtFee;
            var info = new
            {
                AmtFee = amtFee.ToString2("c"),
                AmtDonation = amtDonation.ToString2("c"),
                AmtPaid = OrgMember.AmountPaidTransactions(db).ToString2("c"),
                AmtDue = OrgMember.AmountDueTransactions(db).ToString2("c"),

                HasDonation = amtDonation.HasValue,
            };
            options.Template(writer, info);
        }
예제 #15
0
 private void IfAskSms(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!currentAsk.IsAskSms)
         return;
     if (Person.person == null)
         Person.person = db.LoadPersonById(Person.PeopleId);
     options.Template(writer, new { Person.person.ReceiveSMS });
 }
예제 #16
0
 private void IfAskTickets(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskTickets)
         options.Template(writer, OrgMember);
 }
예제 #17
0
 private void IfAskTylenolEtc(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskTylenolEtc)
         options.Template(writer, new
         {
             Tylenol = Person.tylenol == true ? "Yes" : "No",
             Advil = Person.advil == true ? "Yes" : "No",
             Maalox = Person.maalox == true ? "Yes" : "No",
             Robitussin = Person.robitussin == true ? "Yes" : "No",
         });
 }
예제 #18
0
 private void IfAskGradeOptions(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskGradeOptions)
         options.Template(writer, new { GradeOption = Person.GradeOptions(currentAsk)[Person.gradeoption ?? "00"] });
 }
예제 #19
0
 private void IfHasAgeGroups(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (Person.setting.AgeGroups.Count == 0)
         return;
     options.Template(writer, new { AgeGroup = Person.AgeGroup() });
 }
예제 #20
0
 private void IfAskInstruction(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskInstruction)
         options.Template(writer, new { ((AskInstruction)currentAsk).Label });
 }
예제 #21
0
 private void IfSupportMissionTrip(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (!SupportMissionTrip)
         return;
     var Goer = db.LoadPersonById(Person.MissionTripGoerId ?? 0);
     options.Template(writer, new
     {
         Goer,
         HasGoer = Person.MissionTripGoerId > 0,
         HasGeneralSupport = Person.MissionTripSupportGeneral > 0,
     });
 }
예제 #22
0
 private void IfAskMenu(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskMenu)
         options.Template(writer, (object)context);
 }
예제 #23
0
 private void Registrant(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     options.Template(writer, new
     {
         OrgMember.Person.Name,
         OrgMember.Organization.OrganizationName,
     });
 }
예제 #24
0
 private void IfAskParents(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (currentAsk.IsAskParents)
         options.Template(writer, OrgMember.Person.GetRecReg());
 }