using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToString();
    }
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
    {
        string timestamp = e.Appointment.Attributes["LastModified"];
        if (string.IsNullOrEmpty(timestamp))
        {
            timestamp = "Never";
        }

        // Set the appointment's tooltip to show when the appointment was last modified.
        e.Appointment.ToolTip = "Last modified on: " + timestamp;
    }

    protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
    {
        if (string.IsNullOrEmpty(e.Appointment.Attributes["LastModified"]))
        {
            e.Appointment.Attributes["LastModified"] = "Never";
        }
    }

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        // Disable the LastModified textbox in the advanced form
        if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
        {
            RadTextBox txtModifiedTimeStamp = e.Container.FindControl("AttrLastModified") as RadTextBox;
            if (txtModifiedTimeStamp != null)
            {
                txtModifiedTimeStamp.Enabled = false;
            }
        }
    }

    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
    {
        if (e.Appointment.RecurrenceState == RecurrenceState.Master || e.Appointment.RecurrenceState == RecurrenceState.Occurrence)
        {
            Label recurrenceStateDiv = new Label() { CssClass = "rsAptRecurrence" };
            recurrenceStateDiv.Controls.Add(new Label() { CssClass = "t-font-icon t-i-recurrence" });
            e.Container.Controls.AddAt(0, recurrenceStateDiv);
        }
        if (e.Appointment.RecurrenceState == RecurrenceState.Exception)
        {
            Label recurrenceStateDiv = new Label() { CssClass = "rsAptRecurrence" };
            recurrenceStateDiv.Controls.Add(new Label() { CssClass = "t-font-icon t-i-recurrence-exception" });
            e.Container.Controls.AddAt(0, recurrenceStateDiv);
        }
    }

    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
    {
        e.Appointment.Attributes["LastModified"] = DateTime.Now.ToString();
    }

    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
    {
        e.ModifiedAppointment.Attributes["LastModified"] = DateTime.Now.ToString();
    }

    protected void RadScheduler1_AppointmentClick(object sender, SchedulerEventArgs e)
    {

    }
}
