protected void tkrsVacations_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                // Validate if the user can delete older vacations
                if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_FULL_EDITING"])) && (e.Appointment.Start < DateTime.Now))
                {
                    e.Appointment.AllowEdit = false;
                    ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('You can not edit older vacations. Please contact your system adminitrator.');", true);
                    e.Cancel = true;
                }
                else
                {
                    Page.Validate();
                    if (Page.IsValid)
                    {
                        if (e.Cancel == false)
                        {
                            // Edit information
                            int vacationId = Convert.ToInt32(e.ModifiedAppointment.ID);

                            double takenDay = 0;

                            VacationsInformationDaysInformationGateway vacationsInformationDaysInformationGateway = new VacationsInformationDaysInformationGateway(vacationsInformationTDS);
                            string oldPaymentType = vacationsInformationDaysInformationGateway.GetPaymentType(vacationId);

                            switch (e.ModifiedAppointment.Subject)
                            {
                                case "Half Vacation Day":
                                    if (oldPaymentType == "Full Vacation Day")
                                    {
                                        takenDay = -0.5;
                                    }
                                    else
                                    {
                                        if (oldPaymentType == "Unpaid Leave Full Day")
                                        {
                                            takenDay = 0.5;
                                        }
                                        else
                                        {
                                            if (oldPaymentType == "Unpaid Leave Half Day")
                                            {
                                                takenDay = 0.0;
                                            }
                                        }
                                    }
                                    break;

                                case "Full Vacation Day":
                                    if (oldPaymentType == "Half Vacation Day")
                                    {
                                        takenDay = 0.5;
                                    }
                                    else
                                    {
                                        if (oldPaymentType == "Unpaid Leave Full Day")
                                        {
                                            takenDay = 1;
                                        }
                                        else
                                        {
                                            if (oldPaymentType == "Unpaid Leave Half Day")
                                            {
                                                takenDay = 1;
                                            }
                                        }
                                    }
                                    break;

                                case "Unpaid Leave Full Day":
                                    if (oldPaymentType == "Full Vacation Day")
                                    {
                                        takenDay = -1;
                                    }
                                    else
                                    {
                                        if (oldPaymentType == "Half Vacation Day")
                                        {
                                            takenDay = -0.5;
                                        }
                                        else
                                        {
                                            if (oldPaymentType == "Unpaid Leave Half Day")
                                            {
                                                takenDay = 0.0;
                                            }
                                        }
                                    }
                                    break;

                                case "Unpaid Leave Half Day":
                                    if (oldPaymentType == "Full Vacation Day")
                                    {
                                        takenDay = -1;
                                    }
                                    else
                                    {
                                        if (oldPaymentType == "Half Vacation Day")
                                        {
                                            takenDay = -0.5;
                                        }
                                        else
                                        {
                                            if (oldPaymentType == "Unpaid Leave Full Day")
                                            {
                                                takenDay = 0.0;
                                            }
                                        }
                                    }
                                    break;
                            }

                            VacationsInformationDaysInformation vacationsInformationDaysInformation = new VacationsInformationDaysInformation(vacationsInformationTDS);
                            vacationsInformationDaysInformation.Update(vacationId, e.ModifiedAppointment.Subject);

                            // Store dataset
                            Session["vacationsInformationTDS"] = vacationsInformationTDS;
                            Session["vacationDaysInformation"] = vacationsInformationTDS.DaysInformation;

                            tkrsVacations.DataBind();

                            double newRemainingVacationDays = double.Parse(tbxRemaining.Text) - takenDay;
                            tbxRemaining.Text = newRemainingVacationDays.ToString();

                            if (double.Parse(tbxRemaining.Text) < 0)
                            {
                                ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('You are requesting more vacation than the assigned. If you continue this will be discounted the next year. Please review your information.');", true);
                            }
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
            else
            {
                e.Cancel = true;
            }
        }