本文整理汇总了C#中DayOfWeek.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# DayOfWeek.GetHashCode方法的具体用法?C# DayOfWeek.GetHashCode怎么用?C# DayOfWeek.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DayOfWeek
的用法示例。
在下文中一共展示了DayOfWeek.GetHashCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalendarViewFormat
/// <summary>
/// Initializes a new instance of the <see cref="CalendarViewFormat"/> class.
/// </summary>
/// <param name="viewType">Type of the view.</param>
/// <param name="showday">The showday.</param>
/// <param name="weekStartDay">The week start day.</param>
public CalendarViewFormat(CalendarViewType viewType, DateTime showday,DayOfWeek weekStartDay)
{
int index, w;
switch (viewType)
{
case CalendarViewType.day: //日
StartDate = showday.Date;
EndDate = showday.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
break;
case CalendarViewType.week: // 周
index = weekStartDay.GetHashCode();//0
w = index - showday.DayOfWeek.GetHashCode();//0-1
if (w > 0) w = w - 7;
StartDate = showday.AddDays(w).Date;
EndDate = StartDate.AddDays(6).AddHours(23).AddMinutes(59).AddSeconds(59);
break;
case CalendarViewType.month: // 月
DateTime firstdate = new DateTime(showday.Year, showday.Month,1);
index = weekStartDay.GetHashCode();//0
w = index - firstdate.DayOfWeek.GetHashCode();//0-1
if (w > 0){
w -= 7;
}
StartDate = firstdate.AddDays(w).Date;
EndDate = StartDate.AddDays(34);
if (EndDate.Year == showday.Year && EndDate.Month == showday.Month && EndDate.AddDays(1).Month == EndDate.Month)
{
EndDate = EndDate.AddDays(7);
}
EndDate.AddHours(23).AddMinutes(59).AddSeconds(59);
break;
}
}
示例2: 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);
}
示例3: WriteDay
public void WriteDay(DayOfWeek day)
{
_i2CDriver.DataWriter(new[] { Convert.ToByte(_bitOperator.Int2Bcd(day.GetHashCode())) },
DS1307_REG_DAY);
}
示例4: GetStartOfWeek
/// <summary>
/// 지정된 날짜가 속한 주(week)의 첫번째 요일 (일요일)의 날짜
/// </summary>
/// <param name="time">일자</param>
/// <param name="firstDayOfWeek">한 주의 첫번째 요일</param>
/// <returns>지정된 일자가 속한 주의 첫번째 요일의 일자를 반환한다. 문화권에 따라 한주의 첫번째 요일은 다르다. 한국은 Sunday, ISO 9601로는 Monday이다.</returns>
public static DateTime GetStartOfWeek(this DateTime time, DayOfWeek firstDayOfWeek) {
var add = firstDayOfWeek.GetHashCode() - time.DayOfWeek.GetHashCode();
if(add > 0)
add -= 7;
return time.Date.AddDays(add).Date;
// return time.Date.AddDays(firstDayOfWeek.GetHashCode() - time.DayOfWeek.GetHashCode()).Date;
}
示例5: getHoursByDayOfWeek
public StoreDay getHoursByDayOfWeek(DayOfWeek dayOfWeek)
{
foreach (StoreDay storeDay in storeDayList)
{
if (storeDay.WeekDay == dayOfWeek.GetHashCode())
return storeDay;
}
return null;
}