IAppointmentStatusStorage.CreateNewStatus(Object, String, String) Method
Creates a new status with the specified name, identifier and menu caption.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
id | Object | A Object that is the unique status identifier used in the Appointment.StatusId property. |
displayName | String | A string that is the name of a status to use in appointment status editors. |
menuCaption | String | A string that is the name of a status to use as the menu caption. |
Returns
Type | Description |
---|---|
IAppointmentStatus | An IAppointmentStatus object that is a new status. |
Remarks
A newly created status has the AppointmentStatusType.Custom type.
Example
This code illustrates how to substitute default appointment labels and statuses with your own.
Remove default labels and statuses by calling the Clear method of the AppointmentLabelCollection and AppointmentStatusCollection collections respectively. Subsequently, create a new label using the AppointmentLabelCollection.CreateNewLabel method, specify its AppointmentLabel.Color and add the newly created label to the collection. Create a new appointment status using the AppointmentStatusCollection.CreateNewStatus method, specify its appearance with the AppointmentStatusExtension.SetBrush method and add the newly created status to the collection.
scheduler.Storage.Appointments.Clear();
string[] IssueList = { "Consultation", "Treatment", "X-Ray" };
Color[] IssueColorList = { Color.Ivory, Color.Pink, Color.Plum };
string[] PaymentStatuses = { "Paid", "Unpaid" };
Color[] PaymentColorStatuses = { Color.Green, Color.Red };
IAppointmentLabelStorage labelStorage = scheduler.Storage.Appointments.Labels;
labelStorage.Clear();
int count = IssueList.Length;
for (int i = 0; i < count; i++) {
IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]);
label.SetColor(IssueColorList[i]);
labelStorage.Add(label);
}
AppointmentStatusCollection statusColl = scheduler.Storage.Appointments.Statuses;
statusColl.Clear();
count = PaymentStatuses.Length;
for (int i = 0; i < count; i++) {
AppointmentStatus status = statusColl.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]);
status.SetBrush(new SolidBrush(PaymentColorStatuses[i]));
statusColl.Add(status);
}