/// <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); }