private void GetMappings() { AppointmentMapping mappings = employeeScheduler.Storage.AppointmentStorage.Mappings; mappings.Start = "FromTime"; mappings.End = "ToTime"; mappings.Label = "ProjectId"; mappings.Status = "CostCategoryId"; employeeScheduler.Storage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping() { Name = "FieldText", Member = "Text", ValueType = FieldValueType.String }); employeeScheduler.Storage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping() { Name = "FieldCostPrice", Member = "CostPrice", ValueType = FieldValueType.Object }); employeeScheduler.Storage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping() { Name = "FieldDiscountPct", Member = "DiscountPct", ValueType = FieldValueType.Object }); employeeScheduler.Storage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping() { Name = "FieldSalesPrice", Member = "SalesPrice", ValueType = FieldValueType.Object }); employeeScheduler.Storage.AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping() { Name = "FieldQty", Member = "Qty", ValueType = FieldValueType.Object }); }
public override View GetSampleContent(Context context) { this.context = context; LinearLayout linearLayout = new LinearLayout(context); linearLayout.Orientation = Orientation.Vertical; schedule = new SfSchedule(context); propertyLayout = new LinearLayout(context); propertyLayout = SetOptionPage(context); // Schedule custom appointment mapping AppointmentMapping mapping = new AppointmentMapping(); mapping.StartTime = "From"; mapping.EndTime = "To"; mapping.Subject = "EventName"; mapping.IsAllDay = "isAllDay"; mapping.MinHeight = "MinimumHeight"; mapping.Color = "color"; schedule.AppointmentMapping = mapping; schedule.ScheduleView = ScheduleView.WeekView; schedule.MonthViewSettings.ShowAppointmentsInline = true; GetAppointments(); schedule.ItemsSource = appointmentCollection; schedule.LayoutParameters = new FrameLayout.LayoutParams( LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); linearLayout.AddView(schedule); return(linearLayout); }
private void InitializeScheduler() { InitHelper.InitResources(CustomResourceCollection); InitHelper.InitAppointments(CustomEventList, CustomResourceCollection); ResourceMapping mappingsResource = this.scheduler.Storage.ResourceStorage.Mappings; mappingsResource.Id = "ResID"; mappingsResource.Caption = "Name"; AppointmentMapping mappingsAppointment = this.scheduler.Storage.AppointmentStorage.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.scheduler.Storage.BeginUpdate(); this.scheduler.Storage.ResourceStorage.DataSource = CustomResourceCollection; this.scheduler.Storage.AppointmentStorage.DataSource = CustomEventList; this.scheduler.Storage.EndUpdate(); this.scheduler.Start = DateTime.Now; this.scheduler.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.Day; }
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) { AppointmentMapping appointmentMappings = new AppointmentMapping(); Dictionary <string, string> mappings = value as Dictionary <string, string>; if (mappings != null) { if (mappings.ContainsKey("AllDay")) { appointmentMappings.AllDay = mappings["AllDay"]; } if (mappings.ContainsKey("Description")) { appointmentMappings.Description = mappings["Description"]; } if (mappings.ContainsKey("End")) { appointmentMappings.End = mappings["End"]; } if (mappings.ContainsKey("Label")) { appointmentMappings.Label = mappings["Label"]; } if (mappings.ContainsKey("Location")) { appointmentMappings.Location = mappings["Location"]; } if (mappings.ContainsKey("RecurrenceInfo")) { appointmentMappings.RecurrenceInfo = mappings["RecurrenceInfo"]; } if (mappings.ContainsKey("ReminderInfo")) { appointmentMappings.ReminderInfo = mappings["ReminderInfo"]; } if (mappings.ContainsKey("ResourceId")) { appointmentMappings.ResourceId = mappings["ResourceId"]; } if (mappings.ContainsKey("Start")) { appointmentMappings.Start = mappings["Start"]; } if (mappings.ContainsKey("Status")) { appointmentMappings.Status = mappings["Status"]; } if (mappings.ContainsKey("Subject")) { appointmentMappings.Subject = mappings["Subject"]; } if (mappings.ContainsKey("Type")) { appointmentMappings.Type = mappings["Type"]; } } return(appointmentMappings); }
/// <summary> /// Initialize a new instance of the class <see cref="ScheduleGettingStarted"/> class /// </summary> public ScheduleGettingStarted() { schedule = new SFSchedule(); label.Text = "Schedule View"; label.TextColor = UIColor.Black; this.AddSubview(label); textButton.SetTitle("WeekView", UIControlState.Normal); textButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; textButton.BackgroundColor = UIColor.Clear; textButton.SetTitleColor(UIColor.Black, UIControlState.Normal); textButton.Hidden = false; textButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; textButton.Layer.BorderWidth = 4; textButton.Layer.CornerRadius = 8; textButton.TouchUpInside += ShowPicker; this.AddSubview(textButton); button.SetTitle("Done\t", UIControlState.Normal); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; button.BackgroundColor = UIColor.FromRGB(240, 240, 240); button.SetTitleColor(UIColor.Black, UIControlState.Normal); button.Hidden = true; button.TouchUpInside += HidePicker; appointmentCollection = new AppointmentCollection(); schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek; schedule.MonthViewSettings.ShowAppointmentsInline = true; // Custom appointment mapping AppointmentMapping mapping = new AppointmentMapping(); mapping.Subject = "EventName"; mapping.StartTime = "From"; mapping.EndTime = "To"; mapping.AppointmentBackground = "color"; mapping.Location = "Organizer"; mapping.IsAllDay = "isAllDay"; mapping.MinHeight = "MinimumHeight"; schedule.AppointmentMapping = mapping; schedule.ItemsSource = appointmentCollection.GetAppointments(); this.AddSubview(schedule); this.scheduleViews.Add((NSString)"Week View"); this.scheduleViews.Add((NSString)"Day View"); this.scheduleViews.Add((NSString)"Work Week View"); this.scheduleViews.Add((NSString)"Month View"); SchedulePickerModel model = new SchedulePickerModel(this.scheduleViews); // Event occurs when the item picked in the picker model.PickerChanged += (sender, e) => { this.selectedView = e.SelectedValue; textButton.SetTitle(selectedView, UIControlState.Normal); if (selectedView == "Day View") { schedule.ScheduleView = SFScheduleView.SFScheduleViewDay; } else if (selectedView == "Week View") { schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek; } else if (selectedView == "Work Week View") { schedule.ScheduleView = SFScheduleView.SFScheduleViewWorkWeek; } else if (selectedView == "Month View") { schedule.ScheduleView = SFScheduleView.SFScheduleViewMonth; } }; scheduleViewPicker.ShowSelectionIndicator = true; scheduleViewPicker.Hidden = true; scheduleViewPicker.Model = model; scheduleViewPicker.BackgroundColor = UIColor.White; this.OptionView = new UIView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.CurrentFrame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, UIScreen.MainScreen.Bounds.Size.Height); this.AddButton(); //Creating an instance for SfSchedule control SFSchedule schedule = new SFSchedule(); schedule.Frame = new CGRect(0, removeExceptionAppointment.Frame.Bottom, this.CurrentFrame.Size.Width, this.CurrentFrame.Size.Height - removeExceptionAppointment.Frame.Bottom); schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek; NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); NSDate today = NSDate.Now; // Get the year, month, day from the date NSDateComponents startDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the year, month, day, hour, minute, second startDateComponents.Year = 2017; startDateComponents.Month = 09; startDateComponents.Day = 03; startDateComponents.Hour = 10; startDateComponents.Minute = 0; startDateComponents.Second = 0; //setting start time for the event NSDate startDate = calendar.DateFromComponents(startDateComponents); //setting end time for the event NSDate endDate = startDate.AddSeconds(2 * 60 * 60); // set moveto date to schedule schedule.MoveToDate(startDate); // Set the exception dates. var exceptionDate1 = startDate; var exceptionDate2 = startDate.AddSeconds(2 * 24 * 60 * 60); exceptionDate3 = startDate.AddSeconds(4 * 24 * 60 * 60); AppointmentMapping mapping = new AppointmentMapping(); mapping.Subject = "EventName"; mapping.StartTime = "From"; mapping.EndTime = "To"; mapping.AppointmentBackground = "Color"; mapping.RecurrenceId = "RecurrenceID"; mapping.ExceptionOccurrenceActualDate = "ActualDate"; mapping.RecurrenceExceptionDates = "RecurrenceExceptionDates"; mapping.RecurrenceRule = "RecurrenceRule"; schedule.AppointmentMapping = mapping; // Add Schedule appointment Meeting recurrenceAppointment = new Meeting(); recurrenceAppointment.From = startDate; recurrenceAppointment.To = endDate; recurrenceAppointment.EventName = (NSString)"Occurs Daily"; recurrenceAppointment.Color = UIColor.Blue; recurrenceAppointment.RecurrenceRule = (NSString)"FREQ=DAILY;COUNT=20"; recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <NSDate> { exceptionDate1, exceptionDate2, exceptionDate3 }; scheduleAppointmentCollection.Add(recurrenceAppointment); schedule.ItemsSource = scheduleAppointmentCollection; this.View.AddSubview(schedule); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout linearLayout = new LinearLayout(this); linearLayout.Orientation = Orientation.Vertical; this.AddButton(linearLayout); //Creating an instance for SfSchedule Control SfSchedule schedule = new SfSchedule(this); schedule.ScheduleView = Com.Syncfusion.Schedule.Enums.ScheduleView.WeekView; // Creating an instance for schedule appointment Collection Calendar startTime = (Calendar)currentDate.Clone(); //setting start time for the event startTime.Set(2017, 08, 03, 10, 0, 0); Calendar endTime = (Calendar)currentDate.Clone(); //setting end time for the event endTime.Set(2017, 08, 03, 12, 0, 0); // move to date. schedule.MoveToDate = startTime; // Set exception dates. var exceptionDate1 = Calendar.Instance; exceptionDate1.Set(2017, 08, 03); var exceptionDate2 = Calendar.Instance; exceptionDate2.Set(2017, 08, 05); exceptionDate3 = Calendar.Instance; exceptionDate3.Set(2017, 08, 07); AppointmentMapping mapping = new AppointmentMapping(); mapping.Subject = "EventName"; mapping.StartTime = "From"; mapping.EndTime = "To"; mapping.Color = "Color"; mapping.RecurrenceId = "RecurrenceID"; mapping.ExceptionOccurrenceActualDate = "ActualDate"; mapping.RecurrenceExceptionDates = "RecurrenceExceptionDates"; mapping.RecurrenceRule = "RecurrenceRule"; schedule.AppointmentMapping = mapping; Meeting recurrenceAppointment = new Meeting(); recurrenceAppointment.From = startTime; recurrenceAppointment.To = endTime; recurrenceAppointment.EventName = "Daily Occurs"; recurrenceAppointment.Color = Color.Blue; recurrenceAppointment.RecurrenceRule = "FREQ=DAILY;COUNT=20"; recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <Calendar> { exceptionDate1, exceptionDate2, exceptionDate3 }; scheduleAppointmentCollection.Add(recurrenceAppointment); //Adding schedule appointment collection to SfSchedule appointments schedule.ItemsSource = scheduleAppointmentCollection; linearLayout.AddView(schedule); SetContentView(linearLayout); }