当前位置: 首页>>代码示例>>C#>>正文


C# DayOfWeek类代码示例

本文整理汇总了C#中DayOfWeek的典型用法代码示例。如果您正苦于以下问题:C# DayOfWeek类的具体用法?C# DayOfWeek怎么用?C# DayOfWeek使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DayOfWeek类属于命名空间,在下文中一共展示了DayOfWeek类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DaysTill

        /// <summary>
        /// Determines the number of days from one DayOfWeek till the next.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="next">The ending DayOfWeek</param>
        /// <returns>the number of days from <paramref name="self"/> to <paramref name="next"/></returns>
        /// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not 
        /// <see cref="DayOfWeekExtensions.InRange"/></exception>
        /// <example>
        /// Debug.Assert(DayOfWeek.Monday.DaysTill(DayOfWeek.Tuesday) == 1);
        /// </example>
        public static int DaysTill(this DayOfWeek self, DayOfWeek next)
        {
            self.CheckRange();
            next.CheckRange();

            return DaysBetween((int)next, (int)self);
        }
开发者ID:ramonsmits,项目名称:Umbrella,代码行数:18,代码来源:DayOfWeekExtensions.cs

示例2: IsWorkingDay

 public bool IsWorkingDay(DayOfWeek dayOfWeek)
 {
     if (dayOfWeek == DayOfWeek.Friday || dayOfWeek == DayOfWeek.Saturday) {
         return false;
     }
     return true;
 }
开发者ID:jbasinger,项目名称:DateTimeExtensions,代码行数:7,代码来源:AR_SAWorkingDayOfWeekStrategy.cs

示例3: FirstDayOfWeekInMonth

 /// <summary>
 /// Returns the first day of week with in the month.
 /// </summary>
 /// <param name="obj">DateTime Base, from where the calculation will be preformed.</param>
 /// <param name="dow">What day of week to find the first one of in the month.</param>
 /// <returns>Returns DateTime object that represents the first day of week with in the month.</returns>
 public static DateTime FirstDayOfWeekInMonth(this DateTime obj, DayOfWeek dow)
 {
     var firstDay = new DateTime(obj.Year, obj.Month, 1);
     int diff = firstDay.DayOfWeek - dow;
     if (diff > 0) diff -= 7;
     return firstDay.AddDays(diff * -1);
 }
开发者ID:joaofx,项目名称:felice,代码行数:13,代码来源:DateTimeExtensions.cs

示例4: GetNextDay

        public static DayOfWeek GetNextDay(DayOfWeek currentDay)
        {
            if ((int)currentDay == 6) 
                return (DayOfWeek)0;

            return (DayOfWeek)(currentDay + 1);
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:7,代码来源:DateHelper.cs

示例5: DaysSince

        /// <summary>
        /// Determines the number of days since one DayOfWeek since the previous.
        /// </summary>
        /// <param name="self">the starting DayOfWeek</param>
        /// <param name="prev">The previous DayOfWeek</param>
        /// <returns>the number of days since <paramref name="self"/> to <paramref name="prev"/></returns>
        /// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not 
        /// <see cref="DayOfWeekExtensions.InRange"/></exception>
        /// <example>
        /// Debug.Assert(DayOfWeek.Tuesday.DaysSince(DayOfWeek.Monday) == 1);
        /// </example>
        public static int DaysSince(this DayOfWeek self, DayOfWeek prev)
        {
            self.CheckRange();
            prev.CheckRange();

            return DaysBetween((int)self, (int)prev);
        }
开发者ID:ramonsmits,项目名称:Umbrella,代码行数:18,代码来源:DayOfWeekExtensions.cs

示例6: ImeDana

        static string ImeDana(DayOfWeek danUTjednu)
        {
            switch (danUTjednu)
            {
                case DayOfWeek.Monday:
                    return "ponedjeljak";
                case DayOfWeek.Tuesday:
                    return "utorak";
                case DayOfWeek.Wednesday:
                    return "srijeda";
                case DayOfWeek.Thursday:
                    return "četvrtak";
                case DayOfWeek.Friday:
                    return "petak";
                case DayOfWeek.Saturday:
                    return "subota";
                case DayOfWeek.Sunday:
                    return "nedjelja";

                // Dopisati grane case za svaki dan u tjednu (DayOfWeek.Tuesday = Utorak, itd.)

                default:
                    return "Neispravan dan u tjednu";
            }
        }
开发者ID:ante87,项目名称:03-KontrolaToka,代码行数:25,代码来源:GrananjeSwitch.cs

示例7:

 public TimelineModel this[DayOfWeek i]
 {
     get
     {
         return Days[(int)i];
     }
 }
开发者ID:jnhaffey,项目名称:Timekeeper,代码行数:7,代码来源:TimesheetModel.cs

示例8: ConvertFirstDayToNumber

    /// <summary>
    /// Convert starting day of week from enum to number - passed to calendar jquery control.
    /// </summary>
    /// <param name="name">Day name</param>
    protected int ConvertFirstDayToNumber(DayOfWeek name)
    {
        switch (name)
        {
            case DayOfWeek.Monday:
                return 1;

            case DayOfWeek.Tuesday:
                return 2;

            case DayOfWeek.Wednesday:
                return 3;

            case DayOfWeek.Thursday:
                return 4;

            case DayOfWeek.Friday:
                return 5;

            case DayOfWeek.Saturday:
                return 6;

            default:
                return 0;
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:30,代码来源:RangeModalCalendar.ascx.cs

示例9: LocationWorkHour

        /// <summary>
        /// Initializes a new instance of the <see cref="LocationWorkHour"/> class.
        /// </summary>
        /// <param name="dayOfWeek">The day of week.</param>
        /// <param name="workHourTimeRange">The work hour time range.</param>
        public LocationWorkHour(DayOfWeek dayOfWeek, TimeRange workHourTimeRange)
        {
            Check.IsNotNull(dayOfWeek, () => DayOfWeek);

            _dayOfWeek = dayOfWeek;
            _workHourTimeRange = workHourTimeRange;
        }
开发者ID:divyang4481,项目名称:REM,代码行数:12,代码来源:LocationWorkHour.cs

示例10: MonthView

        public MonthView()
        {
            SetStyle(ControlStyles.Opaque, true);
            DoubleBuffered = true;

            _dayNamesFormat = "ddd";
            _monthTitleFormat = "MMMM yyyy";
            _selectionMode = MonthViewSelection.Manual;
            _workWeekStart = DayOfWeek.Monday;
            _workWeekEnd = DayOfWeek.Friday;
            _weekStart = DayOfWeek.Sunday;
            _dayNamesVisible = true;
            _dayNamesLength = 2;
            _viewStart = DateTime.Now;
            _itemPadding = new Padding(2);
            _monthTitleColor = SystemColors.ActiveCaption;
            _monthTitleColorInactive = SystemColors.InactiveCaption;
            _monthTitleTextColor = SystemColors.ActiveCaptionText;
            _monthTitleTextColorInactive = SystemColors.InactiveCaptionText;
            _dayBackgroundColor = Color.Empty;
            _daySelectedBackgroundColor = SystemColors.Highlight;
            _dayTextColor = SystemColors.WindowText;
            _daySelectedTextColor = SystemColors.HighlightText;
            _arrowsColor = SystemColors.Window;
            _arrowsSelectedColor = Color.Gold;
            _dayGrayedText = SystemColors.GrayText;
            _todayBorderColor = Color.Maroon;

            UpdateMonthSize();
            UpdateMonths();
        }
开发者ID:NiDaSilva,项目名称:PPE4-STARS-UP,代码行数:31,代码来源:MonthView.cs

示例11: CalendarHighlightRange

 /// <summary>
 /// Creates a new range with the specified information
 /// </summary>
 /// <param name="day"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 public CalendarHighlightRange(DayOfWeek day, TimeSpan startTime, TimeSpan endTime)
     : this()
 {
     _dayOfWeek = day;
     _startTime = startTime;
     _endTime = endTime;
 }
开发者ID:Hujairi,项目名称:CMS,代码行数:13,代码来源:CalendarHighlightRange.cs

示例12: TimeCondition

 internal TimeCondition(ValueType valueType, CounterType counter, uint value, DayOfWeek dayOfWeek)
 {
     ValueType = valueType;
     CounterType = counter;
     Value = value;
     DayOfWeek = dayOfWeek;
 }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:7,代码来源:TimeCondition.cs

示例13: DayOfWeekAnnualReccurance

 public DayOfWeekAnnualReccurance(DayOfWeek dayOfWeek, WeekOfMonth week, Month month, bool substituteWeekend = true)
     : base(substituteWeekend)
 {
     DayOfWeek = dayOfWeek;
     Week = week;
     Month = month;
 }
开发者ID:BishoyDemian,项目名称:BusinessDayCounting,代码行数:7,代码来源:DayOfWeekAnnualReccurance.cs

示例14: TimeSlot

 public TimeSlot(DayOfWeek dayOfWeek, int p1, int p2)
 {
     // TODO: Complete member initialization
     this.dayOfWeek = dayOfWeek;
     this.from = p1;
     this.to = p2;
 }
开发者ID:CBenghi,项目名称:UnnItBooster,代码行数:7,代码来源:TimeSlot.cs

示例15: DayToUint

 public static uint DayToUint(DayOfWeek day)
 {
     for (int i = 0; i < days.Length; i++)
         if (days[i] == day)
             return (uint)i;
     return 0;
 }
开发者ID:davidpet,项目名称:cognitive,代码行数:7,代码来源:Problem.cs


注:本文中的DayOfWeek类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。