Beispiel #1
0
 /// <summary>
 /// Get the active term end date of this lease.
 /// </summary>
 /// <param name="lease"></param>
 /// <returns></returns>
 public static DateTime?GetCurrentTermEndDate(this Pims.Dal.Entities.PimsLease lease)
 {
     return(GetCurrentTerm(lease)?.TermExpiryDate);
 }
Beispiel #2
0
        /// <summary>
        /// Create a new instance of a Lease.
        /// </summary>
        /// <returns></returns>
        public static Entity.PimsLease CreateLease(int pid, string lFileNo = null, string tenantFirstName = null, string tenantLastName = null, string motiFirstName = null, string motiLastName = null, PimsAddress address = null, bool addTenant = false, bool addProperty = true,
                                                   PimsLeaseProgramType pimsLeaseProgramType = null, PimsLeasePurposeType pimsLeasePurposeType = null, PimsLeaseStatusType pimsLeaseStatusType = null, PimsLeasePayRvblType pimsLeasePayRvblType = null, PimsLeaseCategoryType pimsLeaseCategoryType = null, PimsLeaseInitiatorType pimsLeaseInitiatorType = null, PimsLeaseResponsibilityType pimsLeaseResponsibilityType = null, PimsLeaseLicenseType pimsLeaseLicenseType = null, PimsRegion region = null)
        {
            var lease = new Entity.PimsLease()
            {
                LeaseId = pid,
                LFileNo = lFileNo,
                ConcurrencyControlNumber = 1,
            };
            var person = new Entity.PimsPerson()
            {
                FirstName = tenantFirstName, Surname = tenantLastName
            };

            person.PimsPersonAddresses.Add(new PimsPersonAddress()
            {
                Person = person, Address = address
            });
            var organization = new Entity.PimsOrganization();

            organization.PimsOrganizationAddresses.Add(new PimsOrganizationAddress()
            {
                Organization = organization, Address = address
            });
            if (addProperty)
            {
                lease.PimsPropertyLeases.Add(new PimsPropertyLease()
                {
                    Property = new Entity.PimsProperty()
                    {
                        Pid = pid
                    }, Lease = lease
                });
            }
            lease.MotiContact = $"{motiFirstName} {motiLastName}";
            lease.LeaseProgramTypeCodeNavigation = pimsLeaseProgramType ?? new Entity.PimsLeaseProgramType()
            {
                Id = "testProgramType"
            };
            lease.LeasePurposeTypeCodeNavigation = pimsLeasePurposeType ?? new Entity.PimsLeasePurposeType()
            {
                Id = "testPurposeType"
            };
            lease.LeaseStatusTypeCodeNavigation = pimsLeaseStatusType ?? new Entity.PimsLeaseStatusType()
            {
                Id = "testStatusType"
            };
            lease.LeasePayRvblTypeCodeNavigation = pimsLeasePayRvblType ?? new Entity.PimsLeasePayRvblType()
            {
                Id = "testRvblType"
            };
            lease.LeaseCategoryTypeCodeNavigation = pimsLeaseCategoryType ?? new Entity.PimsLeaseCategoryType()
            {
                Id = "testCategoryType"
            };
            lease.LeaseInitiatorTypeCodeNavigation = pimsLeaseInitiatorType ?? new Entity.PimsLeaseInitiatorType()
            {
                Id = "testInitiatorType"
            };
            lease.LeaseResponsibilityTypeCodeNavigation = pimsLeaseResponsibilityType ?? new Entity.PimsLeaseResponsibilityType()
            {
                Id = "testResponsibilityType"
            };
            lease.LeaseLicenseTypeCodeNavigation = pimsLeaseLicenseType ?? new Entity.PimsLeaseLicenseType()
            {
                Id = "testType"
            };
            if (region != null)
            {
                lease.RegionCodeNavigation = region;
            }
            if (addTenant)
            {
                lease.PimsLeaseTenants.Add(new PimsLeaseTenant(lease, person, organization, new PimsLessorType("tst")));
            }
            return(lease);
        }
Beispiel #3
0
 /// <summary>
 /// Get the active term of this lease.
 /// </summary>
 /// <param name="lease"></param>
 /// <returns></returns>
 public static PimsLeaseTerm GetCurrentTerm(this Pims.Dal.Entities.PimsLease lease)
 {
     return(lease.PimsLeaseTerms.FirstOrDefault(term => term != null && DateTime.Now > term.TermStartDate && DateTime.Now <= term.TermExpiryDate));
 }
Beispiel #4
0
 /// <summary>
 /// Get the full name from the lease's first tenant (person).
 /// </summary>
 /// <param name="lease"></param>
 /// <returns></returns>
 public static string GetMotiName(this Pims.Dal.Entities.PimsLease lease)
 {
     return(lease.MotiContact);
 }
Beispiel #5
0
 /// <summary>
 /// Get the full name from the lease's first tenant (person).
 /// </summary>
 /// <param name="lease"></param>
 /// <returns></returns>
 public static string GetFullName(this Pims.Dal.Entities.PimsLease lease)
 {
     return(lease?.PimsLeaseTenants.FirstOrDefault(t => t != null && t.Person != null)?.Person?.GetFullName());
 }
Beispiel #6
0
 /// <summary>
 /// Get the Program name from the lease's program type description
 /// </summary>
 /// <param name="lease"></param>
 /// <returns></returns>
 public static string GetProgramName(this Pims.Dal.Entities.PimsLease lease)
 {
     return(lease?.LeaseProgramTypeCodeNavigation?.Description);
 }
Beispiel #7
0
        /// <summary>
        /// Create a new instance of a Property.
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="type"></param>
        /// <param name="classification"></param>
        /// <param name="address"></param>
        /// <param name="tenure"></param>
        /// <param name="areaUnit"></param>
        /// <param name="dataSource"></param>
        /// <returns></returns>
        public static Entity.PimsProperty CreateProperty(int pid, int?pin = null, Entity.PimsPropertyType type = null, Entity.PimsPropertyClassificationType classification = null, Entity.PimsAddress address = null, Entity.PimsPropertyTenureType tenure = null, Entity.PimsAreaUnitType areaUnit = null, Entity.PimsDataSourceType dataSource = null, Entity.PimsLease lease = null)
        {
            type ??= EntityHelper.CreatePropertyType("Land");
            classification ??= EntityHelper.CreatePropertyClassificationType("Class");
            address ??= EntityHelper.CreateAddress(pid);
            tenure ??= EntityHelper.CreatePropertyTenureType("Tenure");

            areaUnit ??= EntityHelper.CreatePropertyAreaUnitType("Sqft");
            dataSource ??= EntityHelper.CreateDataSourceType("LIS");
            var property = new Entity.PimsProperty(pid, type, classification, address, new Entity.PimsPropPropTenureType {
                PropertyTenureTypeCodeNavigation = tenure
            }, areaUnit, dataSource, DateTime.UtcNow)
            {
                PropertyId = pid,
                Pin        = pin,
                ConcurrencyControlNumber = 1,
                Location = new NetTopologySuite.Geometries.Point(0, 0)
            };

            if (lease != null)
            {
                lease.PimsPropertyLeases.Add(new Entity.PimsPropertyLease()
                {
                    Property = property, Lease = lease
                });
            }
            return(property);
        }