protected void ObjectDataSourceResources_ObjectCreated(object sender, ObjectDataSourceEventArgs e) { if (Session["CustomResourceDataSource"] == null) { Session["CustomResourceDataSource"] = new CustomResourceDataSource(GetCustomResources()); } e.ObjectInstance = Session["CustomResourceDataSource"]; }
BindingList <CustomAppointment> GetCustomAppointments() { BindingList <CustomAppointment> appointments = new BindingList <CustomAppointment>();; CustomResourceDataSource resources = Session["CustomResourceDataSource"] as CustomResourceDataSource; if (resources != null) { foreach (CustomResource item in resources.Resources) { string subjPrefix = item.Name + "'s "; appointments.Add(CreateCustomAppointment(subjPrefix + "meeting", item.ResID, 2, 5)); appointments.Add(CreateCustomAppointment(subjPrefix + "travel", item.ResID, 3, 6)); appointments.Add(CreateCustomAppointment(subjPrefix + "phone call", item.ResID, 0, 10)); } } return(appointments); }
BindingList <CustomAppointment> GetCustomAppointments() { for (int i = 0; i < 5; i++) { customFieldValues.Add("Custom value " + i.ToString()); } BindingList <CustomAppointment> appointments = new BindingList <CustomAppointment>();; CustomResourceDataSource resources = Session["CustomResourceDataSource"] as CustomResourceDataSource; if (resources != null) { foreach (CustomResource item in resources.Resources) { string subjPrefix = item.Name + "'s "; appointments.Add(CreateCustomAppointment(subjPrefix + "meeting", item.ResID, 2, 5, 1)); appointments.Add(CreateCustomAppointment(subjPrefix + "travel", item.ResID, 3, 6, 2)); appointments.Add(CreateCustomAppointment(subjPrefix + "phone call", item.ResID, 0, 10, 3)); } } return(appointments); }