Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Load tabels
- SqlConnection cnn = new SqlConnection(functionsClass.GetConnectionString());
- SqlCommand cmd = new SqlCommand() { CommandText = "prepareAppointmentsTbl", CommandType = CommandType.StoredProcedure, Connection = cnn };
- //SqlCommand cmd2 = new SqlCommand("select * from Doctors", cnn);
- SqlCommand cmd2 = new SqlCommand() { CommandText = "newSelectDoctors", CommandType = CommandType.StoredProcedure, Connection = cnn };
- cnn.Open();
- try
- {
- cmd.Parameters.Clear();
- cmd.Parameters.AddWithValue("@month_count", mont_count);
- cmd.Parameters.AddWithValue("@all", all);
- dt.Load(cmd.ExecuteReader());
- dt2.Load(cmd2.ExecuteReader());
- }
- catch (Exception ex)
- {
- XtraMessageBox.Show(ex.Message);
- return;
- }
- finally
- {
- cnn.Close();
- }
- #endregion
- #region bind and mapping fields
- // bind the schedular to datatables
- schedulerStorage1.Appointments.DataSource = dt;
- schedulerStorage1.Resources.DataSource = dt2;
- SchedulerStorage schedulerStorage = schedulerControl1.Storage;
- ResourceMappingInfo resourceMappings = schedulerStorage.Resources.Mappings;
- AppointmentDependencyMappingInfo appointmentDependencyMappings = schedulerStorage.AppointmentDependencies.Mappings;
- AppointmentMappingInfo appointmentMappings = schedulerStorage.Appointments.Mappings;
- resourceMappings.Id = "doc_ID";
- resourceMappings.Caption = "doc_name";
- appointmentMappings.AppointmentId = "app_code";
- appointmentMappings.Start = "start_date";
- appointmentMappings.End = "end_date";
- appointmentMappings.Subject = "pname";
- appointmentMappings.Description = "notes";
- 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";
- schedulerStorage.Appointments.CommitIdToDataSource = false;
- schedulerStorage.Appointments.ResourceSharing = true;
- schedulerControl1.GroupType = SchedulerGroupType.Resource;
- schedulerControl1.ActiveViewType = SchedulerViewType.Day;
- schedulerStorage.Resources.DataSource = dt2;
- // 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]));
- };
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment