64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using DevExpress.XtraScheduler;
|
|
|
|
using BeWo.ViewModel;
|
|
|
|
namespace BeWo.Scheduler.View
|
|
{
|
|
public partial class ServiceRecordScheduler
|
|
{
|
|
public ServiceRecordScheduler()
|
|
{
|
|
InitializeComponent();
|
|
|
|
scheduler.ShowBorder = false;
|
|
scheduler.MonthView.GroupType = SchedulerGroupType.Resource;
|
|
scheduler.Storage.EnableReminders = false;
|
|
}
|
|
|
|
//bool IsAppointmentVisible(int labelId) {
|
|
|
|
// return true;
|
|
//}
|
|
|
|
public IList<ServiceRecordVM> ServiceRecordList
|
|
{
|
|
set
|
|
{
|
|
scheduler.Storage.AppointmentStorage.DataSource = CreateServiceRecordAppointmentList(value);
|
|
|
|
if (value != null && value.Count > 0)
|
|
{
|
|
var max = DateTime.MinValue;
|
|
var min = DateTime.MaxValue;
|
|
|
|
foreach (var item in value)
|
|
{
|
|
if (item.StartDate.HasValue)
|
|
{
|
|
if (item.StartDate.Value > max)
|
|
max = item.StartDate.Value;
|
|
if (item.StartDate.Value < min)
|
|
min = item.StartDate.Value;
|
|
}
|
|
}
|
|
|
|
scheduler.Start = max;
|
|
}
|
|
else
|
|
{
|
|
scheduler.Start = DateTime.Now;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static IList<ServiceRecordAppointment> CreateServiceRecordAppointmentList(IEnumerable<ServiceRecordVM> list)
|
|
{
|
|
return list.Select(item => new ServiceRecordAppointment(item)).ToList();
|
|
}
|
|
}
|
|
}
|