예제 #1
0
        //public FamilyModel(TblFamilies tblFamilies):this()
        //{
        //	this.ConvertFromTblFamilies(tblFamilies);
        //}

        public static FamilyModel FromTblFamilies(TblFamilies tblFamilies)
        {
            FamilyModel familyModel = new FamilyModel()
            {
                FamilyId         = tblFamilies.FamilyId,
                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()
            };

            return(familyModel);
        }
예제 #2
0
        public static PhotoModel FromTblPhoto(TblPhotos tblPhoto)
        {
            if (tblPhoto == null)
            {
                return(null);
            }

            PhotoModel photoModel = new PhotoModel()
            {
                PhotoId       = tblPhoto.PhotoId,
                Insuree       = InsureeModel.FromTblInsuree(tblPhoto.TblInsuree.FirstOrDefault()),
                CHFID         = tblPhoto.Chfid,
                PhotoFolder   = tblPhoto.PhotoFolder,
                PhotoFileName = tblPhoto.PhotoFileName,
                OfficerId     = tblPhoto.OfficerId,
                PhotoDate     = tblPhoto.PhotoDate,
                ValidFrom     = tblPhoto.ValidityFrom,
                ValidTo       = TypeCast.GetValue <DateTime>(tblPhoto.ValidityTo)
            };

            return(photoModel);
        }