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


C# IDateTime类代码示例

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


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

示例1: EvaluateToPreviousOccurrence

        public void EvaluateToPreviousOccurrence(IDateTime completedDate, IDateTime currDt)
        {
            IDateTime beginningDate = completedDate.Copy<IDateTime>();

            if (Todo.RecurrenceRules != null)
            {
                foreach (IRecurrencePattern rrule in Todo.RecurrenceRules)
                    DetermineStartingRecurrence(rrule, ref beginningDate);
            }
            if (Todo.RecurrenceDates != null)
            {
                foreach (IPeriodList rdate in Todo.RecurrenceDates)
                    DetermineStartingRecurrence(rdate, ref beginningDate);
            }
            if (Todo.ExceptionRules != null)
            {
                foreach (IRecurrencePattern exrule in Todo.ExceptionRules)
                    DetermineStartingRecurrence(exrule, ref beginningDate);
            }
            if (Todo.ExceptionDates != null)
            {
                foreach (IPeriodList exdate in Todo.ExceptionDates)
                    DetermineStartingRecurrence(exdate, ref beginningDate);
            }

            Evaluate(Todo.Start, DateUtil.GetSimpleDateTimeData(beginningDate), DateUtil.GetSimpleDateTimeData(currDt).AddTicks(1), true);
        }
开发者ID:SpivEgin,项目名称:ndef-nfc,代码行数:27,代码来源:TodoEvaluator.cs

示例2: PurchaseController

 /// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="paymentRepo">Payment repository</param>
 public PurchaseController(CourseController courseCtrl,
     MyCourseController myCourseCtrl,
     IUserProfileRepository userProfileRepo,
     IClassRoomRepository classRoomRepo,
     IClassCalendarRepository classCalendarRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     IUserActivityRepository userActivityRepo,
     IPaymentRepository paymentRepo,
     IOptions<AppConfigOptions> appConfig,
     IOptions<ErrorMessageOptions> errorMsgs,
     ILoggerFactory loggerFactory,
     IPayment payment,
     IDateTime dateTime)
 {
     _courseCtrl = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
     _userprofileRepo = userProfileRepo;
     _classRoomRepo = classRoomRepo;
     _classCalendarRepo = classCalendarRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _userActivityRepo = userActivityRepo;
     _paymentRepo = paymentRepo;
     _dateTime = dateTime;
     _appConfig = appConfig.Value;
     _errorMsgs = errorMsgs.Value;
     _logger = loggerFactory.CreateLogger<PurchaseController>();
     _payment = payment;
 }
开发者ID:teerachail,项目名称:mindsage2016,代码行数:39,代码来源:PurchaseController.cs

示例3: EvaluateRRule

 /// <summary>
 /// Evaulates the RRule component, and adds each specified Period
 /// to the <see cref="Periods"/> collection.
 /// </summary>
 /// <param name="FromDate">The beginning date of the range to evaluate.</param>
 /// <param name="ToDate">The end date of the range to evaluate.</param>
 virtual protected void EvaluateRRule(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
 {
     // Handle RRULEs
     if (Recurrable.RecurrenceRules != null &&
         Recurrable.RecurrenceRules.Count > 0)
     {
         foreach (IRecurrencePattern rrule in Recurrable.RecurrenceRules)
         {
             IEvaluator evaluator = rrule.GetService(typeof(IEvaluator)) as IEvaluator;
             if (evaluator != null)
             {
                 IList<IPeriod> periods = evaluator.Evaluate(referenceDate, periodStart, periodEnd, includeReferenceDateInResults);
                 foreach (IPeriod p in periods)
                 {
                     if (!Periods.Contains(p))
                         Periods.Add(p);
                 }
             }
         }
     }
     else if (includeReferenceDateInResults)
     {
         // If no RRULEs were found, then we still need to add
         // the initial reference date to the results.
         IPeriod p = new Period(referenceDate.Copy<IDateTime>());
         if (!Periods.Contains(p))
             Periods.Add(p);
     }
 }
开发者ID:logikonline,项目名称:DDay.iCal,代码行数:35,代码来源:RecurringEvaluator.cs

示例4: QuestionVM

 public QuestionVM(
     IDateTime dateTime, 
     IDictionaryEntryPicker dictionaryEntryPicker)
 {
     _dateTime = dateTime;
     _dictionaryEntryPicker = dictionaryEntryPicker;
 }
开发者ID:ntrhieu89,项目名称:ChineseCharacterTrainer,代码行数:7,代码来源:QuestionVM.cs

示例5: Evaluate

        public override IList<IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd, bool includeReferenceDateInResults)
        {
            Dictionary<IPeriod , bool> periodLookup = new Dictionary<IPeriod, bool>();

            List<IPeriod> periods = new List<IPeriod>();

            if (includeReferenceDateInResults)
            {
                IPeriod p = new Period(referenceDate);
                if (!periodLookup.ContainsKey(p))
                {
                    periodLookup.Add(p , true);
                    periods.Add(p);
                }
            }

            if (periodEnd < periodStart)
                return periods;

            foreach (IPeriod p in m_PeriodList)
            {
                if (!periodLookup.ContainsKey(p))
                {
                    periodLookup.Add(p, true);
                    periods.Add(p);
                }
            }

            return periods;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:30,代码来源:PeriodListEvaluator.cs

示例6: MatchTimeZone

        public static IDateTime MatchTimeZone(IDateTime dt1, IDateTime dt2)
        {
            Debug.Assert(dt1 != null && dt2 != null);

            // Associate the date/time with the first.
            IDateTime copy = dt2.Copy<IDateTime>();
            copy.AssociateWith(dt1);

            // If the dt1 time does not occur in the same time zone as the
            // dt2 time, then let's convert it so they can be used in the
            // same context (i.e. evaluation).
            if (dt1.TZID != null)
            {
                if (!string.Equals(dt1.TZID, copy.TZID))
                    return (dt1.TimeZoneObservance != null) ? copy.ToTimeZone(dt1.TimeZoneObservance.Value) : copy.ToTimeZone(dt1.TZID);
                else return copy;
            }
            else if (dt1.IsUniversalTime)
            {
                // The first date/time is in UTC time, convert!
                return new iCalDateTime(copy.UTC);
            }
            else
            {
                // The first date/time is in local time, convert!
                return new iCalDateTime(copy.Local);
            }
        }
开发者ID:SpivEgin,项目名称:ndef-nfc,代码行数:28,代码来源:DateUtil.cs

示例7: EventOccurrenceTest

        private void EventOccurrenceTest(
            IICalendar iCal,
            IDateTime fromDate,
            IDateTime toDate,
            IDateTime[] dateTimes,
            string[] timeZones,
            int eventIndex
        )
        {
            IEvent evt = iCal.Events[eventIndex];
            fromDate.AssociatedObject = iCal;
            toDate.AssociatedObject = iCal;

            IList<Occurrence> occurrences = evt.GetOccurrences(
                fromDate,
                toDate);

            Assert.AreEqual(
                dateTimes.Length,
                occurrences.Count,
                "There should be exactly " + dateTimes.Length + " occurrences; there were " + occurrences.Count);

            for (int i = 0; i < dateTimes.Length; i++)
            {
                // Associate each incoming date/time with the calendar.
                dateTimes[i].AssociatedObject = iCal;

                IDateTime dt = dateTimes[i];
                Assert.AreEqual(dt, occurrences[i].Period.StartTime, "Event should occur on " + dt);
                if (timeZones != null)
                    Assert.AreEqual(timeZones[i], dt.TimeZoneName, "Event " + dt + " should occur in the " + timeZones[i] + " timezone");
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:33,代码来源:RecurrenceTest.cs

示例8: LessonController

 /// <summary>
 /// Initialize lesson controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="friendRequestRepo">Friend request repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="notificationCtrl">Notificaotion API</param>
 /// <param name="config">App configuration option</param>
 public LessonController(IClassCalendarRepository classCalendarRepo,
     IUserProfileRepository userprofileRepo,
     IClassRoomRepository classRoomRepo,
     ILikeLessonRepository likeLessonRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     ICommentRepository commentRepo,
     IFriendRequestRepository friendRequestRepo,
     IUserActivityRepository userActivityRepo,
     NotificationController notificationCtrl,
     IOptions<AppConfigOptions> options,
     ILessonTestResultRepository lessonTestResultRepo,
     IDateTime dateTime)
 {
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo = userprofileRepo;
     _classRoomRepo = classRoomRepo;
     _likeLessonRepo = likeLessonRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _commentRepo = commentRepo;
     _friendRequestRepo = friendRequestRepo;
     _userActivityRepo = userActivityRepo;
     _notificationCtrl = notificationCtrl;
     _appConfig = options.Value;
     _dateTime = dateTime;
     _lessonTestResultRepo = lessonTestResultRepo;
 }
开发者ID:teerachail,项目名称:mindsage2016,代码行数:39,代码来源:LessonController.cs

示例9: ProcessOccurrences

        void ProcessOccurrences(IDateTime referenceDate)
        {
            //// Sort the occurrences by start time
            //m_Occurrences.Sort(
            //    delegate(Occurrence o1, Occurrence o2)
            //    {
            //        if (o1.Period == null || o1.Period.StartTime == null)
            //            return -1;
            //        else if (o2.Period == null || o2.Period.StartTime == null)
            //            return 1;
            //        else return o1.Period.StartTime.CompareTo(o2.Period.StartTime);
            //    }
            //);

            for (int i = 0; i < m_Occurrences.Count; i++)
            {
                Occurrence curr = m_Occurrences.Values[i];
                Occurrence? next = i < m_Occurrences.Count - 1 ? (Occurrence?)m_Occurrences.Values[i + 1] : null;

                // Determine end times for our periods, overwriting previously calculated end times.
                // This is important because we don't want to overcalculate our time zone information,
                // but simply calculate enough to be accurate.  When date/time ranges that are out of
                // normal working bounds are encountered, then occurrences are processed again, and
                // new end times are determined.
                if (next != null && next.HasValue)
                {
                    curr.Period.EndTime = next.Value.Period.StartTime.AddTicks(-1);
                }
                else
                {
                    curr.Period.EndTime = ConvertToIDateTime(EvaluationEndBounds, referenceDate);
                }
            }
        }
开发者ID:devcrafting,项目名称:DDay.iCal,代码行数:34,代码来源:TimeZoneEvaluator.cs

示例10: MyCourseController

 /// <summary>
 /// Initialize comment controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="studentKeyRepo">Student key repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="contractRepo">Contract repository</param>
 /// <param name="likeCommentRepo">Like comment repository</param>
 /// <param name="likeDiscussionRepo">Like discussion repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="courseCatalogRepo">Course catalog repository</param>
 public MyCourseController(IClassCalendarRepository classCalendarRepo,
     IUserProfileRepository userprofileRepo,
     IUserActivityRepository userActivityRepo,
     IClassRoomRepository classRoomRepo,
     IStudentKeyRepository studentKeyRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     ILikeLessonRepository likeLessonRepo,
     ILikeCommentRepository likeCommentRepo,
     ILikeDiscussionRepository likeDiscussionRepo,
     IContractRepository contractRepo,
     ICourseCatalogRepository courseCatalogRepo,
     ILoggerFactory loggerFactory,
     IDateTime dateTime)
 {
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo = userprofileRepo;
     _userActivityRepo = userActivityRepo;
     _classRoomRepo = classRoomRepo;
     _studentKeyRepo = studentKeyRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _likeLessonRepo = likeLessonRepo;
     _likeCommentRepo = likeCommentRepo;
     _likeDiscussionRepo = likeDiscussionRepo;
     _contractRepo = contractRepo;
     _courseCatalogRepo = courseCatalogRepo;
     _logger = loggerFactory.CreateLogger<MyCourseController>();
     _dateTime = dateTime;
 }
开发者ID:teerachail,项目名称:mindsage2016,代码行数:42,代码来源:MyCourseController.cs

示例11: GetOccurrences

        static public IList<Occurrence> GetOccurrences(IRecurrable recurrable, IDateTime periodStart, IDateTime periodEnd, bool includeReferenceDateInResults)
        {
            List<Occurrence> occurrences = new List<Occurrence>();

            IEvaluator evaluator = recurrable.GetService(typeof(IEvaluator)) as IEvaluator;
            if (evaluator != null)
            {
                // Change the time zone of periodStart/periodEnd as needed 
                // so they can be used during the evaluation process.
                periodStart = DateUtil.MatchTimeZone(recurrable.Start, periodStart);
                periodEnd = DateUtil.MatchTimeZone(recurrable.Start, periodEnd);

                IList<IPeriod> periods = evaluator.Evaluate(
                    recurrable.Start,
                    DateUtil.GetSimpleDateTimeData(periodStart),
                    DateUtil.GetSimpleDateTimeData(periodEnd),
                    includeReferenceDateInResults);

                foreach (IPeriod p in periods)
                {
                    // Filter the resulting periods to only contain those 
                    // that occur sometime between startTime and endTime.
                    // NOTE: fixes bug #3007244 - GetOccurences not returning long spanning all-day events 
                    IDateTime endTime = p.EndTime ?? p.StartTime;
                    if (endTime.GreaterThan(periodStart) && p.StartTime.LessThanOrEqual(periodEnd))
                        occurrences.Add(new Occurrence(recurrable, p));
                }

                occurrences.Sort();
            }
            return occurrences;
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:32,代码来源:RecurrenceUtil.cs

示例12: HomeController

 public HomeController(
     IReviewRepository reviewRepository,
     IDateTime now)
 {
     _reviewRepository = reviewRepository;
     _now = now;
 }
开发者ID:ahaydara,项目名称:html5_learning,代码行数:7,代码来源:HomeController.cs

示例13: StartOfDay

 public static IDateTime StartOfDay(IDateTime dt)
 {
     return dt.
         AddHours(-dt.Hour).
         AddMinutes(-dt.Minute).
         AddSeconds(-dt.Second);
 }
开发者ID:SpivEgin,项目名称:ndef-nfc,代码行数:7,代码来源:DateUtil.cs

示例14: StartTaskWorkflowProcessor

 public StartTaskWorkflowProcessor(ITaskByIdQueryProcessor taskByIdQueryProcessor,
 IUpdateTaskStatusQueryProcessor updateTaskStatusQueryProcessor, IAutoMapper autoMapper,IDateTime dateTime)
 {
     _taskByIdQueryProcessor = taskByIdQueryProcessor;
     _updateTaskStatusQueryProcessor = updateTaskStatusQueryProcessor;
     _autoMapper = autoMapper;
     _dateTime = dateTime;
 }
开发者ID:Defcoq,项目名称:Enterprise.Dev.Best.Practices,代码行数:8,代码来源:StartTaskWorkflowProcessor.cs

示例15: GetOccurrences

 static public IList<Occurrence> GetOccurrences(IRecurrable recurrable, IDateTime dt, bool includeReferenceDateInResults)
 {
     return GetOccurrences(
         recurrable, 
         new iCalDateTime(dt.Local.Date), 
         new iCalDateTime(dt.Local.Date.AddDays(1).AddSeconds(-1)),
         includeReferenceDateInResults);
 }
开发者ID:logikonline,项目名称:DDay.iCal,代码行数:8,代码来源:RecurrenceUtil.cs


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