using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Data; |
using System.Drawing; |
using System.Linq; |
using System.Text; |
using System.Windows.Forms; |
using IMMC.XPExplorerBar; |
using IMMC.Forms; |
using IMMC.Business; |
using IMMC.Data; |
using IMMC.Properties; |
using IMMC.Forms.Properties; |
using System.Data.SqlClient; |
using System.Windows.Forms.DataVisualization.Charting; |
using Telerik.WinControls.UI; |
using Telerik.WinControls.UI.Scheduler; |
using Telerik.WinControls.UI.Scheduler.Dialogs; |
namespace IMMC |
{ |
public partial class frmRadControls : Form |
{ |
public frmRadControls() |
{ |
InitializeComponent(); |
} |
private List<MyAppointment> appointments = new List<MyAppointment>(); |
protected override void OnLoad(EventArgs e) |
{ |
base.OnLoad(e); |
DateTime baseDate = DateTime.Today; |
DateTime[] start = new DateTime[] { baseDate.AddHours(14.0), baseDate.AddDays(1.0).AddHours(9.0), baseDate.AddDays(2.0).AddHours(13.0) }; |
DateTime[] end = new DateTime[] { baseDate.AddHours(16.0), baseDate.AddDays(1.0).AddHours(15.0), baseDate.AddDays(2.0).AddHours(17.0) }; |
string[] summaries = new string[] { "Mr. Brown", "Mr. White", "Mrs. Green" }; |
string[] descriptions = new string[] { "", "", "" }; |
string[] locations = new string[] { "City", "Out of town", "Service Center" }; |
MyAppointment appointment = null; |
for (int i = 0; i < summaries.Length; i++) |
{ |
appointment = new MyAppointment(start[i], end[i], summaries[i], |
descriptions[i], locations[i]); |
this.appointments.Add(appointment); |
} |
//this.radScheduler.AppointmentFactory = new CustomAppointmentFactory(); |
//schedulerBindingDataSource1.EventProvider.AppointmentFactory = radScheduler.AppointmentFactory; |
} |
private void radButton_Click(object sender, EventArgs e) |
{ |
SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); |
AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); |
appointmentMappingInfo.Start = "Start"; |
appointmentMappingInfo.End = "End"; |
appointmentMappingInfo.Summary = "Subject"; |
appointmentMappingInfo.Description = "Description"; |
appointmentMappingInfo.Location = "Location"; |
appointmentMappingInfo.UniqueId = "Id"; |
SchedulerMapping idMapping = appointmentMappingInfo.FindByDataSourceProperty("Id"); |
//idMapping.ConvertToDataSource = new ConvertCallback(this.ConvertIdToDataSource); |
//idMapping.ConvertToScheduler = new ConvertCallback(this.ConvertIdToScheduler); |
dataSource.EventProvider.Mapping = appointmentMappingInfo; |
dataSource.EventProvider.DataSource = this.appointments; |
this.radScheduler.DataSource = dataSource; |
} |
} |
} |
2.RadSchedulerThis control how to display the database data