コード例 #1
0
        public PeriodViewModel GetPeriod(int periodId)
        {
            PeriodViewModel period = new PeriodViewModel();

            if (periodId == 1)
            {
                period.PeriodType   = PeriodType.Daily;
                period.IsRange      = false;
                period.SelectedDate = DateTime.Now;
            }
            else if (periodId == 2)
            {
                period.PeriodType = PeriodType.Daily;
                period.IsRange    = true;
                period.StartDate  = DateTime.Now;
                period.EndDate    = DateTime.Now.AddDays(1);
            }
            else if (periodId == 3)
            {
                period.PeriodType = PeriodType.Daily;
                period.IsRange    = true;
                period.StartDate  = DateTime.Now;
                period.EndDate    = DateTime.Now.AddDays(7);
            }
            else if (periodId == 4)
            {
                period.PeriodType = PeriodType.Monthly;
                period.IsRange    = true;
                period.StartYear  = DateTime.Now.Year;
                period.StartMonth = DateTime.Now.Month;
                period.EndYear    = DateTime.Now.AddMonths(1).Year;
                period.EndMonth   = DateTime.Now.AddMonths(1).Month;
            }
            else if (periodId == 5)
            {
                period.IsForever = true;
            }
            return(period);
        }
コード例 #2
0
 public PeriodViewModel GetPeriod(int periodId)
 {
     PeriodViewModel period = new PeriodViewModel();
     if (periodId == 1)
     {
         period.PeriodType = PeriodType.Daily;
         period.IsRange = false;
         period.SelectedDate = DateTime.Now;
     }
     else if (periodId == 2)
     {
         period.PeriodType = PeriodType.Daily;
         period.IsRange = true;
         period.StartDate = DateTime.Now;
         period.EndDate = DateTime.Now.AddDays(1);
     }
     else if (periodId == 3)
     {
         period.PeriodType = PeriodType.Daily;
         period.IsRange = true;
         period.StartDate = DateTime.Now;
         period.EndDate = DateTime.Now.AddDays(7);
     }
     else if (periodId == 4)
     {
         period.PeriodType = PeriodType.Monthly;
         period.IsRange = true;
         period.StartYear = DateTime.Now.Year;
         period.StartMonth = DateTime.Now.Month;
         period.EndYear = DateTime.Now.AddMonths(1).Year;
         period.EndMonth = DateTime.Now.AddMonths(1).Month;
     }
     else if (periodId == 5)
     {
         period.IsForever = true;
     }
     return period;
 }