public void Email(MailAddress fromAddress, Person p, List<MailAddress> addmail, string subject, string body, bool redacted) { var emailqueue = new EmailQueue { Queued = DateTime.Now, FromAddr = fromAddress.Address, FromName = fromAddress.DisplayName, Subject = subject, Body = body, QueuedBy = Util.UserPeopleId, Redacted = redacted, Transactional = true }; EmailQueues.InsertOnSubmit(emailqueue); string addmailstr = null; if (addmail != null) addmailstr = addmail.EmailAddressListToString(); emailqueue.EmailQueueTos.Add(new EmailQueueTo { PeopleId = p.PeopleId, OrgId = CurrentOrgId, AddEmail = addmailstr, Guid = Guid.NewGuid(), }); SubmitChanges(); SendPersonEmail(emailqueue.Id, p.PeopleId); }
private string getParentsField(AttendanceCacheSet cacheSet, LabelField field, string format, Attendance attendance) { CmsData.Person person = cacheSet.getPerson(attendance.peopleID); if (person == null) { return(""); } CmsData.Family family = cacheSet.getFamily(person.FamilyId); if (family == null) { return(""); } CmsData.Person head = cacheSet.getPerson(family.HeadOfHouseholdId ?? 0); CmsData.Person spouse = cacheSet.getPerson(family.HeadOfHouseholdSpouseId ?? 0); if (head == null && spouse == null) { return(""); } switch (field) { case LabelField.PARENTS_NAME: List <string> names = new List <string>(); if (head != null) { names.Add(head.FirstName); } if (spouse != null) { names.Add(spouse.FirstName); } return(string.Format(format, string.Join(", ", names))); case LabelField.PARENTS_PHONE: List <string> phones = new List <string>(); if (head != null && !head.CellPhone.IsEmpty()) { phones.Add(head.FirstName + ": " + head.CellPhone); } if (spouse != null && !spouse.CellPhone.IsEmpty()) { phones.Add(spouse.FirstName + ": " + spouse.CellPhone); } return(string.Format(format, string.Join(", ", phones))); default: return(""); } }
public FamilyModel(int id) { Person = DbUtil.Db.LoadPersonById(id); Pager = new PagerModel2(Count); Pager.pagesize = 10; Pager.ShowPageSize = false; }
public PersonFamilyModel(int id) { person = DbUtil.Db.LoadPersonById(id); Pager = new PagerModel2(Count); Pager.pagesize = 10; Pager.ShowPageSize = false; }
public MobilePerson populate(CmsData.Person p) { id = p.PeopleId; first = p.FirstName ?? ""; last = p.LastName ?? ""; address1 = p.AddressLineOne ?? ""; address2 = p.AddressLineTwo ?? ""; city = p.CityName ?? ""; state = p.StateCode ?? ""; zip = p.ZipCode ?? ""; age = p.Age ?? 0; birthday = ""; // TODO: Fix this home = p.HomePhone ?? ""; work = p.WorkPhone ?? ""; cell = p.CellPhone ?? ""; email1 = p.EmailAddress ?? ""; email2 = p.EmailAddress2 ?? ""; status = p.MemberStatusId; picture = p.PictureId ?? 0; deceased = ((p.IsDeceased ?? false) ? 1 : 0); return(this); }
private string getPersonField(AttendanceCacheSet cacheSet, LabelField field, string format, Attendance attendance) { CmsData.Person person = cacheSet.getPerson(attendance.peopleID); if (person == null) { return(""); } switch (field) { case LabelField.PERSON_SECURITY_CODE: return(string.Format(format, cacheSet.securityCode)); case LabelField.PERSON_FIRST_NAME: string firstname = person.PreferredName; return(string.Format(format, firstname)); case LabelField.PERSON_LAST_NAME: return(string.Format(format, person.LastName)); case LabelField.PERSON_ALLERGIES: return(string.Format(format, person.GetRecReg().MedicalDescription)); case LabelField.PERSON_INFO: string allergies = person.GetRecReg().MedicalDescription.IsEmpty() ? "" : "A"; string custody = person.CustodyIssue.HasValue && person.CustodyIssue.Value ? "C" : ""; string transport = person.OkTransport.HasValue && person.OkTransport.Value ? "T" : ""; return(string.Format(format, allergies, custody, transport)); case LabelField.PERSON_MEMBER_GUEST: string member = person.MemberStatus.Member ? "Member" : ""; string guest = person.MemberStatus.Member ? "" : "Guest"; return(string.Format(format, member, guest)); case LabelField.PERSON_FULL_NAME: return(string.Format(format, person.PreferredName, person.LastName)); case LabelField.PERSON_DOB: return(string.Format(format, person.BirthDate)); case LabelField.PERSON_EMERGENCY_NAME: return(string.Format(format, person.GetRecReg().Emcontact)); case LabelField.PERSON_EMERGENCY_PHONE: return(string.Format(format, person.GetRecReg().Emphone.FmtFone())); case LabelField.PERSON_SCHOOL: return(string.Format(format, person.SchoolOther)); case LabelField.PERSON_GRADE: return(string.Format(format, person.Grade)); default: return(""); } }
public void CreateTask(int forPeopleId, Person p, string description) { var t = p.AddTaskAbout(db, forPeopleId, description); db.SubmitChanges(); db.Email(db.Setting("AdminMail", "*****@*****.**"), db.LoadPersonById(forPeopleId), "TASK: " + description, Task.TaskLink(db, description, t.Id) + "<br/>" + p.Name); }
public void UpdateMemberNotes() { person = DbUtil.Db.LoadPersonById(PeopleId); this.CopyPropertiesTo(person); DbUtil.Db.SubmitChanges(); DbUtil.LogActivity($"Updated Growth: {person.Name}"); }
public MemberInfo(int id) : this() { person = Db.LoadPersonById(id); if (person == null) return; this.CopyPropertiesFrom(person); }
// List of api functions to call from Python public void CreateTask(int forPeopleId, Person p, string description) { DbUtil.LogActivity("Adding Task about: {0}".Fmt(p.Name)); var t = p.AddTaskAbout(Db, forPeopleId, description); Db.SubmitChanges(); Db.Email(DbUtil.SystemEmailAddress, DbUtil.Db.LoadPersonById(forPeopleId), "TASK: " + description, Task.TaskLink(Db, description, t.Id) + "<br/>" + p.Name); }
public static string MessageReplacements(CMSDataContext db, Person p, string DivisionName, string OrganizationName, string Location, string message) { message = message.Replace("{first}", p.PreferredName, ignoreCase: true); message = message.Replace("{name}", p.Name, ignoreCase: true); message = message.Replace("{division}", DivisionName, ignoreCase: true); message = message.Replace("{org}", OrganizationName, ignoreCase: true); message = message.Replace("{location}", Location, ignoreCase: true); message = message.Replace("{cmshost}", db.CmsHost, ignoreCase: true); return message; }
protected void Page_Load(object sender, EventArgs e) { var id = this.QueryString<int>("id"); person = DbUtil.Db.People.Single(p => p.PeopleId == id); if (person.Picture == null) person.Picture = new Picture(); if (!IsPostBack) HiddenField1.Value = "large"; if (DbUtil.Db.UserPreference("newlook3", "false").ToBool() && DbUtil.Db.UserPreference("newpeoplepage", "false").ToBool()) HyperLink2.NavigateUrl = "~/Person2/" + id.ToString(); else HyperLink2.NavigateUrl = "~/Person2/" + id.ToString(); HyperLink2.Text = "Return to: " + person.Name; }
private void UpdateValue(CmsData.Person p, string field, object value) { var o = Util.GetProperty(p, field); if (o == null && value == null) { return; } if (o != null && o.Equals(value)) { return; } psb.Add(new ChangeDetail(field, o, value)); Util.SetProperty(p, field, value); }
public List <Label> createLabelData(CMSDataContext dataContext) { List <Label> labels = new List <Label>(); bool printingForChildren = false; bool needsSecurityLabel = false; using (var db = new SqlConnection(Util.ConnectionString)) { AttendanceCacheSet cacheSet = new AttendanceCacheSet { dataContext = dataContext, formats = LabelFormat.forSize(db, labelSize), securityLabels = securityLabels, securityCode = dataContext.NextSecurityCode().Select(c => c.Code).Single().Trim(), guestLabels = guestLabels, locationLabels = locationLabels, nameTagAge = nameTagAge }; foreach (Attendance attendance in attendances) { attendance.populateSubgroups(db, cacheSet); labels.AddRange(attendance.getLabels(cacheSet)); CmsData.Person person = cacheSet.getPerson(attendance.peopleID); if (securityLabels == Attendance.SECURITY_LABELS_PER_FAMILY) { // we only add a security label if we are printing for children in orgs with a security label needed; do those checks now if ((person.Age ?? 0) < cacheSet.nameTagAge) { printingForChildren = true; } foreach (AttendanceGroup group in attendance.groups) { Organization org = cacheSet.getOrganization(group.groupID); if (org != null && org.NoSecurityLabel != true && org.NumCheckInLabels > 0 && group.present) { needsSecurityLabel = true; } } } } if (printingForChildren && needsSecurityLabel && labels.Count > 0) { labels.AddRange(attendances[0].getSecurityLabel(cacheSet)); } } return(labels); }
public ActionResult UpdateMembership(string data) { // Authenticate first if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); Message response = new Message(); OrgMembership membership = JsonConvert.DeserializeObject <OrgMembership>(message.data); OrganizationMember om = CurrentDatabase.OrganizationMembers.SingleOrDefault(m => m.PeopleId == membership.peopleID && m.OrganizationId == membership.orgID); if (om == null && membership.join) { om = OrganizationMember.InsertOrgMembers(CurrentDatabase, membership.orgID, membership.peopleID, MemberTypeCode.Member, DateTime.Today); } if (om != null && !membership.join) { om.Drop(CurrentDatabase, CurrentImageDatabase, DateTime.Now); DbUtil.LogActivity($"Dropped {om.PeopleId} for {om.Organization.OrganizationId} via checkin", peopleid: om.PeopleId, orgid: om.OrganizationId); } CurrentDatabase.SubmitChanges(); // Check Entry Point and replace if Check-In CmsData.Person person = CurrentDatabase.People.FirstOrDefault(p => p.PeopleId == membership.peopleID); if (person?.EntryPoint != null && person.EntryPoint.Code == "CHECKIN" && om != null) { person.EntryPoint = om.Organization.EntryPoint; CurrentDatabase.SubmitChanges(); } Guid barcode = CmsData.Person.Barcode(CurrentDatabase, membership.peopleID); response.data = SerializeJSON(barcode.ToString(), message.version); response.setNoError(); response.count = 1; return(response); }
public bool FieldEqual(Person p, string field, string value) { if (value is string) value = ((string)value).TrimEnd(); if (!Util.HasProperty(p, field)) return false; var o = Util.GetProperty(p, field); if (o is string) o = ((string)o).TrimEnd(); var p2 = new Person(); Util.SetPropertyFromText(p2, field, value); var o2 = Util.GetProperty(p2, field); if (o == o2) return true; if (o.IsNull() && o2.IsNotNull()) return false; return o.Equals(o2); }
public ActionResult EditPerson(string data) { // Authenticate first if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); Models.CheckInAPIv2.Person person = JsonConvert.DeserializeObject <Models.CheckInAPIv2.Person>(message.data); person.clean(); CmsData.Person p = CurrentDatabase.LoadPersonById(person.id); if (p == null) { return(Message.createErrorReturn("Person not found", Message.API_ERROR_PERSON_NOT_FOUND)); } CmsData.Family f = CurrentDatabase.Families.First(fam => fam.FamilyId == p.FamilyId); person.fillPerson(p); person.fillFamily(f); CurrentDatabase.SubmitChanges(); AddEditPersonResults results = new AddEditPersonResults { familyID = f.FamilyId, peopleID = p.PeopleId, positionID = p.PositionInFamilyId, barcodeID = CmsData.Person.Barcode(CurrentDatabase, p.PeopleId) }; Message response = new Message(); response.setNoError(); response.count = 1; response.data = SerializeJSON(results); return(response); }
private string getPersonField(AttendanceCacheSet cacheSet, LabelField field, string format, Attendance attendance) { CmsData.Person person = cacheSet.getPerson(attendance.peopleID); if (person == null) { return(""); } switch (field) { case LabelField.PERSON_SECURITY_CODE: return(string.Format(format, cacheSet.securityCode)); case LabelField.PERSON_FIRST_NAME: return(string.Format(format, person.FirstName)); case LabelField.PERSON_LAST_NAME: return(string.Format(format, person.LastName)); case LabelField.PERSON_ALLERGIES: return(string.Format(format, person.GetRecReg().MedicalDescription)); case LabelField.PERSON_INFO: string allergies = person.GetRecReg().MedicalDescription.IsEmpty() ? "" : "A"; string custody = person.CustodyIssue.HasValue && person.CustodyIssue.Value ? "C" : ""; string transport = person.OkTransport.HasValue && person.OkTransport.Value ? "T" : ""; return(string.Format(format, allergies, custody, transport)); case LabelField.PERSON_MEMBER_GUEST: string member = person.MemberStatus.Member ? "Member" : ""; string guest = person.MemberStatus.Member ? "" : "Guest"; return(string.Format(format, member, guest)); default: return(""); } }
public CheckInPerson populate(CmsData.Person p) { id = p.PeopleId; familyID = p.FamilyId; first = p.FirstName ?? ""; last = p.LastName ?? ""; goesby = p.NickName; genderID = p.GenderId; maritalStatusID = p.MaritalStatus.Id; birthday = p.BirthDate; email = p.EmailAddress; cell = p.CellPhone.FmtFone(); home = p.HomePhone.FmtFone(); address = p.Family.AddressLineOne ?? ""; address2 = p.Family.AddressLineTwo ?? ""; city = p.Family.CityName ?? ""; state = p.Family.StateCode ?? ""; zipcode = p.Family.ZipCode.FmtZip() ?? ""; country = p.PrimaryCountry; church = p.OtherPreviousChurch; allergies = p.SetRecReg().MedicalDescription; emergencyName = p.SetRecReg().Emcontact; emergencyPhone = p.SetRecReg().Emphone; age = p.Age ?? 0; return(this); }
private static void joinToOrg(CMSDataContext dataContext, int peopleID, int orgID) { OrganizationMember om = dataContext.OrganizationMembers.SingleOrDefault(m => m.PeopleId == peopleID && m.OrganizationId == orgID); if (om == null) { om = OrganizationMember.InsertOrgMembers(dataContext, orgID, peopleID, CmsData.Codes.MemberTypeCode.Member, DateTime.Today); DbUtil.LogActivity($"Joined {om.PeopleId} to {om.Organization.OrganizationId} via Check-In desktop client", peopleid: om.PeopleId, orgid: om.OrganizationId); dataContext.SubmitChanges(); // Check Entry Point and replace if Check-In CmsData.Person person = dataContext.People.FirstOrDefault(p => p.PeopleId == peopleID); if (person?.EntryPoint != null && person.EntryPoint.Code == "CHECKIN") { person.EntryPoint = om.Organization.EntryPoint; dataContext.SubmitChanges(); } } }
public void AddPerson(Person p, int entrypoint) { Family f; if (p == null) f = new Family { AddressLineOne = AddressLineOne, AddressLineTwo = AddressLineTwo, CityName = City, StateCode = State, ZipCode = ZipCode, CountryName = Country, HomePhone = Phone.GetDigits().Truncate(20), }; else f = p.Family; DbUtil.Db.SubmitChanges(); var position = DbUtil.Db.ComputePositionInFamily(age, married == 20 , f.FamilyId) ?? 10; _person = Person.Add(f, position, null, FirstName.Trim(), null, LastName.Trim(), DateOfBirth, married == 20, gender ?? 0, OriginCode.Enrollment, entrypoint); person.EmailAddress = EmailAddress.Trim(); person.SendEmailAddress1 = true; person.CampusId = DbUtil.Db.Setting("DefaultCampusId", "").ToInt2(); person.CellPhone = Phone.GetDigits().Truncate(20); if (count == 0) person.Comments = "Added during online registration because record was not found"; else if(count > 1) person.Comments = "Added during online registration because there was more than 1 match"; DbUtil.Db.SubmitChanges(); DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, person); PeopleId = person.PeopleId; Log("AddPerson"); }
private void SetField(Person p, string[] a, string prop, string s, object value) { if (names.ContainsKey(s)) if (value != null) Util.SetProperty(p, prop, value); }
private void attach_People(Person entity) { this.SendPropertyChanging(); entity.Campu = this; }
private void attach_People(Person entity) { this.SendPropertyChanging(); entity.MemberLetterStatus = this; }
private void detach_People(Person entity) { this.SendPropertyChanging(); entity.Family = null; }
private Paragraph GetAttendance(Person p) { var q = from a in p.Attends where a.AttendanceFlag orderby a.MeetingDate.Date descending group a by a.MeetingDate.Date into g select g.Key; var list = q.ToList(); var attstr = new StringBuilder("\n"); var dt = Util.Now; var yearago = dt.AddYears(-1); while (dt > yearago) { var dt2 = dt.AddDays(-7); var indicator = "."; foreach (var d in list) { if (d < dt2) break; if (d <= dt) { indicator = "P"; break; } } attstr.Insert(0, indicator); dt = dt2; } var ph = new Paragraph(attstr.ToString(), monofont); ph.SetLeading(0, 1.2f); attstr = new StringBuilder(); foreach (var d in list.Take(8)) attstr.Insert(0, $"{d:d} "); if (list.Count > 8) { attstr.Insert(0, "... "); var q2 = q.OrderBy(d => d).Take(Math.Min(list.Count - 8, 3)); foreach (var d in q2.OrderByDescending(d => d)) attstr.Insert(0, $"{d:d} "); } ph.Add(new Chunk(attstr.ToString(), smallfont)); return ph; }
public RegistrationsModel(int id) { person = DbUtil.Db.LoadPersonById(id); var rr = person.SetRecReg(); this.CopyPropertiesFrom(rr); }
private void detach_People(Person entity) { this.SendPropertyChanging(); entity.DecisionType = null; }
public PreviousEnrollments(int id) : base("Org Name", "asc") { PeopleId = id; person = DbUtil.Db.LoadPersonById(id); }
public CurrentEnrollments(int id) : base("", "") { PeopleId = id; person = DbUtil.Db.LoadPersonById(id); }
public MobilePerson populate(CmsData.Person p) { addresses = new Dictionary <string, MobilePersonAddress>(); emailPhone = new List <MobileContact>(); family = new Dictionary <string, MobileFamilyMember>(); relatives = new Dictionary <string, string>(); id = p.PeopleId; familyID = p.FamilyId; first = p.PreferredName ?? ""; last = p.LastName ?? ""; suffix = p.SuffixCode; if (p.AddressTypeId == 10) { primaryAddress = "Family"; } else { primaryAddress = "Personal"; } var familyAddr = new MobilePersonAddress(); familyAddr.address1 = p.Family.AddressLineOne ?? ""; familyAddr.address2 = p.Family.AddressLineTwo ?? ""; familyAddr.city = p.Family.CityName ?? ""; familyAddr.state = p.Family.StateCode ?? ""; familyAddr.zip = p.Family.ZipCode.FmtZip() ?? ""; addresses.Add("Family", familyAddr); if (!string.IsNullOrEmpty(p.AddressLineOne)) { var personalAddr = new MobilePersonAddress(); personalAddr.address1 = p.AddressLineOne ?? ""; personalAddr.address2 = p.AddressLineTwo ?? ""; personalAddr.city = p.CityName ?? ""; personalAddr.state = p.StateCode ?? ""; personalAddr.zip = p.ZipCode.FmtZip() ?? ""; addresses.Add("Personal", personalAddr); } gender = p.Gender.Description; age = p.Age ?? 0; birthday = p.DOB.Length > 0 ? p.DOB : "No Birthday Set"; if (!string.IsNullOrEmpty(p.CellPhone)) { emailPhone.Add(new MobileContact(1, "Cell", p.CellPhone.FmtFone())); } if (!string.IsNullOrEmpty(p.HomePhone)) { emailPhone.Add(new MobileContact(1, "Home", p.HomePhone.FmtFone())); } if (!string.IsNullOrEmpty(p.WorkPhone)) { emailPhone.Add(new MobileContact(1, "Work", p.WorkPhone.FmtFone())); } if (!string.IsNullOrEmpty(p.EmailAddress)) { emailPhone.Add(new MobileContact(2, "EMail1", p.EmailAddress)); } if (!string.IsNullOrEmpty(p.EmailAddress2)) { emailPhone.Add(new MobileContact(2, "EMail2", p.EmailAddress2)); } status = p.MemberStatusId; statusText = p.MemberStatus.Description; deceased = ((p.IsDeceased ?? false) ? 1 : 0); foreach (var m in p.Family.People.Where(mm => mm.PeopleId != p.PeopleId)) { var familyMember = new MobileFamilyMember(); familyMember.id = m.PeopleId.ToString(); familyMember.name = m.Name; familyMember.age = m.Age.ToString(); familyMember.gender = m.Gender.Description; familyMember.position = m.FamilyPosition.Description; familyMember.deceased = m.Deceased; family.Add(m.PeopleId.ToString(), familyMember); } var q = from re in DbUtil.Db.RelatedFamilies where re.FamilyId == p.FamilyId || re.RelatedFamilyId == p.FamilyId let rf = re.RelatedFamilyId == p.FamilyId ? re.RelatedFamily1 : re.RelatedFamily2 select new { hohid = rf.HeadOfHouseholdId, description = re.FamilyRelationshipDesc }; foreach (var rf in q) { if (!relatives.ContainsKey(rf.hohid.ToString())) { relatives.Add(rf.hohid.ToString(), rf.description); } } picture = ""; if (p.Picture != null) { var image = ImageData.DbUtil.Db.Images.SingleOrDefault(i => i.Id == p.Picture.SmallId); if (image != null) { picture = Convert.ToBase64String(image.Bits); pictureX = p.Picture.X ?? 0; pictureY = p.Picture.Y ?? 0; } } return(this); }
public DuplicatesModel(int id) { person = DbUtil.Db.LoadPersonById(id); }
public FamilyModel(int id) { Person = DbUtil.Db.LoadPersonById(id); pagesize = 100; }
protected TasksModel(int id) : base("Completed", "desc") { person = DbUtil.Db.LoadPersonById(id); }
private DateTime? GetDate(Person p, string[] a, string s) { if (names.ContainsKey(s)) if (a[names[s]].HasValue()) { DateTime dt; if (DateTime.TryParse(a[names[s]], out dt)) { if (dt.Year < 1800) throw new Exception($"error on {p.FirstName} {p.LastName}: [{names[s]}]({a[names[s]]})"); return dt; } } return null; }
public FamilyModel(int id) { Person = DbUtil.Db.LoadPersonById(id); }
public List<MailAddress> DoReplacements(ref string text, Person p, EmailQueueTo emailqueueto) { if (text == null) text = "(no content)"; if (text.Contains("{name}", ignoreCase: true)) if (p.Name.Contains("?") || p.Name.Contains("unknown", true)) text = text.Replace("{name}", string.Empty); else text = text.Replace("{name}", p.Name, ignoreCase: true); if (text.Contains("{first}", ignoreCase: true)) if (p.PreferredName.Contains("?", true) || (p.PreferredName.Contains("unknown", true))) text = text.Replace("{first}", string.Empty, ignoreCase: true); else text = text.Replace("{first}", p.PreferredName, ignoreCase: true); text = text.Replace("{last}", p.LastName, ignoreCase: true); if (text.Contains("{occupation}", ignoreCase: true)) text = text.Replace("{occupation}", p.OccupationOther, ignoreCase: true); if (text.Contains("{emailhref}", ignoreCase: true)) { string eurl = Util.URLCombine(CmsHost, "Manage/Emails/View/" + emailqueueto.Id); text = text.Replace("{emailhref}", eurl, ignoreCase: true); } text = DoVoteLinkAnchorStyle(text, emailqueueto); text = DoVoteTag(text, emailqueueto); text = DoVoteTag2(text, emailqueueto); text = DoRegisterTag(text, emailqueueto); text = DoRegisterTag2(text, emailqueueto); text = DoExtraValueData(text, emailqueueto); if (emailqueueto.OrgId.HasValue) { if (text.Contains("{smallgroup:", ignoreCase: true)) text = DoSmallGroupData(text, emailqueueto); if (text.Contains("{addsmallgroup:", ignoreCase: true)) text = DoAddSmallGroup(text, emailqueueto); if (text.Contains("{nextmeetingtime}", ignoreCase: true)) text = DoMeetingDate(text, emailqueueto); if (text.Contains("{smallgroups", ignoreCase: true)) text = DoSmallGroups(text, emailqueueto); } if (text.Contains("{today}", ignoreCase: true)) text = text.Replace("{today}", DateTime.Today.ToShortDateString()); if (text.Contains("{createaccount}", ignoreCase: true)) text = text.Replace("{createaccount}", DoCreateUserTag(emailqueueto)); if (text.Contains("{peopleid}", ignoreCase: true)) text = text.Replace("{peopleid}", emailqueueto.PeopleId.ToString(), ignoreCase: true); if (text.Contains("http://votelink", ignoreCase: true)) text = DoVoteLink(text, emailqueueto); if (text.Contains("http://registerlink", ignoreCase: true)) text = DoRegisterLink(text, emailqueueto); if (text.Contains("http://rsvplink", ignoreCase: true)) text = DoRsvpLink(text, emailqueueto); if (text.Contains("http://volsublink", ignoreCase: true)) text = DoVolSubLink(text, emailqueueto); if (text.Contains("http://volreqlink", ignoreCase: true)) text = DoVolReqLink(text, emailqueueto); if (text.Contains("{barcode}", ignoreCase: true)) { string link = Util.URLCombine(CmsHost, "/Track/Barcode/" + emailqueueto.PeopleId); text = text.Replace("{barcode}", "<img src='" + link + "' />", ignoreCase: true); } if (text.Contains("{cellphone}", ignoreCase: true)) text = text.Replace("{cellphone}", p.CellPhone.HasValue() ? p.CellPhone.FmtFone() : "no cellphone on record", true); if (text.Contains("{campus}", ignoreCase: true)) text = text.Replace("{campus}", p.CampusId != null ? p.Campu.Description : "No Campus Specified", true); if (emailqueueto.Guid.HasValue) { string turl = Util.URLCombine(CmsHost, "/Track/Key/" + emailqueueto.Guid.Value.GuidToQuerystring()); text = text.Replace("{track}", "<img src=\"{0}\" />".Fmt(turl), ignoreCase: true); } List<MailAddress> aa = GetAddressList(p); if (emailqueueto.AddEmail.HasValue()) foreach (string ad in emailqueueto.AddEmail.SplitStr(",")) Util.AddGoodAddress(aa, ad); if (emailqueueto.OrgId.HasValue) { var qm = (from m in OrganizationMembers where m.PeopleId == emailqueueto.PeopleId && m.OrganizationId == emailqueueto.OrgId select new { m.PayLink, m.Amount, m.AmountPaid, m.RegisterEmail }).SingleOrDefault(); if (qm != null) { if (qm.PayLink.HasValue()) if (text.Contains("{paylink}", ignoreCase: true)) text = text.Replace("{paylink}", "<a href=\"{0}\">payment link</a>".Fmt(qm.PayLink), ignoreCase: true); if (text.Contains("{amtdue}", ignoreCase: true)) text = text.Replace("{amtdue}", (qm.Amount - qm.AmountPaid).ToString2("c"), ignoreCase: true); Util.AddGoodAddress(aa, Util.FullEmail(qm.RegisterEmail, p.Name)); } } return aa.DistinctEmails(); }
private void detach_EnvPeople(Person entity) { this.SendPropertyChanging(); entity.EnvelopeOption = null; }
private void UpdatePerson(Person p, PersonInfo m, bool isNew) { var psb = new List<ChangeDetail>(); var fsb = new List<ChangeDetail>(); var keys = Request.Form.AllKeys.ToList(); if (!m.home.HasValue() && m.cell.HasValue()) m.home = m.cell; if (keys.Contains("zip") || keys.Contains("addr")) { var result = AddressVerify.LookupAddress(m.addr, p.PrimaryAddress2, null, null, m.zip.Zip5()); if (result.found != false && !result.error.HasValue() && result.Line1 != "error") { UpdateField(fsb, p.Family, "AddressLineOne", result.Line1); UpdateField(fsb, p.Family, "AddressLineTwo", result.Line2); UpdateField(fsb, p.Family, "CityName", result.City); UpdateField(fsb, p.Family, "StateCode", result.State); UpdateField(fsb, p.Family, "ZipCode", result.Zip.GetDigits().Truncate(10)); var rc = DbUtil.Db.FindResCode(result.Zip, null); UpdateField(fsb, p.Family, "ResCodeId", rc.ToString()); } else { if (keys.Contains("addr")) UpdateField(fsb, p.Family, "AddressLineOne", m.addr); UpdateField(fsb, p.Family, "ZipCode", m.zip.Zip5()); UpdateField(fsb, p.Family, "CityName", null); UpdateField(fsb, p.Family, "StateCode", null); } } if (keys.Contains("home")) UpdateField(fsb, p.Family, "HomePhone", m.home.GetDigits()); if (keys.Contains("goesby")) UpdateField(psb, p, "NickName", Trim(m.goesby)); if (keys.Contains("first")) UpdateField(psb, p, "FirstName", Trim(m.first)); if (keys.Contains("last")) UpdateField(psb, p, "LastName", Trim(m.last)); if (keys.Contains("dob")) { DateTime dt; DateTime.TryParse(m.dob, out dt); if (p.BirthDate != dt) UpdateField(psb, p, "DOB", m.dob); } if (keys.Contains("email")) UpdateField(psb, p, "EmailAddress", Trim(m.email)); if (keys.Contains("cell")) UpdateField(psb, p, "CellPhone", m.cell.GetDigits()); if (keys.Contains("marital")) UpdateField(psb, p, "MaritalStatusId", m.marital); if (keys.Contains("gender")) UpdateField(psb, p, "GenderId", m.gender); var rr = p.GetRecReg(); if (keys.Contains("allergies")) if (m.allergies != rr.MedicalDescription) p.SetRecReg().MedicalDescription = m.allergies; if (keys.Contains("grade")) if (m.AskGrade) if (m.grade.ToInt2() != p.Grade) p.Grade = m.grade.ToInt2(); if (m.AskEmFriend) { if (keys.Contains("parent")) if (m.parent != rr.Mname) p.SetRecReg().Mname = m.parent; if (keys.Contains("emfriend")) if (m.emfriend != rr.Emcontact) p.SetRecReg().Emcontact = m.emfriend; if (keys.Contains("emphone")) if (m.emphone != rr.Emphone) p.SetRecReg().Emphone = m.emphone.Truncate(50); } if (isNew) { if (keys.Contains("campusid")) if (m.campusid > 0) UpdateField(psb, p, "CampusId", m.campusid); } if (m.AskChurch) if (keys.Contains("activeother")) if (m.activeother.ToBool() != rr.ActiveInAnotherChurch) p.SetRecReg().ActiveInAnotherChurch = m.activeother.ToBool(); if (m.AskChurchName) if (keys.Contains("churchname")) UpdateField(psb, p, "OtherPreviousChurch", Trim(m.churchname)); p.LogChanges(DbUtil.Db, psb); p.Family.LogChanges(DbUtil.Db, fsb, p.PeopleId, Util.UserPeopleId ?? 0); DbUtil.Db.SubmitChanges(); if (DbUtil.Db.Setting("NotifyCheckinChanges", "true").ToBool() && (psb.Count > 0 || fsb.Count > 0)) { var sb = new StringBuilder(); foreach (var c in psb) sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>\n", c.Field, c.Before, c.After); foreach (var c in fsb) sb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>\n", c.Field, c.Before, c.After); var np = DbUtil.Db.GetNewPeopleManagers(); if (np != null) DbUtil.Db.EmailRedacted(p.FromEmail, np, "Basic Person Info Changed during checkin on " + Util.Host, $@" <p><a href=""{DbUtil.Db.ServerLink("/Person2/" + p.PeopleId)}"">{Util.UserName} ({p.PeopleId})</a> changed the following information for {p.PreferredName} ({p.LastName}):</p> <table>{sb}</table>"); } }
private void AddRow(PdfPTable t, Person p, int fn, BaseColor color) { t.DefaultCell.BackgroundColor = color; var c1 = new Phrase(); c1.Add(new Chunk(p.Name, boldfont)); c1.Add(new Chunk($" ({p.PeopleId})\n", smallfont)); var contact = new StringBuilder(); var cv = new CodeValueModel(); if (fn == 1) { AddLine(contact, p.PrimaryAddress); AddLine(contact, p.PrimaryAddress2); AddLine(contact, $"{p.PrimaryCity}, {p.PrimaryState} {p.PrimaryZip.FmtZip()}"); } AddPhone(contact, p.HomePhone, "h "); AddPhone(contact, p.CellPhone, "c "); AddPhone(contact, p.WorkPhone, "w "); AddLine(contact, p.EmailAddress); c1.Add(new Chunk(contact.ToString(), font)); t.AddCell(c1); var c2 = new Phrase($"{p.DOB} ({p.Age}, {(p.GenderId == 1 ? "M" : p.GenderId == 2 ? "F" : "U")})\n", font); c2.Add(new Chunk(cv.MemberStatusCodes().ItemValue(p.MemberStatusId), font)); t.AddCell(c2); var c3 = new Phrase(( p.PositionInFamilyId == 10 ? "Primary Adult" : p.PositionInFamilyId == 20 ? "Secondary Adult" : "Child") + "\n", font); if (p.BibleFellowshipClassId.HasValue) { c3.Add(new Chunk(p.BFClass.OrganizationName, font)); if (p.BFClass.LeaderName.HasValue()) c3.Add(new Chunk($" ({p.BFClass.LeaderName})", smallfont)); } t.AddCell(c3); }
public ActionResult AddPerson(string data) { // Authenticate first var result = AuthenticateUser(); if (!result.IsValid) return AuthorizationError(result); // Check Role if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Attendance")) return BaseMessage.createErrorReturn("Attendance role is required to take attendance for organizations."); BaseMessage dataIn = BaseMessage.createFromString(data); MobilePostAddPerson mpap = JsonConvert.DeserializeObject<MobilePostAddPerson>(dataIn.data); mpap.clean(); var p = new Person(); p.CreatedDate = Util.Now; p.CreatedBy = Util.UserId; p.MemberStatusId = MemberStatusCode.JustAdded; p.AddressTypeId = 10; p.FirstName = mpap.firstName; p.LastName = mpap.lastName; p.Name = ""; if (mpap.goesBy.Length > 0) p.NickName = mpap.goesBy; if (mpap.birthday != null) { p.BirthDay = mpap.birthday.Value.Day; p.BirthMonth = mpap.birthday.Value.Month; p.BirthYear = mpap.birthday.Value.Year; } p.GenderId = mpap.genderID; p.MaritalStatusId = mpap.maritalStatusID; Family f; if (mpap.familyID > 0) { f = DbUtil.Db.Families.First(fam => fam.FamilyId == mpap.familyID); } else { f = new Family(); if (mpap.homePhone.Length > 0) f.HomePhone = mpap.homePhone; if (mpap.address.Length > 0) f.AddressLineOne = mpap.address; if (mpap.address2.Length > 0) f.AddressLineTwo = mpap.address2; if (mpap.city.Length > 0) f.CityName = mpap.city; if (mpap.state.Length > 0) f.StateCode = mpap.state; if (mpap.zipcode.Length > 0) f.ZipCode = mpap.zipcode; if (mpap.country.Length > 0) f.CountryName = mpap.country; DbUtil.Db.Families.InsertOnSubmit(f); } f.People.Add(p); p.PositionInFamilyId = PositionInFamily.Child; if (mpap.birthday != null && p.GetAge() >= 18) { if (f.People.Count(per => per.PositionInFamilyId == PositionInFamily.PrimaryAdult) < 2) p.PositionInFamilyId = PositionInFamily.PrimaryAdult; else p.PositionInFamilyId = PositionInFamily.SecondaryAdult; } p.OriginId = OriginCode.Visit; p.FixTitle(); if (mpap.eMail.Length > 0) p.EmailAddress = mpap.eMail; if (mpap.cellPhone.Length > 0) p.CellPhone = mpap.cellPhone; if (mpap.homePhone.Length > 0) p.HomePhone = mpap.homePhone; p.MaritalStatusId = mpap.maritalStatusID; p.GenderId = mpap.genderID; DbUtil.Db.SubmitChanges(); if (mpap.visitMeeting > 0) { var meeting = DbUtil.Db.Meetings.Single(mm => mm.MeetingId == mpap.visitMeeting); Attend.RecordAttendance(p.PeopleId, mpap.visitMeeting, true); DbUtil.Db.UpdateMeetingCounters(mpap.visitMeeting); p.CampusId = meeting.Organization.CampusId; DbUtil.Db.SubmitChanges(); } BaseMessage br = new BaseMessage(); br.setNoError(); br.id = p.PeopleId; br.count = 1; return br; }
private void attach_People(Person entity) { this.SendPropertyChanging(); entity.Family = this; }
public PersonContactsMadeModel(int id) { person = DbUtil.Db.LoadPersonById(id); Pager = new PagerModel2(Count); Pager.pagesize = 10; }
internal void AddPerson(int originid, int? entrypointid, int? campusid) { Family f; string na = "na"; if (FamilyId > 0) f = family; else f = new Family { HomePhone = homephone.GetDigits(), AddressLineOne = address.Disallow(na), AddressLineTwo = address2, CityName = city.Disallow(na), StateCode = state.Disallow(na), ZipCode = zip.Disallow(na), CountryName = country, }; if (goesby != null) goesby = goesby.Trim(); var position = PositionInFamily.Child; if (!birthday.HasValue) position = PositionInFamily.PrimaryAdult; if (age >= 18) if (f.People.Count(per => per.PositionInFamilyId == PositionInFamily.PrimaryAdult) < 2) position = PositionInFamily.PrimaryAdult; else position = PositionInFamily.SecondaryAdult; _Person = Person.Add(f, position, null, first.Trim(), goesby, last.Trim(), dob, false, gender, originid, entrypointid); if (title.HasValue()) person.TitleCode = title; person.EmailAddress = email.Disallow(na); person.MaritalStatusId = marital; person.SuffixCode = suffix; person.MiddleName = middle; if (campusid == 0) campusid = null; person.CampusId = Util.PickFirst(campusid.ToString(), DbUtil.Db.Setting("DefaultCampusId", "")).ToInt2(); if (person.CampusId == 0) person.CampusId = null; person.CellPhone = phone.GetDigits(); DbUtil.Db.SubmitChanges(); DbUtil.LogActivity("OldUI AddPerson {0}".Fmt(person.PeopleId)); DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, person); PeopleId = person.PeopleId; }
private void SetField(Person p, string[] a, string prop, string s) { if (names.ContainsKey(s)) if (a[names[s]].HasValue()) Util.SetProperty(p, prop, a[names[s]]); }
private void detach_People(Person entity) { this.SendPropertyChanging(); entity.BaptismType = null; }
public ActionResult EditPerson(string data) { // Authenticate first if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); Models.CheckInAPIv2.Person person = JsonConvert.DeserializeObject <Models.CheckInAPIv2.Person>(message.data); // new data person.clean(); var NewContext = CurrentDatabase.Copy(); CmsData.Person p = NewContext.LoadPersonById(person.id); // existing data if (p == null) { return(Message.createErrorReturn("Person not found", Message.API_ERROR_PERSON_NOT_FOUND)); } person.fillPerson(p); BasicPersonInfo m = new BasicPersonInfo() { Id = person.id }; p.CopyProperties2(m); m.CellPhone = new CellPhoneInfo() { Number = person.mobilePhone, ReceiveText = p.ReceiveSMS }; m.Gender = new Code.CodeInfo(p.GenderId, p.Gender.Description); m.MaritalStatus = new Code.CodeInfo(p.MaritalStatusId, p.MaritalStatus.Description); m.EmailAddress = new EmailInfo() { Address = p.EmailAddress, Send = p.SendEmailAddress1.GetValueOrDefault(true) }; m.EmailAddress2 = new EmailInfo() { Address = p.EmailAddress2, Send = p.SendEmailAddress2.GetValueOrDefault(true) }; m.UpdatePerson(CurrentDatabase); DbUtil.LogPersonActivity($"Update Basic Info for: {m.person.Name}", m.Id, m.person.Name); CmsData.Family f = NewContext.Families.First(fam => fam.FamilyId == p.FamilyId); p.SetRecReg().MedicalDescription = person.allergies; p.SetRecReg().Emcontact = person.emergencyName; p.SetRecReg().Emphone = person.emergencyPhone.Truncate(50); var fsb = new List <ChangeDetail>(); f.UpdateValue(fsb, "AddressLineOne", person.address); f.UpdateValue(fsb, "AddressLineTwo", person.address2); f.UpdateValue(fsb, "CityName", person.city); f.UpdateValue(fsb, "StateCode", person.state); f.UpdateValue(fsb, "ZipCode", person.zipCode); f.UpdateValue(fsb, "CountryName", person.country); f.LogChanges(NewContext, fsb, p.PeopleId, CurrentDatabase.UserPeopleId ?? 0); person.fillFamily(f); NewContext.SubmitChanges(); AddEditPersonResults results = new AddEditPersonResults { familyID = f.FamilyId, peopleID = p.PeopleId, positionID = p.PositionInFamilyId, barcodeID = CmsData.Person.Barcode(CurrentDatabase, p.PeopleId) }; Message response = new Message(); response.setNoError(); response.count = 1; response.data = SerializeJSON(results); return(response); }
private void detach_StmtPeople(Person entity) { this.SendPropertyChanging(); entity.ContributionStatementOption = null; }
public List <Label> getLabels(AttendanceCacheSet cacheSet) { List <Label.Type> labelTypes = new List <Label.Type>(); List <Label> labels = new List <Label>(); CmsData.Person person = cacheSet.getPerson(peopleID); // Create label type list if (groups.Count > 0 && hasAttends(cacheSet)) { // TODO: Client size option for age cutoff for Name Tag. Server will override and will send it to the client and disable field if ((person.Age ?? 0) < cacheSet.nameTagAge) { labelTypes.Add(Label.Type.MAIN); foreach (AttendanceGroup group in groups) { Organization org = cacheSet.getOrganization(group.groupID); if (org != null && org.NumCheckInLabels > 1 && group.present) { for (int iX = 0; iX < org.NumCheckInLabels - 1; iX++) { labelTypes.Add(Label.Type.EXTRA); } } } if (hasVisits(cacheSet)) { if (cacheSet.guestLabels) { foreach (AttendanceGroup _ in getVisitGroups(cacheSet)) { labelTypes.Add(Label.Type.GUEST); } } if (cacheSet.locationLabels) { labelTypes.Add(Label.Type.LOCATION); } } switch (cacheSet.securityLabels) { // case SECURITY_LABELS_NONE: 0 = No Security Labels // case SECURITY_LABELS_PER_FAMILY: Security Label Per Family (Handled outside this routine) case SECURITY_LABELS_PER_MEETING: { for (int iX = 0; iX < groups.Count; iX++) { labelTypes.Add(Label.Type.SECURITY); } break; } case SECURITY_LABELS_PER_CHILD: { labelTypes.Add(Label.Type.SECURITY); break; } } } else { labelTypes.Add(Label.Type.NAME_TAG); } } // Generate labels from type list foreach (Label.Type labelType in labelTypes) { if (labelType == Label.Type.GUEST) { labels.AddRange(Label.generate(cacheSet, labelType, this, getVisitGroups(cacheSet).ToList())); } else { labels.AddRange(Label.generate(cacheSet, labelType, this, groups)); } } return(labels); }
private void UpdateField(List<ChangeDetail> psb, Person p, string prop, object value) { p.UpdateValue(psb, prop, value); }
private void UpdateField(Person p, string[] a, string prop, string s, object value) { if (names.ContainsKey(s)) if (value != null) p.UpdateValue(psb, prop, value); }
private void detach_People(Person entity) { this.SendPropertyChanging(); entity.MemberStatus = null; }
private void detach_People(Person entity) { this.SendPropertyChanging(); entity.Campu = null; }