search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Scheduler Tutorial: Hotel Room Booking. Left Resize doesn't work??? Right Resize works

Asked by Anonymous
12 years ago.

I have downloaded and ran the following demo.
http://www.daypilot.org/page/att/olomeclpevaltjjzduachy2fiu/TutorialHotel.20121015.zip

It runs very well.
But when I try to drag the left side an event to the left ,it doesn't work. After the red bar with loading displays, nothing have changed.
Oddly when I try to drag the right side of an event, everything works and the event end time is extended.

I try it on new event, event that start next month, but dragging the left side of an event to change the start time still does not work

And the only way to change the start time of an event is to click the event and edit the start time.

Is there any way to change the start time of an event by dragging the left size?

Thanks!

Answer posted by Dan Letecky [DayPilot]
12 years ago.

It looks like there is a bug in the EventResize event handler. If you modify it like this it will work fine:

    protected void DayPilotScheduler1_EventResize(object sender, DayPilot.Web.Ui.Events.EventResizeEventArgs e)
    {
        string id = e.Value;
        DateTime start = e.NewStart;
        DateTime end = e.NewEnd;
        string resource = e.Resource;

        string message = null;

        if (!dbIsFree(id, start, end, resource))
        {
            message = "The reservation cannot overlap with an existing reservation.";
        }
        else if (e.OldEnd <= DateTime.Today)
        {
            message = "This reservation cannot be changed anymore.";
        }
        else if (e.OldStart != e.NewStart)
        {
            if (e.OldStart < DateTime.Today)
            {
               message = "The reservation start cannot be changed anymore.";
            }
            else if (e.NewStart < DateTime.Today)
            {
                message = "The reservation cannot be moved to the past.";
            }
            else
            {
                dbUpdateEvent(id, start, end, resource);
            }
        }
        else
        {
            dbUpdateEvent(id, start, end, resource);
            //message = "Reservation updated.";
        }

        DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
        DayPilotScheduler1.DataBind();
        DayPilotScheduler1.Update(message);
    }

Note the missing "else { dbUpdateEvent(id, start, end, resource); }" block inside "else if (e.OldStart != e.NewStart)".

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.