Пример #1
0
 /// <summary>
 /// Create a new instance of an Address.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="address"></param>
 /// <param name="unitNumber"></param>
 /// <param name="municipality"></param>
 /// <param name="province"></param>
 /// <param name="district"></param>
 /// <param name="postal"></param>
 /// <returns></returns>
 public static Entity.PimsAddress CreateAddress(long id, string address, string unitNumber, string municipality, Entity.PimsProvinceState province = null, Entity.PimsDistrict district = null, string postal = "V9V9V9")
 {
     province ??= EntityHelper.CreateProvince((short)id, "BC", EntityHelper.CreateCountry((short)id, "CAN"));
     district ??= EntityHelper.CreateDistrict((short)id, "District 1");
     municipality ??= "municipality";
     return(new Entity.PimsAddress(address, unitNumber, municipality, province, district, postal)
     {
         AddressId = id,
         ConcurrencyControlNumber = 1
     });
 }
Пример #2
0
 /// <summary>
 /// Create a new instance of an Address.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="address"></param>
 /// <param name="province"></param>
 /// <param name="district"></param>
 /// <param name="postal"></param>
 /// <returns></returns>
 public static Entity.PimsAddress CreateAddress(this PimsContext context, long id, string address, Entity.PimsProvinceState province = null, Entity.PimsDistrict district = null, string postal = "")
 {
     province ??= context.PimsProvinceStates.FirstOrDefault() ?? throw new InvalidOperationException("Unable to find a province.");
     district ??= context.PimsDistricts.FirstOrDefault() ?? throw new InvalidOperationException("Unable to find a district.");
     return(new Entity.PimsAddress(address, null, "municipality", province, district, postal)
     {
         AddressId = id,
         ConcurrencyControlNumber = 1
     });
 }
Пример #3
0
 /// <summary>
 /// Create a new instance of an Address.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="address"></param>
 /// <param name="unitNumber"></param>
 /// <param name="province"></param>
 /// <param name="district"></param>
 /// <param name="postal"></param>
 /// <returns></returns>
 public static Entity.PimsAddress CreateAddress(long id, string address, Entity.PimsProvinceState province = null, Entity.PimsDistrict district = null, string postal = "V9V9V9")
 {
     return(CreateAddress(id, address, null, null, province, district, postal));
 }