Exemple #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);
        }