Invert DHXBlockTime

Hi,

I am trying to add availability blocks, hence I want to let users click on only the availability blocks and add DHXBlockTime to the remaining of the calender in units view. Could you please let us know how to block all calender except the specified availability blocks in Units View. I am able to add block time in units view, but is there a way to invert the block time in units view?

 sched.TimeSpans.Add(new DHXBlockTime()
                    {
                        StartDate = DateTime.SpecifyKind(localAvaiability.StartDate, DateTimeKind.Utc),
                        EndDate = DateTime.SpecifyKind(localAvaiability.EndDate, DateTimeKind.Utc),
                        HTML = "Availability",
                        Sections = new List<Section>()
                        {
                            new Section(unitsView1.Name, new string[] {localAvaiability.ResourceId}),
                            new Section(sched.Views[1].Name, new string[] {localAvaiability.ResourceId})
                        }
                    });

Thank you

Hello,
you can invert blocked time if you specify it on day-of-week basis

scheduler.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Monday Zones = new List<Zone>{ new Zone(8*60, 16*60) }, InvertZones = true }); // 00:00-08:00 and 16:00-24:00 will be blocked

But it does not work with Start/EndDate configuration. In this case the only option would be to add a blocked sections for a time before and after allowed-

var startDate = DateTime.SpecifyKind(localAvaiability.StartDate, DateTimeKind.Utc); var endDate = DateTime.SpecifyKind(localAvaiability.EndDate, DateTimeKind.Utc); scheduler.TimeSpans.Add(new DHXBlockTime() { StartDate = startDate.Date,//day start EndDate = startDate//allowed time start }); scheduler.TimeSpans.Add(new DHXBlockTime() { StartDate = endDate,//allowed time end EndDate = endDate.Date.AddDays(1)// day end });

Aliaksandr,

The above mentioned one is working for timespans. How do we rever time zones for units view using the sections in timespans?

You can simply define Sections, it won’t affect the time settings.

scheduler.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Monday Zones = new List<Zone>{ new Zone(8*60, 16*60) }, InvertZones = true, Sections = new List<Section>() { new Section(unitsView1.Name, new string[] {localAvaiability.ResourceId}), new Section(sched.Views[1].Name, new string[] {localAvaiability.ResourceId}) } });