protected void DayPilotCalendar1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
        {
            switch (e.Command)
            {
            case "navigate":
                DateTime start = (DateTime)e.Data["start"];
                DayPilotCalendar1.StartDate = start;
                DateTime end = DayPilotCalendar1.EndDate.AddDays(1);
                DayPilotCalendar1.DataSource = new EventDataManager().getEvents(userid, start, end);
                DayPilotCalendar1.DataBind();
                DayPilotCalendar1.Update(DayPilot.Web.Ui.Enums.CallBackUpdateType.Full);
                break;

            case "refresh":
                LoadEvents();

                if (e.Data != null && e.Data["message"] != null)
                {
                    DayPilotCalendar1.UpdateWithMessage((string)e.Data["message"]);
                }
                else
                {
                    DayPilotCalendar1.UpdateWithMessage("Updated.");
                }
                break;
            }
        }
Example #2
0
    protected void DayPilotCalendar1_EventMove(object sender, EventMoveEventArgs e)
    {
        #region Simulation of database update

        DataRow dr = table.Rows.Find(e.Id);

        // recurrent event but no exception
        if (e.Recurrent && !e.RecurrentException)
        {
            DataRow master = table.Rows.Find(e.RecurrentMasterId);

            dr               = table.NewRow();
            dr["id"]         = Guid.NewGuid().ToString();
            dr["name"]       = master["name"];
            dr["start"]      = e.NewStart;
            dr["end"]        = e.NewEnd;
            dr["recurrence"] = RecurrenceRule.EncodeExceptionModified(e.RecurrentMasterId, e.OldStart);
            table.Rows.Add(dr);
            table.AcceptChanges();
        }
        // recurrent exception or regular event
        else if (dr != null)
        {
            dr["start"] = e.NewStart;
            dr["end"]   = e.NewEnd;
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event moved.");
    }
Example #3
0
 private void InsertDataCalendar(DateTime start, DateTime end)
 {
     Dal.ExeSp("SetCalendar", "1", start, end, "New Event", "0");
     FillCalendar();
     DayPilotCalendar1.DataBind();
     DayPilotCalendar1.UpdateWithMessage("New event created.");
 }
Example #4
0
    protected void DayPilotCalendar1_EventResize(object sender, EventResizeEventArgs e)
    {
        // not allowed to resize event no 7
        if (e.Id == "7")
        {
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("It's not allowed to resize this event. It was forbidded in the EventResize handler on the server side.");
            return;
        }

        #region Simulation of database update

        DataRow dr = table.Rows.Find(e.Id);
        if (dr != null)
        {
            dr["start"] = e.NewStart;
            dr["end"]   = e.NewEnd;
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event resized");
    }
Example #5
0
    protected void DayPilotCalendar1_EventResize(object sender, EventResizeEventArgs e)
    {
        Dal.ExeSp("SetCalendar", "2", e.NewStart, e.NewEnd, e.Text, e.Value);
        FillCalendar();

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event resized");
    }
Example #6
0
    // עריכה
    protected void DayPilotCalendar1_EventEdit(object sender, EventEditEventArgs e)
    {
        Dal.ExeSp("SetCalendar", "2", e.Start, e.End, e.NewText, e.Value);
        FillCalendar();



        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event text changed.");
    }
Example #7
0
    protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e)
    {
        switch (e.Command)
        {
        case "navigate":
            DateTime start = (DateTime)e.Data["start"];
            DateTime end   = (DateTime)e.Data["end"];
            DateTime day   = (DateTime)e.Data["day"];   // clicked day

            DayPilotCalendar1.StartDate = start;
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Date changed. You clicked: " + day);
            break;

        case "refresh":
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Refreshed.");
            break;

        case "paste":
            DateTime pasteHere = (DateTime)e.Data["start"];
            string   id        = (string)e.Data["id"];

            DataRow dr = table.Select("id=" + id)[0];
            if (dr != null)
            {
                TimeSpan duration = ((DateTime)dr["end"]) - ((DateTime)dr["start"]);

                Dal.ExeSp("SetCalendar", "1", pasteHere, pasteHere + duration, "Copy of " + dr["name"].ToString(), "0");
                FillCalendar();


                //DataRow drNew = table.NewRow();
                //drNew["start"] = pasteHere;
                //drNew["end"] = pasteHere + duration;
                //drNew["id"] = Guid.NewGuid().ToString();
                //drNew["name"] = "Copy of " + dr["name"];

                //table.Rows.Add(drNew);
                //table.AcceptChanges();
            }
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Event copied.");
            break;

        case "test":
            DayPilotCalendar1.CellDuration = 60;
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Updated");
            break;
        }
    }
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FillCalendar();

        if (!IsPostBack)
        {
            DataBind();
            DayPilotCalendar1.UpdateWithMessage("Welcome!");
        }

        Hashtable data = new Hashtable();

        data["navigatorRefresh"] = true;
        DayPilotCalendar1.Update(data);
    }
Example #9
0
    protected void DayPilotCalendar1_EventMove(object sender, EventMoveEventArgs e)
    {
        #region Simulation of database update

        DataRow dr = table.Rows.Find(e.Id);
        if (dr != null)
        {
            dr["start"] = e.NewStart;
            dr["end"]   = e.NewEnd;
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.UpdateWithMessage("Event moved.");
    }
Example #10
0
    protected void DayPilotCalendar1_TimeRangeDoubleClick(object sender, TimeRangeDoubleClickEventArgs e)
    {
        #region Simulation of database update
        DataRow dr = table.NewRow();
        dr["start"] = e.Start;
        dr["end"]   = e.End;
        dr["id"]    = Guid.NewGuid().ToString();
        dr["name"]  = "New event";

        table.Rows.Add(dr);
        table.AcceptChanges();
        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("New event created.");
    }
Example #11
0
    protected void DayPilotCalendar1_EventDelete(object sender, EventDeleteEventArgs e)
    {
        #region Simulation of database update

        DataRow dr = table.Rows.Find(e.Id);
        if (dr != null)
        {
            table.Rows.Remove(dr);
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event deleted.");
    }
Example #12
0
    protected void DayPilotCalendar1_EventEdit(object sender, EventEditEventArgs e)
    {
        #region Simulation of database update

        DataRow dr = table.Rows.Find(e.Id);
        if (dr != null)
        {
            dr["name"] = e.NewText;
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Event text changed.");
    }
Example #13
0
    protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e)
    {
        switch (e.Command)
        {
        case "navigate":
            DateTime start = (DateTime)e.Data["start"];
            DateTime end   = (DateTime)e.Data["end"];

            DayPilotCalendar1.StartDate = start;
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.Update();
            break;

        case "refresh":
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Refreshed.");
            break;

        case "paste":
            DateTime pasteHere = (DateTime)e.Data["start"];
            string   id        = (string)e.Data["id"];

            DataRow dr = table.Rows.Find(id);
            if (dr != null)
            {
                TimeSpan duration = ((DateTime)dr["end"]) - ((DateTime)dr["start"]);

                DataRow drNew = table.NewRow();
                drNew["start"] = pasteHere;
                drNew["end"]   = pasteHere + duration;
                drNew["id"]    = Guid.NewGuid().ToString();
                drNew["name"]  = "Copy of " + dr["name"];

                table.Rows.Add(drNew);
                table.AcceptChanges();
            }
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Event copied.");
            break;

        case "test":
            string val = (string)DayPilotCalendar1.ClientState["test"];
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("ClientState['test'] = " + val);
            break;
        }
    }
Example #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region Data loading initialization
        if (Session["AllFeatures"] == null)
        {
            Session["AllFeatures"] = DataGeneratorCalendar.GetData();
        }
        table = (DataTable)Session["AllFeatures"];
        DayPilotCalendar1.DataSource = Session["AllFeatures"];
        #endregion

        if (!IsPostBack)
        {
            DataBind();
            DayPilotCalendar1.UpdateWithMessage("Welcome!");
        }
    }
Example #15
0
    protected void DayPilotCalendar1_EventMove(object sender, EventMoveEventArgs e)
    {
        #region Simulation of database update

        //throw new Exception("old resource: " + e.OldResource);

        DataRow dr = table.Rows.Find(e.Id);
        if (dr != null)
        {
            dr["start"]  = e.NewStart;
            dr["end"]    = e.NewEnd;
            dr["column"] = e.NewResource;
            table.AcceptChanges();
        }

        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.UpdateWithMessage("Moved from " + e.OldResource + " to " + e.NewResource);
    }
Example #16
0
    protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e)
    {
        if (DayPilotCalendar1.SelectedEvents.Count > 0)
        {
            EventInfo ei = DayPilotCalendar1.SelectedEvents[0];
            DayPilotCalendar1.SelectedEvents.RemoveAt(0);
            DayPilotCalendar1.DataBind();
            DayPilotCalendar1.UpdateWithMessage("Event removed from selection: " + ei.Text);
        }


        /*
         * foreach(EventInfo ei in DayPilotCalendar1.SelectedEvents)
         * {
         *  list += ei.Value + ":";
         * }
         * */



        //throw new Exception(list);
    }
Example #17
0
 protected void DayPilotCalendar1_OnEventDoubleClick(object sender, EventClickEventArgs e)
 {
     DayPilotCalendar1.UpdateWithMessage("Doubleclick");
 }