An appointment represents a period of time and detailed information about events that will take place during that period of time. Appointments can span from a specified duration, such as 30 minutes, to multi-day events, and can be set either in code or by binding to a data source, or at run time, either through the context menu or by clicking a specified time on the schedule.
The code snippet below depicts creating an appointment:
C# |
Copy Code
|
---|---|
// Add a new appointment. C1.C1Schedule.Appointment app; app = this.c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(); // Set some details for the appointment. app.Subject = "Meeting"; app.Location = "Large Conference Room"; app.Duration = TimeSpan.FromMinutes(45); app.Start = new DateTime(2021, 11, 01, 13, 30, 0); // Assign a predefined label to the appointment. app.Label = this.c1Schedule1.DataStorage.LabelStorage.Labels[6]; // Assign a predefined availability to the appointment. app.BusyStatus = this.c1Schedule1.DataStorage.StatusStorage.Statuses[C1.C1Schedule.StatusTypeEnum.Tentative]; // Assign a category to the appointment. C1.C1Schedule.Category category; category = this.c1Schedule1.DataStorage.CategoryStorage.Categories[15]; app.Categories.Add(category); // Create the Digital Projector resource. C1.C1Schedule.ResourceCollection rescol; rescol = this.c1Schedule1.DataStorage.ResourceStorage.Resources; C1.C1Schedule.Resource roomres = new C1.C1Schedule.Resource(); roomres.Text = "Digital Projector"; // Insert the resource into the Master Resource List. rescol.Insert(0, roomres); // Assign the resource to the appointment. app.Resources.Add(roomres); |
Appointments that span a specific duration will appear on the schedule during that duration when in DayView, WeekView, or WorkWeekView views. In the MonthView view, the appointment will appear on the calendar with the time and subject of the appointment.
At run time, an appointment can be created through the Appointment dialog box by setting the Start time and End time drop-downs to the duration of the appointment. For more information on creating appointments at run time, see Working with Appointments.
Appointments that are either an all-day event or a multi-day event will appear on the schedule in the area above the schedule when in DayView, WeekView, or WorkWeekView view. For example, the appointment below represents an all-day event.
In the MonthView view, the appointment will appear on the calendar with the subject of the appointment within a box.
Setting an All-Day Appointment
Appointments can be created in code or at run time through the Appointment dialog box. The following code, added to the Form_Load event, creates a new all-day appointment:
C# |
Copy Code
|
---|---|
// Create a new appointment. C1.C1Schedule.Appointment app1 = this.c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(); // Make the appointment an all day event. app1.Start = new DateTime(2021, 11, 02, 13, 30, 0); app1.AllDayEvent = true; // Set some details for the appointment. app1.Subject = "Training"; app1.Location = "Large Conference Room"; // Assign a custom label to the appointment. app1.Label = new C1.C1Schedule.Label(Color.DeepSkyBlue, "Meeting", "Meeting"); // Create the contact. C1.C1Schedule.ContactCollection contcol; contcol = this.c1Schedule1.DataStorage.ContactStorage.Contacts; C1.C1Schedule.Contact contact = new C1.C1Schedule.Contact(); contact.Text = "John Smith"; // Insert the contact into the Master Contact List. contcol.Insert(0, contact); app1.Links.Add(contact); // Create the Meetings category. C1.C1Schedule.CategoryCollection catcol; catcol = this.c1Schedule1.DataStorage.CategoryStorage.Categories; C1.C1Schedule.Category meetings = new C1.C1Schedule.Category(); meetings.Text = "Meetings"; // Insert the Meetings category into the Master Category List. catcol.Insert(0, meetings); category = this.c1Schedule1.DataStorage.CategoryStorage.Categories[0]; app1.Categories.Add(category); |
At run time, an appointment can be created through the Appointment dialog box by checking the All day event check box. For more information on creating appointments at run time, see Working with Appointments.