Different Work Times

2 posts, 0 answers
  1. Shaggy
    Shaggy avatar
    8 posts
    Member since:
    Jul 2013

    Posted 19 Nov 2013 Link to this post

    Hello,

    is it meanwhile possible to make individual work times for each weekday?

    For example:

    Monday 08:00 - 17:00
    Tuesday 08:30 - 18:00
    Wednesday 07:00 - 16:30
    ....


    Greets,
    Shaggy
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 22 Nov 2013 Link to this post

    Hello Zeljko,

    Thank you for contacting Telerik Support.

    RadScheduler supports modification of RulerStartScale and RulerEndScale. But if you display more than one day in the current day view, all days will have the same time frame as they share one common time ruler. In case of one day per view, you can handle navigation to next/previous day and modify the ruler as you wish:
    public Form1()
    {
        InitializeComponent();
     
        Random rand = new Random();
     
        for (int i = 0; i < 15; i++)
        {
            Appointment appointment = new Appointment(DateTime.Now.AddDays(i), TimeSpan.FromMinutes(30), "Summary", "Description");
            appointment.StatusId = rand.Next(1, radScheduler1.Statuses.Count);
            appointment.BackgroundId = rand.Next(1, radScheduler1.Backgrounds.Count);
            this.radScheduler1.Appointments.Add(appointment);
        }
     
        this.radScheduler1.ActiveViewType = SchedulerViewType.Day;
        SchedulerDayView dayView = this.radScheduler1.GetDayView();
        dayView.DayCount = 1;
         
        ModifyRuler();
     
        this.radSchedulerNavigator1.NavigateForwardsClick += radSchedulerNavigator1_NavigateForwardsClick;
        this.radSchedulerNavigator1.NavigateBackwardsClick += radSchedulerNavigator1_NavigateBackwardsClick;
    }
     
    private void radSchedulerNavigator1_NavigateBackwardsClick(object sender, EventArgs e)
    {
        ModifyRuler();
    }
     
    private void radSchedulerNavigator1_NavigateForwardsClick(object sender, EventArgs e)
    {
        ModifyRuler();
    }
     
    private void ModifyRuler()
    {
        SchedulerDayView dayView = this.radScheduler1.GetDayView();
        if (dayView != null)
        {
            switch (dayView.StartDate.Date.DayOfWeek)
            {
                case DayOfWeek.Monday:
                    dayView.RulerStartScale = 8;
                    dayView.RulerEndScale = 17;
                    break;
                case DayOfWeek.Tuesday:
                    dayView.RulerStartScale = 8;
                    dayView.RulerEndScale = 18;
                    dayView.RangeFactor = ScaleRange.HalfHour;
                    break;
                case DayOfWeek.Wednesday:
                    dayView.RulerStartScale = 7;
                    dayView.RulerEndScale = 16;
                    dayView.RangeFactor = ScaleRange.HalfHour;
                    break;
                default:
                    break;
            }
        }
    }

    Currently, the RulerStartScale and RulerEndScale properties can only be set to a whole hour. This behavior cannot be worked around because the internal implementation of RadScheduler relies on the fact that the RulerStartScale and RulerEndScale are whole hours. The best behavior you can achieve is to set these properties with the closest whole hour so that all the work-time cells are visible. However, here is the feature request for the option to set minutes to the RulerStartScale and RulerEndScale properties

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top