Ejemplo n.º 1
0
        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 InitDependencies()
        {
            AppointmentDependencyMappingInfo mappings = schedulerStorage.AppointmentDependencies.Mappings;

            mappings.DependentId = "DependentId";
            mappings.ParentId    = "ParentId";
            mappings.Type        = "Type";

            CustomDependencyList.Add(new CustomDependency(1, 2, 0));
            CustomDependencyList.Add(new CustomDependency(1, 3, 0));
            CustomDependencyList.Add(new CustomDependency(3, 4, 0));

            schedulerStorage.AppointmentDependencies.DataSource = CustomDependencyList;
        }