private void ReadFundItem(XElement e) { if (FundItem == null) { FundItem = new Dictionary <int, decimal?>(); } var fu = e.Attribute("fund"); if (fu != null) { FundItem.Add(fu.Value.ToInt(), e.Value.ToDecimal()); } }
private void PopulateExtraValueDefaults() { var f = OnlineRegPersonModel.FullFundList().SingleOrDefault(ff => ff.Text == Setting.ExtraValueFeeName); PopulateReasonableDefaults(); var evamt = person.GetExtra(Setting.ExtraValueFeeName).ToDecimal(); if (f != null && evamt > 0) { FundItem.Add(f.Value.ToInt(), evamt); } }
private void PopulateReasonableDefaults() { var f = OnlineRegPersonModel.FullFundList().SingleOrDefault(ff => ff.Text == Setting.ExtraValueFeeName); // reasonable defaults RepeatPattern = "M"; Period = "M"; SemiEvery = "E"; EveryN = 1; var evamt = person.GetExtra(Setting.ExtraValueFeeName).ToDecimal(); if (f != null && evamt > 0) { FundItem.Add(f.Value.ToInt(), evamt); } }
private void PopulateSetup(ManagedGiving rg) { RepeatPattern = rg.SemiEvery != "S" ? rg.Period : rg.SemiEvery; SemiEvery = rg.SemiEvery; StartWhen = rg.StartWhen; StopWhen = null; //rg.StopWhen; Day1 = rg.Day1; Day2 = rg.Day2; EveryN = rg.EveryN; Period = rg.Period; foreach (var ra in person.RecurringAmounts.AsEnumerable()) { FundItem.Add(ra.FundId, ra.Amt); } NextDate = rg.NextDate; }
public ManageGivingModel(int pid, int orgid = 0) : this() { this.pid = pid; this.orgid = orgid; var rg = person.ManagedGiving(); var pi = person.PaymentInfo(); if (rg != null && pi != null) { SemiEvery = rg.SemiEvery; StartWhen = rg.StartWhen; StopWhen = null; //rg.StopWhen; Day1 = rg.Day1; Day2 = rg.Day2; EveryN = rg.EveryN; Period = rg.Period; foreach (var ra in person.RecurringAmounts.AsEnumerable()) { FundItem.Add(ra.FundId, ra.Amt); } Cardnumber = pi.MaskedCard; Account = pi.MaskedAccount; Expires = pi.Expires; Cardcode = Util.Mask(new StringBuilder(pi.Ccv), 0); Routing = Util.Mask(new StringBuilder(pi.Routing), 2); NextDate = rg.NextDate; NoCreditCardsAllowed = DbUtil.Db.Setting("NoCreditCardGiving", "false").ToBool(); Type = pi.PreferredGivingType; if (NoCreditCardsAllowed) { Type = "B"; // bank account only } else if (NoEChecksAllowed) { Type = "C"; // credit card only } Type = NoEChecksAllowed ? "C" : Type; } else if (Setting.ExtraValueFeeName.HasValue()) { var f = CmsWeb.Models.OnlineRegPersonModel.Funds().SingleOrDefault(ff => ff.Text == Setting.ExtraValueFeeName); // reasonable defaults Period = "M"; SemiEvery = "E"; EveryN = 1; var evamt = person.GetExtra(Setting.ExtraValueFeeName).ToDecimal(); if (f != null && evamt > 0) { FundItem.Add(f.Value.ToInt(), evamt); } } if (pi == null) { pi = new PaymentInfo(); } FirstName = pi.FirstName ?? person.FirstName; Middle = (pi.MiddleInitial ?? person.MiddleName).Truncate(1); LastName = pi.LastName ?? person.LastName; Suffix = pi.Suffix ?? person.SuffixCode; Address = pi.Address ?? person.PrimaryAddress; City = pi.City ?? person.PrimaryCity; State = pi.State ?? person.PrimaryState; Zip = pi.Zip ?? person.PrimaryZip; Phone = pi.Phone ?? person.HomePhone ?? person.CellPhone; total = FundItem.Sum(ff => ff.Value) ?? 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; } } }
public void ReadXml(XmlReader reader) { var s = reader.ReadOuterXml(); var x = XDocument.Parse(s); if (x.Root == null) { return; } var eqset = 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 "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 Dictionary <string, int?>(); } var aname = e.Attribute("name"); var number = e.Attribute("number"); if (aname != null && number != null) { MenuItem.Add(aname.Value, number.Value.ToInt()); } break; default: Util.SetPropertyFromText(this, name, e.Value); break; } } }