Back to Devexpress

DxSchedulerRecurrenceSettings.OccurrenceCount Property

blazor-devexpress-dot-blazor-dot-dxschedulerrecurrencesettings.md

latest5.8 KB
Original Source

DxSchedulerRecurrenceSettings.OccurrenceCount Property

Specifies how many times recurrent appointments occur.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public int OccurrenceCount { get; set; }

Property Value

TypeDescription
Int32

An integer value that specifies the number of occurrences.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to OccurrenceCount
DxSchedulerDataStorage

.RecurrenceSettings .OccurrenceCount

|

Remarks

Use the OccurrenceCount property to specify how many times all recurrent appointments occur. To change this count for an individual appointment, use the DxSchedulerRecurrenceInfo.OccurrenceCount property.

The following code snippet specifies an occurrence count for recurrent appointments. The Meeting 1 and Meeting 2 appointments occur 3 times (the RecurrenceSettings.OccurrenceCount property is applied). The Meeting 3 appointment occurs 10 times (the DxSchedulerRecurrenceInfo.OccurrenceCount property is applied).

razor
@using Data

<DxScheduler StartDate="@DateTime.Today" DataStorage="@DataStorage">
    <DxSchedulerWeekView ShowWorkTimeOnly="true" />
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        RecurrenceSettings = new DxSchedulerRecurrenceSettings {
            OccurrenceCount = 3
        },
        AppointmentsSource = RecurrentAppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
}
csharp
using System;

namespace Scheduler.Data
{
    public class Appointment {
        public Appointment() { }
        public int AppointmentType { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Caption { get; set; }
        public string Description { get; set; }
        public string Location { get; set; }
        public int? Label { get; set; }
        public int Status { get; set; }
        public bool AllDay { get; set; }
        public string Recurrence { get; set; }
        public int? ResourceId { get; set; }
        public bool Accepted { get; set; }
    }
}
csharp
using System;
using System.Collections.Generic;
using System.Globalization;

namespace Scheduler.Data {
    public static partial class RecurrentAppointmentCollection {
        public static List<Appointment> GetAppointments() {
            DateTime date = DateTime.Today;
            var dataSource = new List<Appointment>() {
               new Appointment {
                   AppointmentType = 1,
                   Caption = "Meeting 1",
                   StartDate = date + (new TimeSpan(0, 9, 00, 0)),
                   EndDate = date + (new TimeSpan(0, 10, 00, 0)),
                   Label = 5,
                   Status = 4,
                   Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" Frequency =\"1\" Id=\"cd9da802-d166-47d1-a8df-1101fcc50d53\"/>", ToString(date + (new TimeSpan(0, 9, 00, 0))))
               },
               new Appointment {
                   AppointmentType = 1,
                   Caption = "Meeting 2",
                   StartDate = date + (new TimeSpan(1, 12, 00, 0)),
                   EndDate = date + (new TimeSpan(1, 13, 00, 0)),
                   Label = 8,
                   Status = 2,
                   Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" Frequency =\"1\" Id=\"15129fd3-9eb0-4861-8c43-c61844137f17\"/>", ToString(date + (new TimeSpan(1, 12, 00, 0))))
               },
               new Appointment {
                   AppointmentType = 1,
                   Caption = "Meeting 3",
                   StartDate = date + (new TimeSpan(0, 15, 00, 0)),
                   EndDate = date + (new TimeSpan(0, 16, 00, 0)),
                   Label = 10,
                   Status = 1,
                   Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" OccurrenceCount=\"10\" Frequency =\"1\" Id=\"72e3db8f-cdb6-4aaa-afe1-e3c6b80ce995\"/>", ToString(date + (new TimeSpan(0, 15, 00, 0))))
               }
           };
            return dataSource;
        }

        private static string ToString(DateTime dateTime) {
            return dateTime.ToString(CultureInfo.InvariantCulture);
        }
    }
}

See Also

DxSchedulerRecurrenceSettings Class

DxSchedulerRecurrenceSettings Members

DevExpress.Blazor Namespace