private void InitAppointments() { AppointmentMappingInfo aptmappings = this.schedulerStorage1.Appointments.Mappings; aptmappings.Start = "StartTime"; aptmappings.End = "EndTime"; aptmappings.Subject = "Subject"; aptmappings.AllDay = "AllDay"; aptmappings.Description = "Description"; aptmappings.Label = "Label"; aptmappings.Location = "Location"; aptmappings.RecurrenceInfo = "RecurrenceInfo"; aptmappings.ReminderInfo = "ReminderInfo"; aptmappings.Status = "Status"; aptmappings.Type = "EventType"; aptmappings.ResourceId = "ResourceID"; ResourceMappingInfo resmappings = this.schedulerStorage1.Resources.Mappings; resmappings.Id = "ResID"; resmappings.Caption = "Name"; resmappings.Color = "ResColor"; GenerateResources(3); GenerateEvents(CustomEventList); this.schedulerStorage1.Appointments.DataSource = CustomEventList; }
public DisplayResultControl() { InitializeComponent(); this.SchedulerControl = this.schedulerControl1; InitHelper.InitResources(CustomResourceCollection); InitHelper.InitAppointments(CustomEventList, CustomResourceCollection); ResourceMappingInfo mappingsResource = this.schedulerStorage1.Resources.Mappings; mappingsResource.Id = "ResID"; mappingsResource.Caption = "Name"; AppointmentMappingInfo mappingsAppointment = this.schedulerStorage1.Appointments.Mappings; mappingsAppointment.Start = "StartTime"; mappingsAppointment.End = "EndTime"; mappingsAppointment.Subject = "Subject"; mappingsAppointment.AllDay = "AllDay"; mappingsAppointment.Description = "Description"; mappingsAppointment.Label = "Label"; mappingsAppointment.Location = "Location"; mappingsAppointment.RecurrenceInfo = "RecurrenceInfo"; mappingsAppointment.ReminderInfo = "ReminderInfo"; mappingsAppointment.ResourceId = "OwnerId"; mappingsAppointment.Status = "Status"; mappingsAppointment.Type = "EventType"; this.schedulerStorage1.Resources.DataSource = CustomResourceCollection; this.schedulerStorage1.Appointments.DataSource = CustomEventList; this.schedulerControl1.Start = DateTime.Now; }
void InitAppointments() { AppointmentMappingInfo mappings = this.schedulerStorage1.Appointments.Mappings; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; // Ppulate the fullDataSource with data items GenerateEvents(fullDataSource); // Local data list that will be populated in the FetchAppointments evet handler CustomEventList actualDataSource = new CustomEventList(); this.schedulerStorage1.Appointments.DataSource = actualDataSource; }
public List <CustomAppointment> InitAppointments() { AppointmentMappingInfo mappings = this.Storage.Appointments.Mappings; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; this.Storage.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("ApptImage1", "Icon1", FieldValueType.Object)); this.Storage.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("ApptImage2", "Icon2", FieldValueType.Object)); this.Storage.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("ApptAddInfo", "AdditionalInfo", FieldValueType.String)); GenerateEvents(CustomEventList, 3); return(CustomEventList); }
private void Form1_Load(object sender, EventArgs e) { InitHelper.InitResources(CustomResourceCollection); InitHelper.InitAppointments(CustomEventList, CustomResourceCollection); ResourceMappingInfo mappingsResource = this.schedulerDataStorage1.Resources.Mappings; mappingsResource.Id = "ResID"; mappingsResource.Caption = "Name"; AppointmentMappingInfo mappingsAppointment = this.schedulerDataStorage1.Appointments.Mappings; mappingsAppointment.Start = "StartTime"; mappingsAppointment.End = "EndTime"; mappingsAppointment.Subject = "Subject"; mappingsAppointment.AllDay = "AllDay"; mappingsAppointment.Description = "Description"; mappingsAppointment.Label = "Label"; mappingsAppointment.Location = "Location"; mappingsAppointment.RecurrenceInfo = "RecurrenceInfo"; mappingsAppointment.ReminderInfo = "ReminderInfo"; mappingsAppointment.ResourceId = "OwnerId"; mappingsAppointment.Status = "Status"; mappingsAppointment.Type = "EventType"; schedulerDataStorage1.Resources.DataSource = CustomResourceCollection; schedulerDataStorage1.Appointments.DataSource = CustomEventList; schedulerControl1.GroupType = SchedulerGroupType.Resource; CreateTimeRegion(); schedulerControl1.Start = DateTime.Now; }
private void InitAppointments() { AppointmentMappingInfo mappings = this.schedulerStorage.Appointments.Mappings; mappings.AppointmentId = "Id"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; mappings.PercentComplete = "PercentComplete"; DateTime date = DateTime.Today.AddDays(2); CustomAppointmentList.Add(new CustomAppointment(1, "Spec", 2, 0, 1, date, date.AddDays(3), 100)); CustomAppointmentList.Add(new CustomAppointment(2, "Spike", 3, 0, 2, date.AddDays(3), date.AddDays(5), 100)); CustomAppointmentList.Add(new CustomAppointment(3, "Documentation-Fundamentals", 4, 0, 3, date.AddDays(2), date.AddDays(6), 100)); CustomAppointmentList.Add(new CustomAppointment(4, "Documentation-Public API", 6, 0, 6, date.AddDays(7), date.AddDays(10), 0)); this.nextId = (CustomAppointmentList.Max(a => a.Id)) + 1; this.schedulerStorage.Appointments.DataSource = CustomAppointmentList; }
void InitAppointments() { AppointmentMappingInfo mappings = this.schedulerStorage.Appointments.Mappings; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; schedulerStorage.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("Priority", "PriorityId")); int count = schedulerStorage.Resources.Count; DataHelper.GenerateEvents(eventList, count, resources); this.schedulerStorage.Appointments.DataSource = eventList; InitPriorities(priorities); }
private void AppointmentGraph_Load(object sender, EventArgs e) { DataTable dt = blag.GetAllAppointment(); if (dt.Rows.Count > 0) { schedulerStorage1.Appointments.DataSource = dt; //schedulerStorage1.Resources.DataSource = dt2; SchedulerStorage schedulerStorage = sch_appointment.Storage; ResourceMappingInfo resourceMappings = schedulerStorage.Resources.Mappings; AppointmentDependencyMappingInfo appointmentDependencyMappings = schedulerStorage.AppointmentDependencies.Mappings; AppointmentMappingInfo appointmentMappings = schedulerStorage.Appointments.Mappings; resourceMappings.Id = "appo_id"; appointmentMappings.AppointmentId = "appo_id"; appointmentMappings.Start = "start_time"; appointmentMappings.End = "end_time"; appointmentMappings.Subject = "Remarks"; appointmentMappings.Description = "Remarks"; //appointmentMappings.Location = "cat_name"; //appointmentMappings.Label = "color"; //appointmentMappings.Status = "showAs"; //appointmentMappings.AllDay = "allDay"; //appointmentMappings.ReminderInfo = "ReminderInfo"; //appointmentMappings.RecurrenceInfo = "RecurrenceInfo"; //appointmentMappings.Type = "EventType"; //appointmentMappings.ResourceId = "ResourceID"; resourceMappings.Caption = "table_no"; schedulerStorage.Appointments.CommitIdToDataSource = false; schedulerStorage.Appointments.ResourceSharing = true; sch_appointment.GroupType = SchedulerGroupType.Resource; sch_appointment.GoToDate(Convert.ToDateTime(DateTime.Now.ToShortDateString())); sch_appointment.ActiveViewType = SchedulerViewType.Day; // sch_appointment.GetNextControl // schedulerStorage.Resources.DataSource = dt; // schedulerStorage.AppointmentDependencies.DataSource = dataSet.Tables["AppointmentDependencies"]; // schedulerStorage.Appointments.DataSource = dt; schedulerStorage.AppointmentsInserted += delegate(object s, PersistentObjectsEventArgs ea) { DataTable dtAppointments = (DataTable)schedulerStorage.Appointments.DataSource; schedulerStorage.SetAppointmentId((Appointment)ea.Objects[0], Convert.ToInt32(dtAppointments.Rows[dtAppointments.Rows.Count - 1][appointmentMappings.AppointmentId])); }; } }
private void BindToDataSet() { if (this.schedulerDataSet == null) { this.schedulerDataSet = new SchedulerDataSet(); this.appointmentsAdapter.Fill(this.schedulerDataSet.Appointments); ResourcesTableAdapter resourcesAdapter = new ResourcesTableAdapter(); resourcesAdapter.Fill(this.schedulerDataSet.Resources); AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter(); appointmentsResourcesAdapter.Fill(this.schedulerDataSet.AppointmentsResources); } SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); dataSource.EventProvider.AppointmentFactory = this.radSchedulerDemo.AppointmentFactory; AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Mappings.Add(new SchedulerMapping("Email", "Email")); appointmentMappingInfo.UniqueId = "ID"; appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Summary = "Summary"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.BackgroundId = "BackgroundID"; appointmentMappingInfo.StatusId = "StatusID"; appointmentMappingInfo.Resources = "AppointmentsAppointmentsResources"; appointmentMappingInfo.ResourceId = "ResourceID"; appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; appointmentMappingInfo.Exceptions = "AppointmentsAppointments"; appointmentMappingInfo.MasterEventId = "ParentID"; appointmentMappingInfo.Visible = "Visible"; dataSource.EventProvider.Mapping = appointmentMappingInfo; dataSource.EventProvider.DataSource = this.schedulerDataSet.Appointments; ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo(); resourceMappingInfo.Id = "ID"; resourceMappingInfo.Name = "ResourceName"; dataSource.ResourceProvider.Mapping = resourceMappingInfo; dataSource.ResourceProvider.DataSource = this.schedulerDataSet.Resources; this.radSchedulerDemo.DataSource = dataSource; }
private void InitializeRadSchedulerDataBinding() { try { //cs_sapbo sapo = new cs_sapbo(); //this.schedulerBindingDataSource1.EventProvider.DataSource = sapo.GET_CITAS(); //this.schedulerBindingDataSource1.EventProvider.DataMember = "CITAS"; //this.schedulerBindingDataSource1.ResourceProvider.DataSource = sapo.GET_SALAS(1); //this.schedulerBindingDataSource1.ResourceProvider.DataMember = "SALAS"; //sapo = null; // fill all three tables citasTableAdapter1.Fill(this.schedulerDataDataSet.CITAS); salasTableAdapter1.Fill(this.schedulerDataDataSet.SALAS); cita1TableAdapter1.Fill(this.schedulerDataDataSet.CITA1); AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Summary = "PatientName"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.BackgroundId = "BackgroundID"; appointmentMappingInfo.StatusId = "StatusID"; appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; appointmentMappingInfo.UniqueId = "DocEntry"; appointmentMappingInfo.Visible = "Visible"; appointmentMappingInfo.ResourceId = "ResourceID"; appointmentMappingInfo.Resources = "FK_CITA1_CITAS"; this.schedulerBindingDataSource1.EventProvider.Mapping = appointmentMappingInfo; schedulerBindingDataSource1.EventProvider.DataSource = schedulerDataDataSet.CITAS; ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo(); resourceMappingInfo.Id = "RoomCode"; resourceMappingInfo.Name = "RoomName"; this.schedulerBindingDataSource1.ResourceProvider.Mapping = appointmentMappingInfo; schedulerBindingDataSource1.ResourceProvider.DataSource = schedulerDataDataSet.SALAS; // assign mapped binding data source this.radScheduler1.DataSource = schedulerBindingDataSource1; schedulerBindingDataSource1.Rebind(); //radScheduler1.DataBind(); } catch (Exception) { throw; } }
private void BindScheduler() { SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Summary = "NameDoc"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; dataSource.EventProvider.Mapping = appointmentMappingInfo; dataSource.EventProvider.DataSource = this.appointmentsBindingSource; this.radScheduler1.DataSource = dataSource; }
void MapAppointment(AppointmentMappingInfo mappings) { mappings.AllDay = "AllDay"; mappings.AppointmentId = "UniqueId"; mappings.Description = "Description"; mappings.End = "EndDate"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "ResourceId"; mappings.Start = "StartDate"; mappings.Status = "Status"; mappings.Subject = "Subject"; mappings.Type = "Type"; }
void InitAppointmentsMappings() { AppointmentMappingInfo mappings = ASPxScheduler1.Storage.Appointments.Mappings; mappings.AppointmentId = "Id"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; }
private void BindToDataSet() { if (this.schedulerDataSet == null) { this.schedulerDataSet = new SchedulerDataset(); AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter(); appointmentsAdapter.Fill(this.schedulerDataSet.Appointments); ResourcesTableAdapter resourcesAdapter = new ResourcesTableAdapter(); resourcesAdapter.Fill(this.schedulerDataSet.Resources); TransientAppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new TransientAppointmentsResourcesTableAdapter(); appointmentsResourcesAdapter.Fill(this.schedulerDataSet.TransientAppointmentsResources); } SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Summary = "Summary"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.BackgroundId = "BackgroundID"; appointmentMappingInfo.StatusId = "StatusID"; appointmentMappingInfo.Resources = "Appointments_AppointmentsResources"; appointmentMappingInfo.ResourceId = "ResourceID"; appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; dataSource.EventProvider.Mapping = appointmentMappingInfo; dataSource.EventProvider.DataSource = this.schedulerDataSet.Appointments; ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo(); resourceMappingInfo.Id = "ID"; resourceMappingInfo.Name = "ResourceName"; dataSource.ResourceProvider.Mapping = resourceMappingInfo; dataSource.ResourceProvider.DataSource = this.schedulerDataSet.Resources; this.radSchedulerDemo.DataSource = dataSource; }
private void InitAppointments() { AppointmentMappingInfo aptmappings = this.schedulerStorage1.Appointments.Mappings; aptmappings.Start = "StartTime"; aptmappings.End = "EndTime"; aptmappings.Subject = "Subject"; aptmappings.AllDay = "AllDay"; aptmappings.Description = "Description"; aptmappings.Label = "Label"; aptmappings.Location = "Location"; aptmappings.RecurrenceInfo = "RecurrenceInfo"; aptmappings.ReminderInfo = "ReminderInfo"; aptmappings.Status = "Status"; aptmappings.Type = "EventType"; aptmappings.ResourceId = "OwnerId"; this.schedulerStorage1.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping(OutlookEntryIDFieldName, OutlookEntryIDFieldName, FieldValueType.String)); this.schedulerStorage1.Appointments.DataSource = CustomEventList; }
private void InitAppointments() { AppointmentMappingInfo mappings = this.schedulerDataStorage1.Appointments.Mappings; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; GenerateEvents(CustomEventList); this.schedulerDataStorage1.Appointments.DataSource = CustomEventList; }
public List <CustomAppointment> InitAppointments() { AppointmentMappingInfo mappings = this.Storage.Appointments.Mappings; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; GenerateEvents(CustomEventList, 3); return(CustomEventList); }
private void InitAppointments() { AppointmentMappingInfo mappings = schedulerStorageMain.Appointments.Mappings; mappings.AppointmentId = "Id"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "ResourceId"; mappings.Status = "Status"; mappings.Type = "EventType"; // add in the client Id field schedulerStorageMain.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("ClientId", "ClientId")); // fills in the appointments from the database schedulerStorageMain.Appointments.DataSource = ClientAppointment.GetClientAppointments(); }
private void RadForm1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'schedulerDataDataSet.Resources' table. You can move, or remove it, as needed. this.resourcesTableAdapter.Fill(this.schedulerDataDataSet.Resources); // TODO: This line of code loads data into the 'schedulerDataDataSet.AppointmentsResources' table. You can move, or remove it, as needed. this.appointmentsResourcesTableAdapter.Fill(this.schedulerDataDataSet.AppointmentsResources); // TODO: This line of code loads data into the 'schedulerDataDataSet.Appointments' table. You can move, or remove it, as needed. this.appointmentsTableAdapter.Fill(this.schedulerDataDataSet.Appointments); AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.BackgroundId = "BackgroundId"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.MasterEventId = "MasterEventId"; appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; appointmentMappingInfo.ResourceId = "ResourceID"; appointmentMappingInfo.Exceptions = "Appointments_Appointments"; appointmentMappingInfo.Resources = "AppointmentsResources_Appointments"; appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.StatusId = "StatusID"; appointmentMappingInfo.Summary = "Summary"; schedulerBindingDataSource1.EventProvider.Mapping = appointmentMappingInfo; ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo(); resourceMappingInfo.Id = "ID"; resourceMappingInfo.Name = "Name"; this.schedulerBindingDataSource1.ResourceProvider.Mapping = resourceMappingInfo; schedulerBindingDataSource1.ResourceProvider.DataSource = schedulerDataDataSet.Resources; schedulerBindingDataSource1.EventProvider.DataSource = schedulerDataDataSet.Appointments; radScheduler1.DataSource = schedulerBindingDataSource1; this.radScheduler1.GroupType = GroupType.Resource; }
/// <summary> /// 设置任务 /// </summary> private void schedulerControlSetting() { schedulerControl1.Start = DateTime.Now; AppointmentMappingInfo mappings = this.schedulerDataStorage1.Appointments.Mappings; mappings.AppointmentId = "TaskId"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; mappings.PercentComplete = "PercentComplete"; //this.schedulerDataStorage1.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("MyNote", "TaskTemplate", FieldValueType.String)); //AppointmentCustomFieldMappingCollection appointCust = this.schedulerControl1.Storage.Appointments.CustomFieldMappings; //appointCust.Add(new AppointmentCustomFieldMapping("MyNote", "TaskTemplate")); }
private void BindScheduler() { // 1) Retrieve data rows SqlConnection connection = new SqlConnection(@"Data Source=.\SQLExpress;Initial Catalog=SchedulerBindDynamically;Integrated Security=SSPI"); SqlCommand selectCommand = new SqlCommand("SELECT ID, StartTime, EndTime, Subject FROM CarScheduling", connection); dataSet = new DataSet(); dataAdapter = new SqlDataAdapter(selectCommand); dataAdapter.Fill(dataSet, "CarScheduling"); // 2) Adjust mappings SchedulerStorage schedulerStorage = schedulerControl1.Storage; AppointmentMappingInfo appointmentMappings = schedulerStorage.Appointments.Mappings; appointmentMappings.AppointmentId = "ID"; appointmentMappings.Start = "StartTime"; appointmentMappings.End = "EndTime"; appointmentMappings.Subject = "Subject"; schedulerStorage.Appointments.CommitIdToDataSource = false; // 3) Bind scheduler to data schedulerStorage.Appointments.DataSource = dataSet.Tables["CarScheduling"]; if (schedulerStorage.Appointments.Count > 0) { schedulerControl1.Start = schedulerStorage.Appointments[0].Start; } // 4) Define Insert, Update, Delete commands dataAdapter.InsertCommand = new SqlCommand("INSERT INTO CarScheduling (StartTime, EndTime, Subject, TimeStamp) VALUES (@StartTime, @EndTime, @Subject, GetDate())", connection); dataAdapter.InsertCommand.Parameters.Add("@StartTime", SqlDbType.DateTime); dataAdapter.InsertCommand.Parameters.Add("@EndTime", SqlDbType.DateTime); dataAdapter.InsertCommand.Parameters.Add("@Subject", SqlDbType.NVarChar); dataAdapter.InsertCommand.Parameters["@StartTime"].SourceColumn = "StartTime"; dataAdapter.InsertCommand.Parameters["@EndTime"].SourceColumn = "EndTime"; dataAdapter.InsertCommand.Parameters["@Subject"].SourceColumn = "Subject"; dataAdapter.UpdateCommand = new SqlCommand("UPDATE CarScheduling SET StartTime = @StartTime, EndTime = @EndTime, Subject = @Subject, TimeStamp = GetDate() WHERE ID = @ID", connection); dataAdapter.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int); dataAdapter.UpdateCommand.Parameters.Add("@StartTime", SqlDbType.DateTime); dataAdapter.UpdateCommand.Parameters.Add("@EndTime", SqlDbType.DateTime); dataAdapter.UpdateCommand.Parameters.Add("@Subject", SqlDbType.NVarChar); dataAdapter.UpdateCommand.Parameters["@ID"].SourceColumn = "ID"; dataAdapter.UpdateCommand.Parameters["@StartTime"].SourceColumn = "StartTime"; dataAdapter.UpdateCommand.Parameters["@EndTime"].SourceColumn = "EndTime"; dataAdapter.UpdateCommand.Parameters["@Subject"].SourceColumn = "Subject"; dataAdapter.DeleteCommand = new SqlCommand("DELETE FROM CarScheduling WHERE ID = @ID", connection); dataAdapter.DeleteCommand.Parameters.Add("@ID", SqlDbType.Int); dataAdapter.DeleteCommand.Parameters["@ID"].SourceColumn = "ID"; // 5) Subscribe to events (data-related operations) schedulerStorage.AppointmentsInserted += Storage_AppointmentsModified; schedulerStorage.AppointmentsChanged += Storage_AppointmentsModified; schedulerStorage.AppointmentsDeleted += Storage_AppointmentsModified; dataAdapter.RowUpdated += Adapter_RowUpdated; }
private void LoadData() { string connetionString = null; SqlConnection cnn; connetionString = "Data Source=EPINEDA-DELL;Initial Catalog=Scopes;Integrated Security=true"; cnn = new SqlConnection(connetionString); try { cnn.Open(); string queryString = @"SELECT Store AS [Summary], [Address] + ' ' + [City] + ' ' + [State] + ' ' + Phone as [Location], CASE WHEN right(time,2) = 'PM' THEN DATEADD(HOUR, CAST(LEFT(time,1) as int) + 12 , Day) ELSE DATEADD(HOUR, CAST(LEFT(time,1) as int), Day) End AS [Start], CASE WHEN right(time,2) = 'PM' THEN DATEADD(HOUR, CAST(LEFT(time,1) as int) + 13 , Day) ELSE DATEADD(HOUR, CAST(LEFT(time,1) as int) + 1, Day) End AS [End], CASE FLOOR WHEN 'VCT' THEN CAST(2 as int) ELSE CAST(6 as int) END AS [BackgroundID], 'Tech: '+ Tech + ' RegDirector: ' + [RegDirector] + ' DistMgr: ' + [DistMgr] + 'Floor: ' + [Floor] AS [Description] FROM dbo.[MASTER-MAYO] ORDER BY Day" ; SqlDataAdapter adapter = new SqlDataAdapter(queryString, cnn); DataSet customers = new DataSet(); adapter.Fill(customers, "Appointments"); //adapter.Fill(schedulerDataDataSet.Appointments); AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Duration = "Duration"; appointmentMappingInfo.Summary = "Summary"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.BackgroundId = "BackgroundID"; //appointmentMappingInfo.StatusId = "StatusID"; //appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; //appointmentMappingInfo.Resources = "Appointments_AppointmentsResources"; //appointmentMappingInfo.ResourceId = "ResourceID"; schedulerBindingDataSource1.EventProvider.Mapping = appointmentMappingInfo; schedulerBindingDataSource1.EventProvider.DataSource = customers.Tables[0]; // schedulerDataDataSet.Appointments; radScheduler1.DataSource = schedulerBindingDataSource1; schedulerBindingDataSource1.Rebind(); // MessageBox.Show("Connection Open ! "); cnn.Close(); } catch (Exception ex) { MessageBox.Show("Can not open connection ! "); } }
private void BindToBusinessObjects() { this.appointments = new List <MyAppointment>(); DateTime baseDate = new DateTime(2009, 3, 7); 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); } MyAppointment recurringAppointment = new MyAppointment(baseDate.AddHours(7.0), baseDate.AddHours(10.0), "Recurring appointment with exceptions", null, null); recurringAppointment.RecurrenceRule = "FREQ=DAILY"; MyAppointment notVisibleException = new MyAppointment(recurringAppointment.Start.AddDays(1.0), recurringAppointment.End.AddDays(1.0), "Recurring appointment with exceptions", null, null); notVisibleException.MasterAppointment = recurringAppointment; notVisibleException.Visible = false; recurringAppointment.Exceptions.Add(notVisibleException); this.appointments.Add(recurringAppointment); //int[] resourceIds = new int[] { 1, 2, 3 }; string[] resourceNames = new string[] { "Dell Laptop", "Lenovo Laptop", "Toshiba Laptop" }; this.resources = new List <MyResource>(); for (int i = 0; i < resourceNames.Length; i++) { this.resources.Add(new MyResource(resourceNames[i])); } SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); dataSource.EventProvider.AppointmentFactory = this.radSchedulerDemo.AppointmentFactory; AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo(); appointmentMappingInfo.Mappings.Add(new SchedulerMapping("Email", "Email")); appointmentMappingInfo.Start = "Start"; appointmentMappingInfo.End = "End"; appointmentMappingInfo.Summary = "Subject"; appointmentMappingInfo.Description = "Description"; appointmentMappingInfo.Location = "Location"; appointmentMappingInfo.UniqueId = "Id"; appointmentMappingInfo.Resources = "Resources"; appointmentMappingInfo.ResourceId = "Id"; appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"; appointmentMappingInfo.Exceptions = "Exceptions"; appointmentMappingInfo.MasterEventId = "MasterAppointment"; appointmentMappingInfo.Visible = "Visible"; dataSource.EventProvider.Mapping = appointmentMappingInfo; dataSource.EventProvider.DataSource = this.appointments; ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo(); resourceMappingInfo.Id = "Id"; resourceMappingInfo.Name = "Name"; dataSource.ResourceProvider.Mapping = resourceMappingInfo; dataSource.ResourceProvider.DataSource = this.resources; this.radSchedulerDemo.DataSource = dataSource; }