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


C# Schedule.GetCalenderEvent方法代码示例

本文整理汇总了C#中Schedule.GetCalenderEvent方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.GetCalenderEvent方法的具体用法?C# Schedule.GetCalenderEvent怎么用?C# Schedule.GetCalenderEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schedule的用法示例。


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

示例1: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        private void ShowReadonlyDetails( Schedule schedule )
        {
            SetEditMode( false );
            hfScheduleId.SetValue( schedule.Id );
            lReadOnlyTitle.Text = schedule.Name.FormatAsHtmlTitle();

            var calendarEvent = schedule.GetCalenderEvent();
            string occurrenceText = string.Empty;
            if ( calendarEvent != null )
            {
                if ( calendarEvent.DTStart != null )
                {
                    var occurrences = calendarEvent.GetOccurrences( RockDateTime.Now, RockDateTime.Now.AddYears( 1 ) );
                    if ( occurrences.Any() )
                    {
                        occurrenceText = GetOccurrenceText( occurrences[0] );
                    }
                }
            }

            DescriptionList descriptionList = new DescriptionList()
                .Add( "Description", schedule.Description ?? string.Empty )
                .Add( "Next Occurrence", occurrenceText )
                .Add( "Category", schedule.Category != null ? schedule.Category.Name : string.Empty );

            if ( schedule.CheckInStartOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Starts", schedule.CheckInStartOffsetMinutes.Value.ToString() + " minutes before start of schedule" );
            }

            if ( schedule.CheckInEndOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Ends", schedule.CheckInEndOffsetMinutes.Value.ToString() + " minutes after start of schedule" );
            }

            lblMainDetails.Text = descriptionList.Html;
        }
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:41,代码来源:ScheduleDetail.ascx.cs

示例2: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        private void ShowReadonlyDetails( Schedule schedule )
        {
            SetEditMode( false );
            hfScheduleId.SetValue( schedule.Id );
            lReadOnlyTitle.Text = schedule.Name.FormatAsHtmlTitle();

            var calendarEvent = schedule.GetCalenderEvent();
            string occurrenceText = string.Empty;
            if ( calendarEvent != null )
            {
                if ( calendarEvent.DTStart != null )
                {
                    var occurrences = calendarEvent.GetOccurrences( DateTime.Now.Date, DateTime.Now.Date.AddYears( 1 ) );
                    if ( occurrences.Any() )
                    {
                        var occurrence = occurrences[0];

                        if ( occurrence.Period.StartTime.Value.Date.Equals( occurrence.Period.EndTime.Value.Date ) )
                        {
                            occurrenceText += string.Format( "{0} - {1} to {2} ( {3} hours)", occurrence.Period.StartTime.Value.Date.ToShortDateString(), occurrence.Period.StartTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.EndTime.Value.TimeOfDay.ToTimeString(), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
                        }
                        else
                        {
                            occurrenceText += string.Format( "<li>{0} to {1} ( {2} hours) </li>", occurrence.Period.StartTime.Value.ToString( "g" ), occurrence.Period.EndTime.Value.ToString( "g" ), occurrence.Period.Duration.TotalHours.ToString( "#0.00" ) );
                        }
                    }
                }
            }

            DescriptionList descriptionList = new DescriptionList()
                .Add( "Description", schedule.Description ?? string.Empty )
                .Add( "Next Occurrence", occurrenceText )
                .Add( "Category", schedule.Category != null ? schedule.Category.Name : string.Empty );

            if ( schedule.CheckInStartOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Starts", schedule.CheckInStartOffsetMinutes.Value.ToString() + " minutes before start of schedule" );
            }

            if ( schedule.CheckInEndOffsetMinutes.HasValue )
            {
                descriptionList.Add( "Check-in Ends", schedule.CheckInEndOffsetMinutes.Value.ToString() + " minutes after start of schedule" );
            }

            lblMainDetails.Text = descriptionList.Html;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:50,代码来源:ScheduleDetail.ascx.cs


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