public MobileTaskBox populate(CmsData.TaskList tl) { id = tl.Id; name = tl.Name; return this; }
public MobileTask populate(CmsData.Task t) { id = t.Id; ownerID = t.OwnerId; boxID = t.ListId; due = t.Due ?? DateTime.Now; priority = t.Priority ?? 0; description = t.Description ?? ""; status = t.TaskStatus.Description ?? ""; statusID = t.StatusId ?? 0; about = t.AboutName ?? ""; aboutID = t.WhoId ?? 0; if( t.CoOwner != null ) delegated = t.CoOwner.Name ?? ""; delegatedID = t.CoOwnerId ?? 0; notes = t.Notes ?? ""; return this; }
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; }
public CheckInFamilyMember(CmsData.View.CheckinFamilyMember member, int day, int tzOffset) { id = member.Id.Value; age = member.Age.Value; position = member.Position ?? 100; genderID = member.Genderid ?? 0; name = member.Name; Person p = DbUtil.Db.LoadPersonById(id); 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; } } addOrg(member, day, tzOffset); }
public CheckInOrganization(CmsData.View.CheckinFamilyMember familyMember, int day, int tzOffset) { peopleID = familyMember.Id ?? 0; id = familyMember.OrgId.Value; name = familyMember.OrgName; leader = familyMember.Leader; member = familyMember.MemberVisitor == "M"; checkedIn = familyMember.CheckedIn.Value; //labels = familyMember.NumLabels.Value; if (familyMember.Hour.HasValue) { hour = familyMember.Hour.Value; var theirTime = DateTime.Now.AddHours(tzOffset); if (DateTime.Now.DayOfWeek.ToInt() != day) { int dayDiff = day - DateTime.Now.DayOfWeek.ToInt(); if (dayDiff < 0) theirTime = theirTime.AddDays(7 + dayDiff); else theirTime = theirTime.AddDays(dayDiff); } leadTime = (int)familyMember.Hour.Value.Subtract(theirTime).TotalMinutes; } }
public MobileState populate(CmsData.StateLookup state) { code = state.StateCode; name = state.StateName; return this; }
public RollListResult(CmsData.Meeting meeting, int? PeopleId = null) { MeetingId = meeting.MeetingId; OrgId = meeting.OrganizationId; MeetingDate = meeting.MeetingDate.Value; NewPeopleId = PeopleId; }
public MobileCountry populate(CmsData.Country country) { id = country.Id; code = country.Code; description = country.Description; return this; }
public MobileMaritalStatus populate(CmsData.MaritalStatus status) { id = status.Id; code = status.Code; description = status.Description; return this; }
public MobileTaskFull populate(CmsData.Task t) { base.populate(t); // ToDo: Finish population // End ToDo return this; }
public static Value FromValue(CmsData.ExtraValue.Value ptr) { var v = new Value { Name = ptr.Name, Type = ptr.Type, VisibilityRoles = ptr.VisibilityRoles, Codes = ptr.Codes, Order = ptr.Order, Standard = ptr.Standard, Link = ptr.Link }; return v; }
private static string ClassName(CmsData.Organization o) { var lead = o.LeaderName; if (lead.HasValue()) lead = ": " + lead; var loc = o.Location; if (loc.HasValue()) loc = " ({0})".Fmt(loc); var dt1 = o.FirstMeetingDate; var dt2 = o.LastMeetingDate; var dt = ""; if (dt1.HasValue && dt2.HasValue) dt = ", {0:MMM d}-{1:MMM d}".Fmt(dt1, dt2); else if (dt1.HasValue) dt = ", {0:MMM d}".Fmt(dt1); return o.OrganizationName + lead + dt + loc; }
public void addMember(CmsData.View.CheckinFamilyMember newMember, int day, int tzOffset) { if (members.Count == 0) { members.Add(new CheckInFamilyMember(newMember, day, tzOffset)); } else { foreach (var member in members) { if (member.id == newMember.Id) { member.addOrg(newMember, day, tzOffset); return; } } members.Add(new CheckInFamilyMember(newMember, day, tzOffset)); } }
public CheckInOrganization(CmsData.View.CheckinFamilyMember familyMember, int day, int tzOffset) { peopleID = familyMember.Id ?? 0; id = familyMember.OrgId.Value; name = familyMember.OrgName; leader = familyMember.Leader; member = familyMember.MemberVisitor == "M"; checkedIn = familyMember.CheckedIn.Value; //labels = familyMember.NumLabels.Value; Organization orgInfo = DbUtil.Db.Organizations.SingleOrDefault(a => a.OrganizationId == familyMember.OrgId); if (orgInfo != null) { allowOverlap = orgInfo.AllowAttendOverlap; } if (familyMember.Hour.HasValue) { hour = familyMember.Hour.Value; var theirTime = DateTime.Now.AddHours(tzOffset); if (DateTime.Now.DayOfWeek.ToInt() != day) { int dayDiff = day - DateTime.Now.DayOfWeek.ToInt(); if (dayDiff < 0) theirTime = theirTime.AddDays(7 + dayDiff); else theirTime = theirTime.AddDays(dayDiff); } leadTime = (int)familyMember.Hour.Value.Subtract(theirTime).TotalMinutes; } }
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; }
public bool FieldEqual(CmsData.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 CmsData.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 void addOrg(CmsData.View.CheckinFamilyMember member, int day, int tzOffset) { CheckInOrganization org = new CheckInOrganization(member, day, tzOffset); orgs.Add(org); }
public Update(CmsData.Person p) { person = p; family = p.Family; sb = new List<ChangeDetail>(); fsb = new List<ChangeDetail>(); }
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 Update(CmsData.Person p) { person = p; family = p.Family; sb = new StringBuilder(); fsb = new StringBuilder(); }
private bool CreateExtraValueBits(string name, ExtraValue ev, CmsData.ExtraValue.Value v) { if (!name.Contains(":")) return false; var prefix = name.GetCsvToken(1, 2, ":"); var allbits = (from vv in DbUtil.Db.PeopleExtras where vv.Field.StartsWith($"{prefix}:") orderby vv.Field select vv.Field).Distinct().ToList(); if (allbits.Count <= 1) return false; v.Name = prefix; v.Type = "Bits"; v.Codes = allbits; var view = Views.GetViewsView(DbUtil.Db, ExtraValueTable, ExtraValueLocation); view.view.Values.Add(v); view.views.Save(DbUtil.Db); DbUtil.LogActivity($"EV{ExtraValueTable} ConvertToStandard {name}"); return true; }
public static string CreateEmailBody(CmsData.Task task) { var body = new StringBuilder(); body.Append($"Task: {TaskLink(task.Description, task.Id)}<br/>\n"); body.Append($"Created: {task.CreatedOn.FormatDateTm()}<br/>\n"); if (task.Due != null) body.Append($"Due: {task.Due.FormatDate()}<br/>\n"); if (task.StatusId == TaskStatusCode.Declined) body.Append($"Status: {task.TaskStatus.Description} - {task.DeclineReason}<br/>\n"); else body.Append($"Status: {task.TaskStatus.Description}<br/>\n"); body.Append($"About: {PeopleLink(task.AboutWho.Name, task.AboutWho.PeopleId)}<br/>\n"); body.Append($"Owner: {PeopleLink(task.Owner.Name, task.Owner.PeopleId)}<br/>\n"); if (task.CoOwnerId != null) body.Append($"Delegated To: {PeopleLink(task.CoOwner.Name, task.CoOwner.PeopleId)}<br/>\n"); body.Append($"Notes:<br/>\n{PythonModel.Markdown(task.Notes)}"); return body.ToString(); }
public static void NotifyIfNeeded(StringBuilder sb, CmsData.Task task) { if ((sb.Length <= 0) || !task.CoOwnerId.HasValue) return; var from = Util.UserPeopleId.Value == task.OwnerId ? task.Owner : task.CoOwner; var to = from.PeopleId == task.OwnerId ? task.CoOwner : task.Owner; var req = HttpContext.Current.Request; DbUtil.Db.Email(from.EmailAddress, to, $"Task updated by {Util.UserFullName}", CreateEmailBody(task)); }
public static void ChangeTask(StringBuilder sb, CmsData.Task task, string field, object value) { switch (field) { case "Due": { var dt = (DateTime?) value; if (dt.HasValue) { if ((task.Due.HasValue && (task.Due.Value != dt)) || !task.Due.HasValue) sb.AppendFormat("Due changed from {0:d} to {1:d}<br />\n", task.Due, dt); task.Due = dt; } else { if (task.Due.HasValue) sb.AppendFormat("Due changed from {0:d} to null<br />\n", task.Due); task.Due = null; } } break; case "Notes": if (task.Notes != (string) value) sb.AppendFormat("Notes changed: {{<br />\n{0}<br />}}<br />\n", Util.SafeFormat((string) value)); task.Notes = (string) value; break; case "StatusId": if (task.StatusId != (int) value) { var dict = DbUtil.Db.TaskStatuses.AsEnumerable().ToDictionary(ts => ts.Id, ts => ts.Description); sb.AppendFormat("Task Status changed from {0} to {1}<br />\n", dict[task.StatusId ?? 10], dict[(int) value]); if ((int) value == TaskStatusCode.Complete) task.CompletedOn = Util.Now; else task.CompletedOn = null; } task.StatusId = (int) value; break; case "Description": if (task.Description != (string) value) sb.AppendFormat("Description changed from \"{0}\" to \"{1}\"<br />\n", task.Description, value); task.Description = (string) value; break; case "LimitToRole": if (task.LimitToRole != (string) value) sb.AppendFormat("LimitToRole changed from \"{0}\" to \"{1}\"<br />\n", task.LimitToRole, value); task.LimitToRole = (string) value; break; case "Project": if (task.Project != (string) value) sb.AppendFormat("Project changed from \"{0}\" to \"{1}\"<br />\n", task.Project, value); task.Project = (string) value; break; default: throw new ArgumentException("Invalid field in ChangeTask", field); } }