private void detach_RelatedFamilies2(RelatedFamily entity) { this.SendPropertyChanging(); entity.RelatedFamily2 = null; }
private void attach_RelatedFamilies1(RelatedFamily entity) { this.SendPropertyChanging(); entity.RelatedFamily1 = this; }
public RelatedFamily AddRelated(CMSDataContext db, int pid) { var p2 = db.LoadPersonById(pid); var rf = db.RelatedFamilies.SingleOrDefault(r => (r.FamilyId == FamilyId && r.RelatedFamilyId == p2.FamilyId) || (r.FamilyId == p2.FamilyId && r.RelatedFamilyId == FamilyId) ); if (rf == null) { rf = new RelatedFamily { FamilyId = FamilyId, RelatedFamilyId = p2.FamilyId, FamilyRelationshipDesc = "", CreatedBy = Util.UserId1, CreatedDate = Util.Now, }; db.RelatedFamilies.InsertOnSubmit(rf); db.SubmitChanges(); } return rf; }
public static string AddRelatedFamily(int peopleid, int relatedPersonId) { var p = DbUtil.Db.LoadPersonById(peopleid); var p2 = DbUtil.Db.LoadPersonById(relatedPersonId); var rf = DbUtil.Db.RelatedFamilies.SingleOrDefault(r => (r.FamilyId == p.FamilyId && r.RelatedFamilyId == p2.FamilyId) || (r.FamilyId == p2.FamilyId && r.RelatedFamilyId == p.FamilyId) ); if (rf == null) { rf = new RelatedFamily { FamilyId = p.FamilyId, RelatedFamilyId = p2.FamilyId, FamilyRelationshipDesc = "", CreatedBy = Util.UserId1, CreatedDate = Util.Now, }; DbUtil.Db.RelatedFamilies.InsertOnSubmit(rf); DbUtil.Db.SubmitChanges(); } return "#rf-{0}-{1}".Fmt(rf.FamilyId, rf.RelatedFamilyId); }
public static void AddRelatedFamily(int familyId, int relatedPersonId) { var p = DbUtil.Db.LoadPersonById(relatedPersonId); var rf = DbUtil.Db.RelatedFamilies.SingleOrDefault(r => (r.FamilyId == familyId && r.RelatedFamilyId == p.FamilyId) || (r.FamilyId == p.FamilyId && r.RelatedFamilyId == familyId) ); if (rf == null) { rf = new RelatedFamily { FamilyId = familyId, RelatedFamilyId = p.FamilyId, FamilyRelationshipDesc = "Add Description", CreatedBy = Util.UserId1, CreatedDate = Util.Now, }; DbUtil.Db.RelatedFamilies.InsertOnSubmit(rf); DbUtil.Db.SubmitChanges(); } }