/// <summary> /// Generate a new L File in format L-XXX-YYY using the lease id. Add the lease id and lfileno to the passed lease. /// </summary> /// <param name="context"></param> public static PimsLease GenerateLFileNo(this PimsContext context, PimsLease lease) { Int64 leaseId = GetNextLeaseSequenceValue(context); lease.LeaseId = leaseId; lease.LFileNo = $"L-{lease.LeaseId.ToString().PadLeft(6, '0').Insert(3, "-")}"; return(lease); }
public void GetExpiryDate_null() { PimsLease lease = new PimsLease() { OrigExpiryDate = null, PimsLeaseTerms = null }; Assert.Null(lease.GetExpiryDate()); }
public void GetExpiryDate_OrigExpiry() { DateTime now = DateTime.Now; PimsLease lease = new PimsLease() { OrigExpiryDate = now, PimsLeaseTerms = null }; Assert.Equal(now, lease.GetExpiryDate()); }
public void GetExpiryDate_TermExpiry() { DateTime now = DateTime.Now; PimsLease lease = new PimsLease() { OrigExpiryDate = null, PimsLeaseTerms = new List <PimsLeaseTerm>() { new PimsLeaseTerm() { TermExpiryDate = now } } }; Assert.Equal(now, lease.GetExpiryDate()); }
public void GetExpiryDate_OrigExpiryLater() { DateTime now = DateTime.Now; DateTime later = now.AddDays(1); PimsLease lease = new PimsLease() { OrigExpiryDate = later, PimsLeaseTerms = new List <PimsLeaseTerm>() { new PimsLeaseTerm() { TermExpiryDate = now } } }; Assert.Equal(later, lease.GetExpiryDate()); }