Esempio n. 1
0
        /// <summary>
        /// Adds number of years in this fiscal year
        /// </summary>
        /// <param name="value">Number of years to add</param>
        /// <returns>Fiscal year</returns>
        public FiscalYear AddYear(int value)
        {
            DateTime newH1FY = H1FY.AddYears(value);
            DateTime newH2FY = H2FY.AddYears(value);

            FiscalYear fy = new FiscalYear(newH1FY.Year, newH2FY.Year);

            return(fy);
        }
Esempio n. 2
0
        /// <summary>
        /// Converts a hyphen seperated string fiscal year (i.e. "2015-2016") to FiscalYear object
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static FiscalYear Parse(string input)
        {
            if (String.IsNullOrWhiteSpace(input))
            {
                throw new ArgumentException(input);
            }

            string[] years = input.Split('-');
            if (years.Length == 0 || years.Length > 2)
            {
                throw new FormatException("Invalid string format provided");
            }

            int h1fy = years[0].ToInt();
            int h2fy = years[1].ToInt();

            var fy = new FiscalYear(h1fy, h2fy);

            return(fy);
        }