Ejemplo n.º 1
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.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;
            dr["column"] = e.NewResource;
            table.AcceptChanges();
        }
        else // moved from outside
        {
            dr           = table.NewRow();
            dr["start"]  = e.NewStart;
            dr["end"]    = e.NewEnd;
            dr["id"]     = e.Id;
            dr["name"]   = e.Text;
            dr["column"] = e.NewResource;

            table.Rows.Add(dr);
            table.AcceptChanges();
        }

        #endregion

        setDataSourceAndBind();

        //DayPilotScheduler1.ScrollX = 2900;
        DayPilotScheduler1.UpdateWithMessage("Event moved.");
    }
Ejemplo n.º 2
0
 protected void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
 {
     dbUpdateEvent(e.Value, e.NewStart, e.NewEnd);
     DayPilotCalendar1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate, DayPilotCalendar1.Days);
     DayPilotCalendar1.DataBind();
     DayPilotCalendar1.Update();
 }
Ejemplo n.º 3
0
    protected void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.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();
        }
        else
        {
            dr          = table.NewRow();
            dr["start"] = e.NewStart;
            dr["end"]   = e.NewEnd;
            dr["id"]    = e.Id;
            dr["name"]  = e.Text;

            table.Rows.Add(dr);
            table.AcceptChanges();
        }


        #endregion

        DayPilotCalendar1.DataBind();
        DayPilotCalendar1.Update();
    }
Ejemplo n.º 4
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
    {
        string   id       = e.Value;
        DateTime start    = e.NewStart;
        DateTime end      = e.NewEnd;
        string   resource = e.NewResource;
        string   username = "******";

        //Check weather session variable null or not
        if (Session["UserName"] != null)
        {
            //Retrieving UserName from Session
            username = (string)(Session["UserName"]);
        }
        else
        {
            //Do Something else
        }

        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 < DateTime.Today)
        {
            if (e.OldResource != e.NewResource)
            {
                message = "The room cannot be changed anymore.";
            }
            else
            {
                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, username);
            //message = "Reservation moved.";
        }

        LoadResourcesAndEvents();
        DayPilotScheduler1.UpdateWithMessage(message);
    }
Ejemplo n.º 5
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
    {
        if (Session["Username"].ToString() == "shakil" || Session["Username"].ToString() == "prince" || Session["Username"].ToString() == "Jayanta")
        {
            string   id       = e.Value;
            DateTime start    = e.NewStart;
            DateTime end      = e.NewEnd;
            string   resource = e.NewResource;

            DbUpdateEvent(id, start, end, resource);

            DayPilotScheduler1.DataSource = DbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
            DayPilotScheduler1.DataBind();
            DayPilotScheduler1.Update();
        }
    }
Ejemplo n.º 6
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.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;
            dr["column"] = e.NewResource;
            table.AcceptChanges();
        }

        #endregion

        DayPilotScheduler1.DataBind();
        DayPilotScheduler1.Update();
    }
Ejemplo n.º 7
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
    {
        string   id       = e.Value;
        DateTime start    = e.NewStart;
        DateTime end      = e.NewEnd;
        string   resource = e.NewResource;

        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 < DateTime.Today)
        {
            if (e.OldResource != e.NewResource)
            {
                message = "The room cannot be changed anymore.";
            }
            else
            {
                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);
            //message = "Reservation moved.";
        }

        DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
        DayPilotScheduler1.DataBind();
        DayPilotScheduler1.UpdateWithMessage(message);
    }
Ejemplo n.º 8
0
 protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
 {
     if (e.OldStart >= DateTime.Now && e.NewEnd >= DateTime.Now)
     {
         string   id       = e.Value;
         DateTime start    = e.NewStart;
         DateTime end      = e.NewEnd;
         string   resource = e.NewResource;
         DbUpdateEvent(id, start, end);
         DayPilotScheduler1.DataSource = DbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
         DayPilotScheduler1.DataBind();
         DayPilotScheduler1.UpdateWithMessage("Event moved.");
     }
     else
     {
         DayPilotScheduler1.DataSource = DbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
         DayPilotScheduler1.DataBind();
         DayPilotScheduler1.UpdateWithMessage("TimeOut!!! Event cannot be moved.");
     }
 }
Ejemplo n.º 9
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
    {
        #region Simulation of database update

        if (e.Multimove != null)
        {
            foreach (var me in e.Multimove)
            {
                MoveEvent(me.Id, me.NewStart, me.NewEnd, me.NewResource);
            }
        }
        else
        {
            MoveEvent(e.Id, e.NewStart, e.NewEnd, e.NewResource);
        }

        #endregion

        setDataSourceAndBind();

        //DayPilotScheduler1.ScrollX = 2900;
        DayPilotScheduler1.UpdateWithMessage("Event moved.");
    }
Ejemplo n.º 10
0
    protected void DayPilotScheduler1_EventMove(object sender, DayPilot.Web.Ui.Events.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;
            dr["column"] = e.NewResource;
            table.AcceptChanges();
        }
        else // moved from outside
        {
            dr           = table.NewRow();
            dr["start"]  = e.NewStart;
            dr["end"]    = e.NewEnd;
            dr["id"]     = e.Id;
            dr["name"]   = e.Text;
            dr["column"] = e.NewResource;

            table.Rows.Add(dr);
            table.AcceptChanges();
        }

        #endregion

        Resource r = DayPilotScheduler1.Resources.FindById(e.NewResource);
        if (r.Columns.Count == 0)
        {
            r.Columns.Add(new ResourceColumn());
        }
        r.Columns[0].Html = "Moved here";

        setDataSourceAndBind();
        DayPilotScheduler1.Update("Event moved.");
    }