예제 #1
0
        public static FamilyModel FromTblFamilies(TblFamilies tblFamilies)
        {
            FamilyModel familyModel = new FamilyModel()
            {
                FamilyId         = tblFamilies.FamilyId,
                FamilyUUID       = tblFamilies.FamilyUUID,
                InsureeId        = tblFamilies.InsureeId,
                InsureeUUID      = tblFamilies.Insuree.InsureeUUID,
                LocationId       = TypeCast.GetValue <int>(tblFamilies.LocationId),
                Poverty          = TypeCast.GetValue <bool>(tblFamilies.Poverty),
                FamilyType       = tblFamilies.FamilyType,
                FamilyAddress    = tblFamilies.FamilyAddress,
                Ethnicity        = tblFamilies.Ethnicity,
                ConfirmationNo   = tblFamilies.ConfirmationNo,
                ConfirmationType = tblFamilies.ConfirmationType,
                IsOffline        = TypeCast.GetValue <bool>(tblFamilies.IsOffline),
                Insurees         = tblFamilies.TblInsuree
                                   .Where(i => i.ValidityTo == null)
                                   .Select(i => InsureeModel.FromTblInsuree(i))
                                   .ToList(),
                FamilySMS = tblFamilies.TblFamilySMS.Where(sms => sms.ValidityTo == null).Select(s => FamilySMS.FromTblFamilySMS(s)).LastOrDefault()
            };

            return(familyModel);
        }
예제 #2
0
        public static InsureeModel FromTblInsuree(TblInsuree tblInsuree)
        {
            if (tblInsuree == null)
            {
                return(null);
            }

            InsureeModel insuree = new InsureeModel()
            {
                InsureeId            = tblInsuree.InsureeId,
                InsureeUUID          = tblInsuree.InsureeUUID,
                IdentificationNumber = tblInsuree.Passport,
                CHFID               = tblInsuree.Chfid,
                LastName            = tblInsuree.LastName,
                OtherNames          = tblInsuree.OtherNames,
                DOB                 = tblInsuree.Dob.ToString("yyyy-MM-dd"),
                IsHead              = tblInsuree.IsHead,
                Phone               = tblInsuree.Phone,
                Gender              = tblInsuree.Gender,
                Marital             = tblInsuree.Marital,
                TypeOfId            = tblInsuree.TypeOfId,
                CardIssued          = tblInsuree.CardIssued,
                Email               = tblInsuree.Email,
                CurrentAddress      = tblInsuree.CurrentAddress,
                GeoLocation         = tblInsuree.GeoLocation,
                IdentificationTypes = tblInsuree.TypeOfId
            };

            if (tblInsuree.Relationship != null)
            {
                insuree.Relationship = (short)tblInsuree.Relationship;
            }

            if (tblInsuree.Profession != null)
            {
                insuree.Profession = TypeCast.GetValue <short>(tblInsuree.Profession);
            }

            if (tblInsuree.Education != null)
            {
                insuree.Education = TypeCast.GetValue <short>(tblInsuree.Education);
            }

            if (tblInsuree.Hfid != null)
            {
                insuree.HFID = (short)tblInsuree.Hfid;
            }

            if (tblInsuree.CurrentVillage != null)
            {
                insuree.CurVillage = tblInsuree.CurrentVillage.ToString();
            }

            if (tblInsuree.IsOffline != null)
            {
                insuree.IsOffline = (bool)tblInsuree.IsOffline;
            }

            if (tblInsuree.Photo != null)
            {
                insuree.PhotoPath = tblInsuree.Photo.PhotoFileName;
            }

            return(insuree);
        }