コード例 #1
0
ファイル: Schedule.cs プロジェクト: grayingram/Scheduler
        private List <DateTime> GetDates(string word, int givenyear)
        {
            List <DateTime> dates     = new List <DateTime>();
            int             year      = givenyear;
            int             month     = Lawyer.GetMonth("What numerical month is this " + word + " be taking place?");
            int             startday  = Lawyer.GetDay("What day of the month will this " + word + " start?", month, year);
            int             endday    = Lawyer.GetDay("What day of the month will this " + word + " end?", month, year);
            DateTime        startdate = new DateTime(year, month, startday);
            DateTime        enddate   = new DateTime(year, month, endday);

            dates.Add(startdate);
            dates.Add(enddate);
            return(dates);
        }
コード例 #2
0
ファイル: Manager.cs プロジェクト: grayingram/Scheduler
        public void MakeSchedule()
        {
            int      year     = Lawyer.GetYear("What year is this schedule being made?");
            int      month    = Lawyer.GetMonth("What month of the year: " + year + " do you want to make the schedule for?");
            DateTime date     = new DateTime(year, month, 1);
            string   filename = FormatMonth(date.Month.ToString()) + " " + year.ToString();

            if (Reader.DoesScheduledMonthExist(month, year))
            {
                if (Lawyer.GetYesNo("Do you want to override the current schedule of " + FormatMonth(date.Month.ToString()) + " " + year.ToString() + "?"))
                {
                    WriteFile(date, filename);
                }
            }
            else
            {
                WriteFile(date, filename);
                Creator.AddScheduledMonth(month, year);
            }
        }