internal Tenant CopyFrom(TenantTbl tenantTbl, int requestCount = 0, PropertyTbl propertyTbl = null)
 {
     return(new Tenant(
                CopyFrom(propertyTbl),
                JsonConvert.DeserializeObject <PersonContactInfo> (tenantTbl.ContactInfo),
                tenantTbl.UnitNumber,
                tenantTbl.DateCreated,
                tenantTbl.ID)
     {
         RequestsNum = requestCount //   tenantTbl.Requests?.Count() ?? 0,
     });
 }
Exemple #2
0
        internal Property CopyFrom(PropertyTbl p)
        {
            var prop = new Property(new RegisterPropertyCommand(p.Name, p.ID, p.Address, p.PhoneNumber,
                                                                p.Superintendent,
                                                                JsonConvert.DeserializeObject <List <string> >(p.Units),
                                                                p.NoReplyEmailAddress),
                                    p.DateCreated,
                                    p.IdCreated)
            {
            };

            return(prop);
        }
        //-----------------------------------------------------------
        internal PropertyTbl CopyFrom(Property prop)
        {
            var propTbl = new PropertyTbl(prop.Code)
            {
                Address             = JsonConvert.SerializeObject(prop.Address),
                Name                = prop.Name,
                PhoneNumber         = prop.PhoneNumber,
                Units               = JsonConvert.SerializeObject(prop.Units),
                Superintendent      = JsonConvert.SerializeObject(prop.Superintendent),
                NoReplyEmailAddress = prop.NoReplyEmailAddress,
                DateCreated         = prop.DateCreated,
                IdCreated           = prop.Id
            };

            return(propTbl);
        }
        //----- Requests
        internal TenantRequest CopyFrom(TenantRequestTbl r, TenantTbl tenantTbl, int requestCount, PropertyTbl propertyTbl)
        {
            TenantRequestStatusEnum reqStatus = (TenantRequestStatusEnum)Enum.Parse(typeof(TenantRequestStatusEnum), r.RequestStatus);
            var req =
                new TenantRequest(
                    CopyFrom(tenantTbl, requestCount, propertyTbl), r.Code, reqStatus, r.DateCreated, r.ID)
            {
                RequestChanges = r.RequestChanges == null ? null : DeserializeObject(r.RequestChanges),

                ServiceWorkOrderCount = r.ServiceWorkOrderCount,
            };

            return(req);
        }