private void Shedule_Load(object sender, EventArgs e) { context = new ClassSRMDataContext(Config.connection); DBAppointmentList apts = new DBAppointmentList(); apts.AddRange(context.DBAppointments.ToArray()); List <DBResource> resources = new List <DBResource>(); resources.AddRange(context.DBResources.ToArray()); AppointmentStorage aptStorage = schedulerStorage1.Appointments; ResourceStorage resStorage = schedulerStorage1.Resources; aptStorage.Mappings.AllDay = "AllDay"; aptStorage.Mappings.Description = "Description"; aptStorage.Mappings.End = "EndTime"; aptStorage.Mappings.Label = "Label"; aptStorage.Mappings.Location = "Location"; aptStorage.Mappings.RecurrenceInfo = "RecurrenceInfo"; aptStorage.Mappings.ReminderInfo = "ReminderInfo"; aptStorage.Mappings.ResourceId = "CarIdShared"; aptStorage.Mappings.Start = "StartTime"; aptStorage.Mappings.Status = "Status"; aptStorage.Mappings.Subject = "Subject"; aptStorage.Mappings.Type = "EventType"; resStorage.Mappings.Id = "ID"; resStorage.Mappings.Caption = "Model"; resStorage.Mappings.Image = "Picture"; resStorage.DataSource = resources; aptStorage.DataSource = apts; schedulerControl1.GoToToday(); }
public static object GenerateListViewAppointmentCollection(AppointmentStorage storage, AppointmentBaseCollection sourceAppointments, DayOfWeek dayOfWeek) { BindingList <ListViewAppointment> listViewAppointments = new BindingList <ListViewAppointment>(); foreach (Appointment appointment in sourceAppointments) { listViewAppointments.Add(CreateListViewAppointment(storage, appointment, dayOfWeek)); } return(listViewAppointments); }
protected virtual void InitScheduler() { _schedulerStorage = new SchedulerStorage(); _schedulerStorage.BeginInit(); _schedulerStorage.EnableReminders = true; _schedulerStorage.RemindersCheckInterval =( ((IModelApplicationScheduler) Application.Model).Scheduler).RemindersCheckInterval; _appointmentStorage = (_schedulerStorage).Appointments; _appointmentStorage.AutoReload = false; var mappingCollection = _appointmentStorage.CustomFieldMappings; mappingCollection.Add(new AppointmentCustomFieldMapping(BoTypeCustomField, BoTypeCustomField)); _schedulerStorage.AppointmentChanging += SchedulerStorageAppointmentChanging; _schedulerStorage.ReminderAlert += ShowReminderAlerts; _schedulerStorage.EndInit(); }
protected virtual void InitScheduler() { _schedulerStorage = new SchedulerStorage(); _schedulerStorage.BeginInit(); _schedulerStorage.EnableReminders = true; _schedulerStorage.RemindersCheckInterval = (((IModelApplicationScheduler)Application.Model).Scheduler).RemindersCheckInterval; _appointmentStorage = (_schedulerStorage).Appointments; _appointmentStorage.AutoReload = false; var mappingCollection = _appointmentStorage.CustomFieldMappings; mappingCollection.Add(new AppointmentCustomFieldMapping(BoTypeCustomField, BoTypeCustomField)); _schedulerStorage.AppointmentChanging += SchedulerStorageAppointmentChanging; _schedulerStorage.ReminderAlert += ShowReminderAlerts; _schedulerStorage.EndInit(); }
public static ListViewAppointment CreateListViewAppointment(AppointmentStorage storage, Appointment sourceAppointment, DayOfWeek dayOfWeek) { ListViewAppointment listViewAppointment = new ListViewAppointment(); listViewAppointment.ListViewDate = sourceAppointment.Start; listViewAppointment.ListViewSubject = sourceAppointment.Subject; listViewAppointment.ListViewRecurrencePattern = RecurrenceInfo.GetDescription(sourceAppointment, dayOfWeek); listViewAppointment.ListViewIsRecurring = sourceAppointment.IsRecurring; listViewAppointment.ListViewDuration = sourceAppointment.Duration.ToString(); listViewAppointment.ListViewAppointmentID = sourceAppointment.Id; listViewAppointment.ListViewLocation = sourceAppointment.Location; listViewAppointment.ListViewStatus = storage.Statuses[sourceAppointment.StatusId];; listViewAppointment.ListViewLabel = storage.Labels[sourceAppointment.LabelId].Color; listViewAppointment.SourceAppointment = sourceAppointment; return(listViewAppointment); }
//---------------------------------------- #region ** Initializing public MainWindow() { Language = System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.Name); InitializeComponent(); // get data from the data base this.appointeesTableAdapter.Fill(dataSet.Appointees); this.appointmentsTableAdapter.Fill(dataSet.Appointments); // set mappings and DataSource for the ContactStorage ContactStorage cstorage = scheduler.DataStorage.ContactStorage; cstorage.Mappings.IndexMapping.MappingName = "EmployeeID"; cstorage.Mappings.TextMapping.MappingName = "FirstName"; cstorage.DataMember = "Appointees"; cstorage.DataSource = dataSet.Appointees; // set correct MenuCaption for contacts foreach (Contact cnt in scheduler.DataStorage.ContactStorage.Contacts) { C1NwindDataSet.AppointeesRow row = dataSet.Appointees.FindByEmployeeID((int)cnt.Key[0]); if (row != null) { cnt.MenuCaption = row["FirstName"].ToString() + " " + row["LastName"].ToString(); } } // set mappings and DataSource for the AppointmentStorage AppointmentStorage storage = scheduler.DataStorage.AppointmentStorage; storage.Mappings.AppointmentProperties.MappingName = "Properties"; storage.Mappings.Body.MappingName = "Body"; storage.Mappings.End.MappingName = "End"; storage.Mappings.IdMapping.MappingName = "Id"; storage.Mappings.Location.MappingName = "Location"; storage.Mappings.Start.MappingName = "Start"; storage.Mappings.Subject.MappingName = "Subject"; storage.DataMember = "Appointments"; storage.DataSource = dataSet.Appointments; themeList.SelectedItem = "Colorful"; agendaRange.SelectedItem = "Week"; Closing += MainWindow_Closing; }
public Window1() { Language = System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.Name); InitializeComponent(); Scheduler.ReminderFire += new EventHandler <ReminderActionEventArgs>(scheduler_ReminderFire); Scheduler.GroupItems.CollectionChanged += new NotifyCollectionChangedEventHandler(GroupItems_CollectionChanged); // get data from the data base this.employeesTableAdapter.Fill(dataSet.Employees); this.customersTableAdapter.Fill(dataSet.Customers); this.appointmentsTableAdapter.Fill(dataSet.Appointments); // set mappings and DataSource for the AppointmentStorages AppointmentStorage storage = Scheduler.DataStorage.AppointmentStorage; storage.Mappings.AppointmentProperties.MappingName = "Properties"; storage.Mappings.Body.MappingName = "Description"; storage.Mappings.End.MappingName = "End"; storage.Mappings.IdMapping.MappingName = "AppointmentId"; storage.Mappings.Location.MappingName = "Location"; storage.Mappings.Start.MappingName = "Start"; storage.Mappings.Subject.MappingName = "Subject"; storage.Mappings.OwnerIndexMapping.MappingName = "Owner"; storage.DataSource = dataSet.Appointments; // set mappings and DataSource for the OwnerStorage ContactStorage ownerStorage = Scheduler.DataStorage.OwnerStorage; ((INotifyCollectionChanged)ownerStorage.Contacts).CollectionChanged += new NotifyCollectionChangedEventHandler(Owners_CollectionChanged); ownerStorage.Mappings.IndexMapping.MappingName = "EmployeeId"; ownerStorage.Mappings.TextMapping.MappingName = "FirstName"; ownerStorage.DataSource = dataSet.Employees; // set mappings and DataSource for the ContactStorage ContactStorage cntStorage = Scheduler.DataStorage.ContactStorage; ((INotifyCollectionChanged)cntStorage.Contacts).CollectionChanged += new NotifyCollectionChangedEventHandler(Contacts_CollectionChanged); cntStorage.Mappings.IdMapping.MappingName = "CustomerId"; cntStorage.Mappings.TextMapping.MappingName = "CompanyName"; cntStorage.DataSource = dataSet.Customers; btnDay.IsChecked = true; Scheduler.StyleChanged += new System.EventHandler <RoutedEventArgs>(Scheduler_StyleChanged); }
void InitializeMappings() { AppointmentStorage aptStorage = this.schedulerStorage1.Appointments; ResourceStorage resStorage = this.schedulerStorage1.Resources; aptStorage.Mappings.AllDay = "AllDay"; aptStorage.Mappings.Description = "Description"; aptStorage.Mappings.End = "EndTime"; aptStorage.Mappings.Label = "Label"; aptStorage.Mappings.Location = "Location"; aptStorage.Mappings.RecurrenceInfo = "RecurrenceInfo"; aptStorage.Mappings.ReminderInfo = "ReminderInfo"; aptStorage.Mappings.ResourceId = "CarIdShared"; aptStorage.Mappings.Start = "StartTime"; aptStorage.Mappings.Status = "Status"; aptStorage.Mappings.Subject = "Subject"; aptStorage.Mappings.Type = "EventType"; resStorage.Mappings.Id = "ID"; resStorage.Mappings.Caption = "Model"; resStorage.Mappings.Image = "Picture"; }
async private Task GenerateProjectAndCostCategories(AppointmentStorage appointmentStorage) { appointmentStorage.Statuses.Clear(); appointmentStorage.Labels.Clear(); //Adding Projects var projects = await api.Query <ProjectClient>(); foreach (var proj in projects) { int projNumber = 0; int.TryParse(proj.Number, out projNumber); appointmentStorage.Labels.Add(new AppointmentLabel(GetColorForLabel(projNumber), proj.Number, string.Concat("Project#", proj.Number))); } //Adding Cost Category var costCategories = await api.Query <ProjectCostCategoryClient>(); foreach (var costCat in costCategories) { appointmentStorage.Statuses.Add(new AppointmentStatus(AppointmentStatusType.Custom, GetColorForStatus(costCat.Name), costCat.Number, costCat.Number)); } }
private void CreateAppointentsForResource(SchedulerStorage storage, Resource resource) { Random rnd = DemoUtils.RandomInstance; int statusCount = storage.AppointmentStorage.Statuses.Count; string[] appointmentKind = { "appointment", "personal time", "meeting", "travel" }; int[] labelKind = { 1, 3, 5, 6 }; string subjPrefix = resource.Caption + "'s "; AppointmentStorage appointments = storage.AppointmentStorage; for (int i = 0; i < 50; i++) { int statusId = rnd.Next(0, statusCount); int aptKindId = rnd.Next(0, appointmentKind.Length); int labelId = labelKind[aptKindId]; string subject = subjPrefix + appointmentKind[aptKindId]; int dateRange = rnd.Next(0, 20); DateTime start = DateTime.Today.AddDays(dateRange - 2); appointments.Add(CreateAppointment(start, subject, resource.Id, statusId, labelId)); } }