// ***************************************************************************************************************************
        // ************************************************  METHODS   ***************************************************************
        // ***************************************************************************************************************************

        /// <summary>
        /// Sets the budget control number.
        /// </summary>
        /// <returns>
        /// </returns>
        private string SetBudgetControlNumber()
        {
            try
            {
                return
                    ($@"{RPIO}-{BFY}-{BFY.GetValue().Substring( 2, 2 )}{FundCode}-{FundControlNumber.ToString().PadLeft( 3, '0' )}"
                     + $@"-{DivisionName}-{DivisionControlNumber.ToString().PadLeft( 3, '0' )}"
                     ?? string.Empty);
            }
            catch (Exception ex)
            {
                Fail(ex);
                return(default);
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref = "BudgetFiscalYear"/> class.
 /// </summary>
 /// <param name = "fy" >
 /// The fy <see cref = "BFY"/>
 /// </param>
 public BudgetFiscalYear(BFY fy)
 {
     Record           = new DataBuilder(Source, Provider.SQLite, SetArgs(fy))?.GetRecord();
     FiscalYearId     = new Key(Record, PrimaryKey.FiscalYearId);
     BBFY             = new Element(Record, Field.BBFY);
     EBFY             = new Element(Record, Field.EBFY);
     Availablity      = new Element(Record, Field.Availability);
     FirstYear        = new Element(Record, Field.FirstYear);
     LastYear         = new Element(Record, Field.LastYear);
     Holidays         = new HolidayFactory(Record);
     WorkDays         = new Element(Record, Field.WorkDays);
     WeekDays         = new Element(Record, Field.WeekDays);
     WeekEnds         = new Element(Record, Field.WeekEnds);
     ExpiringYear     = new Element(Record, Field.ExpiringYear);
     StartDate        = new Element(Record, Field.StartDate);
     EndDate          = new Element(Record, Field.EndDate);
     CancellationDate = new Element(Record, Field.CancellationDate);
     Data             = Record?.ToDictionary();
 }
Example #3
0
        // ***************************************************************************************************************************
        // ****************************************************     METHODS   ********************************************************
        // ***************************************************************************************************************************

        /// <summary>
        /// Gets the control number.
        /// </summary>
        /// <param name = "fund" >
        /// The fund.
        /// </param>
        /// <param name = "fy" >
        /// The fy.
        /// </param>
        /// <returns>
        /// </returns>
        private IControlNumber GetControlNumber(IFund fund, IBudgetFiscalYear fy)
        {
            if (fund != null &&
                fy != null)
            {
                try
                {
                    var connection = new ConnectionBuilder(Source.ControlNumbers, Provider.SQLite);

                    var args = new Dictionary <string, object>
                    {
                        [$"{Field.FundCode}"] = fund.GetCode(),
                        [$"{Field.BFY}"]      = BFY.GetFirstYear(),
                        [$"{Field.RcCode}"]   = RC.GetCode()
                    };

                    var sqlstatement = new SqlStatement(connection, args, SQL.SELECT);
                    var query        = new Query(connection, sqlstatement);
                    return(new ControlNumber(query));
                }
                catch (Exception ex)
                {
                    Fail(ex);
                    return(default);
        public override string ToString()
        {
            var yr = BFY.Substring(2, 2);

            return(new StringBuilder($"{Region}-{BFY}-{yr}{FundCode}-0{FundControlNumber}-6{DivisionName}-0{BudgetControlNumber}").ToString());
        }