本文整理汇总了C#中Calendar.ShouldNotBeNull方法的典型用法代码示例。如果您正苦于以下问题:C# Calendar.ShouldNotBeNull方法的具体用法?C# Calendar.ShouldNotBeNull怎么用?C# Calendar.ShouldNotBeNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar.ShouldNotBeNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCalendarRule
/// <summary>
/// <paramref name="calendar"/>의 Rules 컬렉션에 <paramref name="rule"/>을 추가합니다.
/// </summary>
/// <param name="calendar"></param>
/// <param name="rule"></param>
public void AddCalendarRule(Calendar calendar, CalendarRule rule)
{
calendar.ShouldNotBeNull("calendar");
rule.ShouldNotBeNull("rule");
rule.Calendar = calendar;
if(calendar.Rules.Contains(rule) == false)
calendar.Rules.Add(rule);
Session.SaveOrUpdate(calendar);
Session.SaveOrUpdate(rule);
}
示例2: CreateHolyDayCalendarRule
/// <summary>
/// 특정 날짜를 공휴일로 지정하는 룰을 만듭니다.
/// </summary>
/// <param name="calendar"></param>
/// <param name="holyday"></param>
/// <returns></returns>
public CalendarRule CreateHolyDayCalendarRule(Calendar calendar, DateTime holyday)
{
calendar.ShouldNotBeNull("calendar");
if(log.IsDebugEnabled)
log.Debug(@"Calendar[{0}] 에 공휴일에 대한 Rule을 추가합니다 공휴일=[{1}]", calendar.Code, holyday);
var rule = new CalendarRule(calendar, "Holyday");
rule.RulePeriod.Setup(holyday.StartTimeOfDay(), holyday.EndTimeOfDay());
rule.DayOrException = 0;
rule.IsWorking = 0;
rule.ViewOrder = rule.DayOrException;
calendar.Rules.Add(rule);
Session.SaveOrUpdate(rule);
return rule;
}
示例3: CreateCalendarRule
/// <summary>
/// 특정 Calendar에 CalendarRule을 새로 만든다.
/// </summary>
/// <param name="calendar"></param>
/// <param name="name"></param>
/// <param name="dayOfWeek"></param>
/// <param name="isWorking"></param>
/// <param name="timePeriod"></param>
/// <returns></returns>
public CalendarRule CreateCalendarRule(Calendar calendar, string name, DayOfWeek dayOfWeek, int? isWorking, ITimePeriod timePeriod)
{
calendar.ShouldNotBeNull("calendar");
if(log.IsDebugEnabled)
log.Debug(@"새로운 CalendarRule (Working Time 규칙)을 생성합니다... " +
@"calendar={0}, name={1}, dayOfWeek={2}, isWorking={3}, timePeriod={4}",
calendar, name, dayOfWeek, isWorking, timePeriod);
var rule = new CalendarRule(calendar, name);
if(timePeriod != null && timePeriod.IsAnytime == false)
rule.RulePeriod.Setup(timePeriod.StartAsNullable, timePeriod.EndAsNullable);
rule.DayOrException = dayOfWeek.GetHashCode() + 1;
rule.IsWorking = isWorking;
calendar.Rules.Add(rule);
Session.SaveOrUpdate(calendar);
return Repository<CalendarRule>.SaveOrUpdate(rule);
}
示例4: ClearCalendarRulesOf
/// <summary>
/// 지정된 Calendar에 속한 모든 Calendar Rule을 삭제합니다.
/// </summary>
/// <param name="calendar"></param>
public void ClearCalendarRulesOf(Calendar calendar)
{
calendar.ShouldNotBeNull("calendar");
if(log.IsDebugEnabled)
log.Debug(@"Calendar의 모든 규칙 정보(CalendarRule)를 삭제합니다... " + calendar);
// 안해도 cascade delete가 된다.
//foreach(var rule in calendar.Rules.ToArray())
// Repository<CalendarRule>.Delete(rule);
calendar.Rules.Clear();
Repository<Calendar>.SaveOrUpdate(calendar);
}
示例5: FindOneWorkTimeByDayByWorkDay
/// <summary>
/// ������ ��¥�� WorkTimeByDay ������ �ε��մϴ�.
/// </summary>
/// <param name="calendar">DayCalendar�� ���� Calendar ����</param>
/// <param name="workDay">�˻��� ��¥</param>
/// <returns></returns>
public WorkTimeByDay FindOneWorkTimeByDayByWorkDay(Calendar calendar, DateTime workDay)
{
calendar.ShouldNotBeNull("calendar");
if(log.IsDebugEnabled)
log.Debug("Load WorkTimeByDay. calendar={0}, day={1}", calendar, workDay);
var query = BuildQueryOverOfWorkTimeByDay(calendar.Code, workDay);
return Repository<WorkTimeByDay>.FindOne(query);
}