Example #1
0
        Task IWorkdayGrain.PutWorkday(Workday source)
        {
            if (source.Month < 1 || source.Month > 12)
            {
                throw new ValidationException(String.Format("咱这可没{0}月份唉!", source.Month));
            }
            if (source.Days < 1 || source.Days > 31)
            {
                throw new ValidationException("躺平和加班一样糟糕,最好对标法定工作日哦!");
            }

            Workday workday = Kernel[source.Month];

            if (workday.Days == 0)
            {
                workday.Apply(Workday.Set(p => p.Days, source.Days));
                workday.InsertSelf();
            }
            else
            {
                workday.UpdateSelf(source);
            }

            return(Task.CompletedTask);
        }