/// <summary> /// Creates a new instance of a BuildingFiscal class, initializes it with the specified arguments. /// </summary> /// <param name="building"></param> /// <param name="fiscalYear"></param> /// <param name="key"></param> /// <param name="value"></param> public BuildingFiscal(Building building, int fiscalYear, FiscalKeys key, decimal value) { this.BuildingId = building?.Id ?? throw new ArgumentNullException(nameof(building)); this.Building = building; this.FiscalYear = fiscalYear; this.Key = key; this.Value = value; }
/// <summary> /// Creates a new instance of a ParcelFiscal class, initializes it with the specified arguments. /// </summary> /// <param name="parcel"></param> /// <param name="fiscalYear"></param> /// <param name="key"></param> /// <param name="value"></param> public ParcelFiscal(Parcel parcel, int fiscalYear, FiscalKeys key, decimal value) { this.ParcelId = parcel?.Id ?? throw new ArgumentNullException(nameof(parcel)); this.Parcel = parcel; this.FiscalYear = fiscalYear; this.Key = key; this.Value = value; }
/// <summary> /// Get the current fiscal year for the specified 'key'. /// </summary> /// <param name="building"></param> /// <param name="key"></param> /// <returns></returns> public static int?GetCurrentFiscalYear(this Building building, FiscalKeys key) { return(building.Fiscals.FirstOrDefault(f => f.FiscalYear == DateTime.Now.GetFiscalYear() && f.Key == key)?.FiscalYear); }
/// <summary> /// Get the most recent fiscal year for the specified 'key'. /// </summary> /// <param name="building"></param> /// <param name="key"></param> /// <returns></returns> public static int?GetMostRecentFiscalYear(this Building building, FiscalKeys key) { return(building.Fiscals.OrderByDescending(f => f.FiscalYear).FirstOrDefault(f => f.Key == key)?.FiscalYear); }
/// <summary> /// Get the current fiscal year for the specified 'key'. /// </summary> /// <param name="building"></param> /// <param name="key"></param> /// <returns></returns> public static int?GetCurrentFiscalYear(this Parcel parcel, FiscalKeys key) { return(parcel.Fiscals.FirstOrDefault(f => f.FiscalYear == DateTime.Now.GetFiscalYear() && f.Key == key)?.FiscalYear); }
/// <summary> /// Get the most recent fiscal year for the specified 'key'. /// </summary> /// <param name="parcel"></param> /// <param name="key"></param> /// <returns></returns> public static int?GetMostRecentFiscalYear(this Parcel parcel, FiscalKeys key) { return(parcel.Fiscals.OrderByDescending(f => f.FiscalYear).FirstOrDefault(f => f.Key == key)?.FiscalYear); }