Ejemplo n.º 1
0
        /// <summary>
        /// Calclulates a date when the next proposal can be submitted.
        ///
        /// </summary>
        /// <returns>void</returns>
        public DateTime Get_NextSubmitDate()
        {
            DateTime       ReturnValue;
            DateTime       LastSubmit;
            PFoundationRow CurrentFoundationRow;

            LastSubmit = Get_LastSubmittedDate();

            if (LastSubmit == DateTime.MinValue)
            {
                ReturnValue = PossibleDate(DateTime.Today);
            }
            else
            {
                ReturnValue          = PossibleDate(LastSubmit);
                CurrentFoundationRow = (PFoundationRow)(FCurrentFoundationDV[0].Row);

                if (CurrentFoundationRow.SubmitFrequency == "Bi-Annually")
                {
                    LastSubmit = LastSubmit.AddYears(2);

                    if (LastSubmit > DateTime.Today)
                    {
                        ReturnValue = PossibleDate(LastSubmit);
                    }
                    else
                    {
                        ReturnValue = PossibleDate(DateTime.Today);
                    }
                }
                else if (CurrentFoundationRow.SubmitFrequency == "Annually")
                {
                    LastSubmit = LastSubmit.AddYears(1);

                    if (LastSubmit > DateTime.Today)
                    {
                        ReturnValue = PossibleDate(LastSubmit);
                    }
                    else
                    {
                        ReturnValue = PossibleDate(DateTime.Today);
                    }
                }
                else if (CurrentFoundationRow.SubmitFrequency == "No Restrictions")
                {
                    ReturnValue = PossibleDate(DateTime.Today);

                    if (LastSubmit > PreviousDate(DateTime.Today))
                    {
                        ReturnValue = PossibleDate(ReturnValue.AddDays(1));
                    }
                }
                else
                {
                    throw new EOutOfRangeException(
                              "Submit frequency \"" + CurrentFoundationRow.SubmitFrequency + "\" must be bi-annually, annually or no restrictions.",
                              "Invalid Submit Frequency");
                }
            }

            return(ReturnValue);
        }