Ejemplo n.º 1
0
        public bool DeleteMemberRelation(int memID)                     //Delete all relation of a member
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var delQuery = from Relationship in db.Relationships
                           where Relationship.person1ID == memID || Relationship.person2ID == memID
                           select Relationship;

            db.Relationships.DeleteAllOnSubmit(delQuery);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 2
0
        public bool DeleteMember(int memID)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var delQuery = (from Member in db.Members
                            where Member.memID == memID
                            select Member).Single();

            db.Members.DeleteOnSubmit(delQuery);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 3
0
        public bool DeleteRelation(int p1ID, int p2ID)                 //Delete a specific relation satisfy p1ID and p2ID
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var delQuery = from Relationship in db.Relationships
                           where Relationship.person1ID == p1ID && Relationship.person2ID == p2ID || Relationship.person1ID == p2ID && Relationship.person2ID == p1ID
                           select Relationship;

            db.Relationships.DeleteAllOnSubmit(delQuery);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 4
0
        public bool DeleteParentage(int pID)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var delQuery = from Parentage in db.Parentages
                           where Parentage.pID == pID
                           select Parentage;

            db.Parentages.DeleteAllOnSubmit(delQuery);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 5
0
        public bool InsertParentage(int pID, string pName)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            Parentage newParentage         = new Parentage();

            newParentage.pID   = pID;
            newParentage.pName = pName;
            db.Parentages.InsertOnSubmit(newParentage);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 6
0
        public bool InsertRelation(int mem1ID, int mem2ID, string relation, int pID)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            Relationship newRelation       = new Relationship();

            newRelation.person1ID   = mem1ID;
            newRelation.person2ID   = mem2ID;
            newRelation.relation    = relation;
            newRelation.parentageID = pID;
            db.Relationships.InsertOnSubmit(newRelation);
            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 7
0
        public bool ModifyRelation(int p1ID, int p2ID, string relation, int pID)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var modQuery = (from Relationship in db.Relationships
                            where Relationship.person1ID == p1ID && Relationship.person2ID == p2ID
                            select Relationship).Single();

            if (modQuery != null)
            {
                modQuery.relation    = relation;
                modQuery.parentageID = pID;
                db.SubmitChanges();
            }
            return(true);
        }
Ejemplo n.º 8
0
        public bool ModifyParentage(int pID, string pName)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var modQuery = (from Parentage in db.Parentages
                            where Parentage.pID == pID
                            select Parentage).Single();

            if (modQuery != null)
            {
                modQuery.pID   = pID;
                modQuery.pName = pName;
                db.SubmitChanges();
            }
            return(true);
        }
Ejemplo n.º 9
0
        public bool ModifyMember(int memID, string name, string rustic, string gender, DateTime dob, DateTime dod, string curAdd)
        {
            FamilyManagementDataContext db = new FamilyManagementDataContext();
            var modQuery = (from Member in db.Members
                            where Member.memID == memID
                            select Member).Single();

            if (modQuery != null)
            {
                modQuery.memName = name;
                modQuery.memID   = memID;
                modQuery.rustic  = rustic;
                modQuery.gender  = gender;
                modQuery.dob     = dob;
                modQuery.dod     = dod;
                modQuery.address = curAdd;
                db.SubmitChanges();
            }
            return(true);
        }