Esempio n. 1
0
        public List <WCP_FamilyCompleteData> GetEntireMemberList(WCP_FamilyCompleteData _family)
        {
            List <WCP_FamilyCompleteData> familyList = new List <WCP_FamilyCompleteData>();

            if (_family.firstName != null || _family.lastName != null || _family.dob != null || _family.familyNo != 0)
            {
                var familyMember = familyEntity.tbl_Family.Where(obj1 =>
                                                                 familyEntity.tbl_familyRelation.Any(obj2 =>
                                                                                                     obj1.firstName == _family.firstName || obj1.lastName == _family.lastName || obj1.dob == _family.dob || (obj2.familyNo == _family.familyNo && obj1.familyMemberId == obj2.familyMemId)));

                foreach (var item in familyMember)
                {
                    WCP_FamilyCompleteData familyobj = new WCP_FamilyCompleteData();
                    familyobj.suffix         = item.suffix;
                    familyobj.familyMemberId = item.familyMemberId;
                    familyobj.firstName      = item.firstName;
                    familyobj.middleName     = item.middleName;
                    familyobj.lastName       = item.lastName;
                    familyobj.dob            = item.dob;
                    familyobj.gender         = item.gender;
                    familyobj.memberCategory = item.memberCategory;
                    familyobj.familyNo       = familyEntity.tbl_familyRelation.Where(obj1 => obj1.familyMemId == item.familyMemberId).FirstOrDefault().familyNo;

                    familyList.Add(familyobj);
                }
            }
            return(familyList);
        }
Esempio n. 2
0
        public List <WCP_FamilyCompleteData> Search(WCP_FamilyCompleteData _family)
        {
            List <WCP_FamilyCompleteData> familyList = new List <WCP_FamilyCompleteData>();
            List <tbl_Family>             families   = families = familyEntity.tbl_Family.ToList();

            if (_family.firstName != null || _family.lastName != null || _family.dob.Date != DateTime.MinValue || _family.familyNo != 0)
            {
                if (_family.firstName != null)
                {
                    families = familyEntity.tbl_Family.Where(obj => obj.firstName == _family.firstName).ToList();
                }
                if (_family.lastName != null)
                {
                    families = families.Where(obj => obj.lastName == _family.lastName).ToList();
                }
                if (_family.dob != DateTime.MinValue)
                {
                    families = families.Where(obj => obj.dob == _family.dob).ToList();
                }
                if (_family.familyNo != 0)
                {
                    int familyMemberId = familyEntity.tbl_familyRelation.Where(obj1 => obj1.familyNo == _family.familyNo).FirstOrDefault().familyMemId;
                    families = families.Where(obj => obj.familyMemberId == familyMemberId).ToList();
                }

                foreach (var item in families)
                {
                    WCP_FamilyCompleteData family = new WCP_FamilyCompleteData();
                    family.familyMemberId = item.familyMemberId;
                    family.suffix         = item.suffix;
                    family.firstName      = item.firstName;
                    family.middleName     = item.middleName;
                    family.lastName       = item.lastName;
                    family.dob            = item.dob;
                    family.gender         = item.gender;
                    family.memberCategory = item.memberCategory;
                    family.familyNo       = familyEntity.tbl_familyRelation.Where(obj1 => obj1.familyMemId == item.familyMemberId).FirstOrDefault().familyNo;
                    familyList.Add(family);
                }
            }
            return(familyList);
        }