PlanningGraduateDateHelper.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace EMIS.Utility
  6. {
  7. public static class PlanningGraduateDateHelper
  8. {
  9. public static DateTime GetPlanningGraduateDate(DateTime schoolYear)
  10. {
  11. if (schoolYear.Month >= 1 && schoolYear.Month <= 6)
  12. {
  13. int month = Convert.ToInt32(EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnMonth);
  14. int day = Convert.ToInt32(EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnDay);
  15. return new DateTime(schoolYear.Year, month, day);
  16. }
  17. else
  18. {
  19. int month=Convert.ToInt32(EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringMonth);
  20. int day=Convert.ToInt32( EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringDay);
  21. return new DateTime((schoolYear.Year + 1), month, day);
  22. }
  23. //dt = dt + new TimeSpan((schoolYear.WeeksNum - 1) * 7, 0, 0, 0);
  24. //DateTime dtime = dt.AddDays((int)dt.DayOfWeek - 1);
  25. // return dtime;
  26. }
  27. }
  28. }