本文整理汇总了C#中CmsData.Family类的典型用法代码示例。如果您正苦于以下问题:C# Family类的具体用法?C# Family怎么用?C# Family使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Family类属于CmsData命名空间,在下文中一共展示了Family类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPerson
public ActionResult AddPerson(int id, PersonInfo m)
{
if (!Authenticate())
return Content("not authorized");
DbUtil.LogActivity("checkin AddPerson {0} {1} ({2})".Fmt(m.first, m.last, m.dob));
CmsData.Family f;
if (id > 0)
f = DbUtil.Db.Families.Single(fam => fam.FamilyId == id);
else
f = new CmsData.Family();
var position = PositionInFamily.Child;
if (Util.Age0(m.dob) >= 18)
if (f.People.Count(per =>
per.PositionInFamilyId == PositionInFamily.PrimaryAdult)
< 2)
position = PositionInFamily.PrimaryAdult;
else
position = PositionInFamily.SecondaryAdult;
var p = Person.Add(f, position,
null, m.first, m.goesby, m.last, m.dob, false, m.gender,
OriginCode.Visit, null);
UpdatePerson(p, m, isNew: true);
return Content(f.FamilyId.ToString() + "." + p.PeopleId);
}
示例2: CheckInFamilyInfo
public CheckInFamilyInfo(Family family)
{
last = family.HeadOfHousehold.LastName;
homePhone = family.HomePhone;
address = family.AddressLineOne;
address2 = family.AddressLineTwo;
city = family.CityName;
state = family.StateCode;
zip = family.ZipCode;
country = family.CountryName;
}
示例3: AddPerson
public ActionResult AddPerson(int id, PersonInfo m)
{
if (!AccountModel.AuthenticateMobile())
return Content("not authorized");
CmsData.Family f;
if (m.addtofamilyid > 0)
f = DbUtil.Db.Families.First(fam => fam.People.Any(pp => pp.PeopleId == m.addtofamilyid));
else
f = new CmsData.Family();
if (m.goesby == "(Null)")
m.goesby = null;
var position = PositionInFamily.Child;
if (m.dob.Age0() >= 18)
if (f.People.Count(per =>
per.PositionInFamilyId == PositionInFamily.PrimaryAdult)
< 2)
position = PositionInFamily.PrimaryAdult;
else
position = PositionInFamily.SecondaryAdult;
var p = Person.Add(f, position,
null, Trim(m.first), Trim(m.goesby), Trim(m.last), m.dob, false, m.gender,
OriginCode.Visit, null);
var z = DbUtil.Db.ZipCodes.SingleOrDefault(zc => zc.Zip == m.zip.Zip5());
if (!m.home.HasValue() && m.cell.HasValue())
m.home = m.cell;
if (m.addtofamilyid == 0)
{
p.Family.HomePhone = m.home.GetDigits();
p.Family.AddressLineOne = m.addr;
p.Family.CityName = z != null ? z.City : null;
p.Family.StateCode = z != null ? z.State : null;
p.Family.ZipCode = m.zip;
}
p.EmailAddress = Trim(m.email);
if (m.cell.HasValue())
p.CellPhone = m.cell.GetDigits();
p.MaritalStatusId = m.marital;
p.GenderId = m.gender;
DbUtil.Db.SubmitChanges();
DbUtil.LogActivity("iPhone AddPerson {0}".Fmt(p.PeopleId));
var meeting = DbUtil.Db.Meetings.Single(mm => mm.MeetingId == id);
Attend.RecordAttendance(p.PeopleId, id, true);
DbUtil.Db.UpdateMeetingCounters(id);
return new RollListResult(meeting, p.PeopleId);
}
示例4: UpdateField
private void UpdateField(List<ChangeDetail> fsb, Family f, string prop, string value)
{
f.UpdateValue(fsb, prop, value);
}
示例5: SetField
private void SetField(Family f, string[] a, string prop, string s, object value)
{
if (names.ContainsKey(s))
if (value != null)
Util.SetProperty(f, prop, value);
}
示例6: UpdateField
private void UpdateField(Family f, string[] a, string prop, string s)
{
if (names.ContainsKey(s))
if (a[names[s]].HasValue())
f.UpdateValue(fsb, prop, a[names[s]]);
}
示例7: Add
public static Person Add(Family fam, int position, Tag tag, string firstname, string nickname, string lastname, string dob, bool Married, int gender, int originId, int? EntryPointId)
{
return Add(fam, position, tag, firstname, nickname, lastname, dob, Married ? 20 : 10, gender, originId, EntryPointId);
}
示例8: AddPerson
public void AddPerson(Person p, int entrypoint)
{
Family f;
if (p == null)
f = new Family
{
AddressLineOne = address,
AddressLineTwo = address2,
CityName = city,
StateCode = state,
ZipCode = zip,
CountryName = country,
HomePhone = homephone,
};
else
f = p.Family;
_Person = Person.Add(f, PositionInFamily.Child,
null, first.Trim(), null, last.Trim(), dob, married == 20, gender ?? 0,
OriginCode.Enrollment, entrypoint);
person.EmailAddress = email.Trim();
person.SendEmailAddress1 = true;
person.SuffixCode = suffix;
person.MiddleName = middle;
person.CampusId = DbUtil.Db.Setting("DefaultCampusId", "").ToInt2();
if (person.Age >= 18)
person.PositionInFamilyId = PositionInFamily.PrimaryAdult;
person.CellPhone = phone.GetDigits();
DbUtil.Db.SubmitChanges();
DbUtil.LogActivity("OnlineReg AddPerson {0}".Fmt(person.PeopleId));
DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, person);
PeopleId = person.PeopleId;
}
示例9: UpdateField
private void UpdateField(StringBuilder fsb, Family f, string prop, string value)
{
f.UpdateValue(fsb, prop, value);
}
示例10: AddPerson
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();
if (Campus.ToInt() > 0)
person.CampusId = Campus.ToInt();
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");
}
示例11: UpdateValue
private void UpdateValue(Family f, string field, object value)
{
var o = Util.GetProperty(f, field);
if (o == null && value == null)
return;
if (o != null && o.Equals(value))
return;
fsb.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>\n", field, o, value ?? "(null)");
Util.SetProperty(f, field, value);
}
示例12: Add
public static Person Add(CMSDataContext Db, bool SendNotices, Family fam, int position, Tag tag, string firstname, string nickname, string lastname, string dob, int MarriedCode, int gender, int originId, int? EntryPointId, bool testing = false)
{
var p = new Person();
p.CreatedDate = Util.Now;
p.CreatedBy = Util.UserId;
Db.People.InsertOnSubmit(p);
p.PositionInFamilyId = position;
p.AddressTypeId = 10;
if (firstname.HasValue())
p.FirstName = firstname.Trim().ToProper().Truncate(25);
else
p.FirstName = "";
if (nickname.HasValue())
p.NickName = nickname.Trim().ToProper().Truncate(15);
if (lastname.HasValue())
p.LastName = lastname.Trim().ToProper().Truncate(30);
else
p.LastName = "?";
p.GenderId = gender;
if (p.GenderId == 99)
p.GenderId = 0;
p.MaritalStatusId = MarriedCode;
DateTime dt;
if (Util.DateValid(dob, out dt))
{
while (dt.Year < 1900)
dt = dt.AddYears(100);
if (dt > Util.Now)
dt = dt.AddYears(-100);
p.BirthDay = dt.Day;
p.BirthMonth = dt.Month;
p.BirthYear = dt.Year;
if (p.GetAge() < 18 && MarriedCode == 0)
p.MaritalStatusId = MaritalStatusCode.Single;
}
else if (DateTime.TryParse(dob, out dt))
{
p.BirthDay = dt.Day;
p.BirthMonth = dt.Month;
if (Regex.IsMatch(dob, @"\d+[-/]\d+[-/]\d+"))
{
p.BirthYear = dt.Year;
while (p.BirthYear < 1900)
p.BirthYear += 100;
if (p.GetAge() < 18 && MarriedCode == 0)
p.MaritalStatusId = MaritalStatusCode.Single;
}
}
p.MemberStatusId = MemberStatusCode.JustAdded;
if (fam == null)
{
fam = new Family();
Db.Families.InsertOnSubmit(fam);
p.Family = fam;
}
else
fam.People.Add(p);
var PrimaryCount = fam.People.Where(c => c.PositionInFamilyId == PositionInFamily.PrimaryAdult).Count();
if (PrimaryCount > 2 && p.PositionInFamilyId == PositionInFamily.PrimaryAdult)
p.PositionInFamilyId = PositionInFamily.SecondaryAdult;
if (tag != null)
tag.PersonTags.Add(new TagPerson { Person = p });
p.OriginId = originId;
p.EntryPointId = EntryPointId;
p.FixTitle();
if (!testing)
Db.SubmitChanges();
if (SendNotices)
{
if (Util.UserPeopleId.HasValue
&& Util.UserPeopleId.Value != Db.NewPeopleManagerId
&& HttpContext.Current.User.IsInRole("Access")
&& !HttpContext.Current.User.IsInRole("OrgMembersOnly")
&& !HttpContext.Current.User.IsInRole("OrgLeadersOnly"))
Task.AddNewPerson(p.PeopleId);
else
Db.Email(Util.SysFromEmail, Db.GetNewPeopleManagers(),
"Just Added Person on " + Db.Host, "{0} ({1})".Fmt(p.Name, p.PeopleId));
}
return p;
}
示例13: AddPerson
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 = AddressInfo.Address1.Disallow(na),
AddressLineTwo = AddressInfo.Address2,
CityName = AddressInfo.City.Disallow(na),
StateCode = AddressInfo.State.Value.Disallow(na),
ZipCode = AddressInfo.Zip.Disallow(na),
CountryName = AddressInfo.Country.Value,
};
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 = CmsData.Person.Add(f, position,
null, First.Trim(), GoesBy, Last.Trim(), dob, false, Gender.Value.ToInt(),
originid, entrypointid);
if (Title.Value.HasValue())
person.TitleCode = Title.Value;
person.EmailAddress = Email.Disallow(na);
person.MaritalStatusId = Marital.Value.ToInt();
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.Db.Refresh(RefreshMode.OverwriteCurrentValues, person);
PeopleId = person.PeopleId;
}
示例14: detach_FamiliesHeaded2
private void detach_FamiliesHeaded2(Family entity)
{
this.SendPropertyChanging();
entity.HeadOfHouseholdSpouse = null;
}
示例15: SplitFamily
public void SplitFamily(CMSDataContext db)
{
var f = new Family
{
CreatedDate = Util.Now,
CreatedBy = Util.UserId1,
AddressLineOne = PrimaryAddress,
AddressLineTwo = PrimaryAddress2,
CityName = PrimaryCity,
StateCode = PrimaryState,
ZipCode = PrimaryZip,
HomePhone = Family.HomePhone
};
var oldf = this.FamilyId;
f.People.Add(this);
db.Families.InsertOnSubmit(f);
db.SubmitChanges();
}