Timeslot unaviable not being concentraed to just the resource selected in code.

3 posts, 0 answers
  1. Philip
    Philip avatar
    69 posts
    Member since:
    Mar 2016

    Posted 27 Mar Link to this post

    Ok so i have got unavailable times working following the code found elsewhere in this form but for some reason it is not being specific to the Resource
    01./// <param name="e">The <see cref="TimeSlotCreatedEventArgs"/> instance containing the event data.</param>
    02.    protected void apertureAppointments_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
    03.    {
    04.        foreach (DateTime dt in SpecialDays)
    05. 
    06.        {
    07.            if (DateTime.Compare(e.TimeSlot.Start.Date, dt) == 0)
    08.            {
    09.                //Set the CssClass property to visually distinguish your special days.
    10.                e.TimeSlot.CssClass = "Disabled";
    11.            }
    12. 
    13. 
    14. 
    15. 
    16.        }
    17. 
    18.          
    19.        List<Resource> resources = new List<Resource>(apertureAppointments.Resources.GetResourcesByType("Managers"));
    20.        Resource res = resources[5];
    21. 
    22.        DateTime dt1 = DateTime.Parse("2016/03/25 10:00");
    23.        DateTime dt2 = DateTime.Parse("2016/03/25 16:00");
    24.        if (res.Text == "Adam Adair")
    25.        {
    26.            if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2))
    27.            {
    28.                e.TimeSlot.CssClass = "UnavailableCssStyle";
    29.            }
    30.        }
    31.    }

     

     

    This is the last element of a long running project and if can get this working they will be very please is their anyway to add a icon to represent a holiday?.

     

  2. Philip
    Philip avatar
    69 posts
    Member since:
    Mar 2016

    Posted 28 Mar in reply to Philip Link to this post

    I have got a we bit futher but still it is causing this error. I have encllosed an anmitated screenshot showing the probelm that I am having with the above.

     

    01./// <summary>
    02.       /// Handles the TimeSlotCreated event of the apertureAppointments control.
    03.       /// </summary>
    04.       /// <param name="sender">The source of the event.</param>
    05.       /// <param name="e">The <see cref="TimeSlotCreatedEventArgs"/> instance containing the event data.</param>
    06.       protected void apertureAppointments_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
    07.       {
    08. 
    09.           int i = 0;
    10.           bool isFound = false;
    11.           List<tblApertureNetShiftPattern> _list = new List<tblApertureNetShiftPattern>();
    12.           _list = _dal.getHolidays();
    13.           List<Resource> resources = new List<Resource>(apertureAppointments.Resources.GetResourcesByType("Managers"));
    14.           Resource res = resources[5];
    15. 
    16.           foreach (tblApertureNetShiftPattern sp in _list)
    17.           {
    18. 
    19.               if (_list.Count > 1)
    20.                   i++;
    21.               else
    22.                   i = 0;
    23. 
    24.               DateTime? dt1 = _list[i].startdate;
    25.               DateTime? dt2 = _list[i].endDate;
    26.               if (sp.manager_name == "Adam Adair" && res.Text == "Adam Adair")
    27.               {
    28.                   isFound = true;
    29.                   if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == true)
    30.                   {
    31.                       e.TimeSlot.CssClass = "UnavailableCssStyle";
    32.                       dt1 = null;
    33.                       dt2 = null;
    34.                       isFound = false;
    35.                   }
    36.               }
    37.               else if (sp.manager_name == "Clare Coyle" && res.Text == "Clare Coyle")
    38.               {
    39.                   if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == false)
    40.                   {
    41.                       e.TimeSlot.CssClass = "UnavailableCssStyle";
    42.                   }
    43.               }
    44.               else if (sp.manager_name == "Christine Clarke" && res.Text == "Christine Clarke" )
    45.               {
    46.                   if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == false)
    47.                   {
    48.                       e.TimeSlot.CssClass = "UnavailableCssStyle";
    49.                   }
    50.               }
    51.               else if (sp.manager_name == "Conan Keenan" && res.Text == "Conan Keenan" && isFound == false)
    52.               {
    53.                   if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == false)
    54.                   {
    55.                       e.TimeSlot.CssClass = "UnavailableCssStyle";
    56.                   }
    57.               }
    58.               else if (sp.manager_name == "Susie McCormick" && res.Text == "Susie McCormick" )
    59.               {
    60.                   if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == false)
    61.                   {
    62.                       e.TimeSlot.CssClass = "UnavailableCssStyle";
    63.                   }
    64.               }
    65.           }
    66.       }

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    290 posts

    Posted 30 Mar Link to this post

    Hello Philip,

    We will need more details from your implementation of the RadScheduler control. May I ask you to open a support ticket and send us a runnable sample project demonstrating the problem? This way we will be able to troubleshoot it locally and provide you with the most appropriate solution for your case.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top