protected void DayPilotCalendar1_EventResize(object sender, EventResizeEventArgs e) { #region Simulation of database update DataRow dr = table.Rows.Find(e.Id); if (e.Recurrent && !e.RecurrentException) { DataRow master = table.Rows.Find(e.RecurrentMasterId); dr = table.NewRow(); dr["id"] = Guid.NewGuid().ToString(); dr["recurrence"] = RecurrenceRule.EncodeExceptionModified(e.RecurrentMasterId, e.OldStart); dr["start"] = e.NewStart; dr["end"] = e.NewEnd; dr["name"] = master["name"]; table.Rows.Add(dr); table.AcceptChanges(); } else if (dr != null) { dr["start"] = e.NewStart; dr["end"] = e.NewEnd; table.AcceptChanges(); } #endregion DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update("Event resized"); }
protected void DayPilotCalendar1_EventDelete(object sender, EventDeleteEventArgs e) { #region Simulation of database update DataRow dr = table.Rows.Find(e.Id); if (e.Recurrent && !e.RecurrentException) { dr = table.NewRow(); dr["id"] = Guid.NewGuid().ToString(); dr["start"] = e.Start; dr["end"] = e.End; dr["recurrence"] = RecurrenceRule.EncodeExceptionDeleted(e.RecurrentMasterId, e.Start); table.Rows.Add(dr); table.AcceptChanges(); } else if (e.Recurrent && e.RecurrentException && dr != null) { table.Rows.Remove(dr); table.AcceptChanges(); } else if (dr != null) { table.Rows.Remove(dr); table.AcceptChanges(); } #endregion DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update("Event deleted."); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //LoadResources(); SessionManagementService sms = new SessionManagementService(); List <SessionCalendarSlot> aSessions = new List <SessionCalendarSlot>(); List <SessionsListView> sessions = sms.GetTutorSessions().resultObject; aSessions.AddRange( sessions.Select(s => new SessionCalendarSlot() { ID = s.SessionID, CourseName = s.CourseName, StartTime = s.StartDateTime, EndTime = s.EndDateTime, TutorName = s.TutorName, Rating = s.TutorRating })); SessionCalendarSlot[] activeSessions = aSessions.ToArray(); DayPilotCalendar1.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); DayPilotCalendar1.Days = 7; DayPilotCalendar1.DataSource = activeSessions; DayPilotCalendar1.DataBind(); } }
private void LoadCalendarData() { if (_appointments == null) { LoadAppointments(); } OleDbConnection con = ConnectDB.getConStr(); OleDbCommand AppointmentTable = new OleDbCommand("SELECT * FROM Appointment", con); OleDbDataAdapter da = new OleDbDataAdapter(AppointmentTable); con.Open(); DayPilotCalendar1.DataSource = _appointments; DayPilotCalendar1.DataStartField = "AppointmentStart"; DayPilotCalendar1.DataEndField = "AppointmentEnd"; DayPilotCalendar1.DataIdField = "AppointmentId"; DayPilotCalendar1.DataTextField = "AppointmentPatientName"; DayPilotCalendar1.DataTagFields = "AppointmentStatus"; DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); con.Close(); }
private void LoadSessions() { //LoadResources(); List <SessionCalendarSlot> aSessions = new List <SessionCalendarSlot>(); List <SessionsListView> sessions = sms.GetTutorSessions(CurrentUser.Email, CommonEnums.SessionStatus.All).resultObject; SessionCalendarSlot[] activeSessions; if (sessions != null) { aSessions.AddRange( sessions.Select(s => new SessionCalendarSlot() { ID = s.SessionID, CourseName = s.CourseName, StartTime = s.StartDateTime, EndTime = s.EndDateTime, TutorName = s.TutorName, Rating = s.TutorRating, Status = s.Status, MaxStudents = s.MaxStudents, RemainingSeats = s.RegisteredStudents })); activeSessions = aSessions.ToArray(); //DayPilotCalendar1.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); DayPilotCalendar1.Days = 7; //DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month); // Display week, .Day=28 for month /* The data this calnder will display will come from activeSessions*/ DayPilotCalendar1.DataSource = activeSessions; /* Combine the data I gave you with the screen */ DayPilotCalendar1.DataBind(); } }
protected void DayPilotCalendar1_Refresh(object sender, RefreshEventArgs e) { DayPilotCalendar1.StartDate = e.StartDate; defineColumns(); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); }
protected void UpdateAppointmentTime(string id, DateTime start, DateTime end) { try { long lid; if (long.TryParse(id, out lid)) { CalendarData.MoveAppointment(lid, start, end); LoadCalendar(); DataRow dr = table.Rows.Find(id); if (dr != null) { dr["start"] = start; dr["end"] = end; table.AcceptChanges(); } Session["CalendarData"] = table; DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); } } catch (Exception) { throw; } }
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; } }
protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e) { switch (e.Command) { case "previous": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(-7); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); break; case "navigate": DateTime start = (DateTime)e.Data["start"]; DateTime end = (DateTime)e.Data["end"]; DayPilotCalendar1.StartDate = start; //DayPilotCalendar1.Days = (int) (end - start).TotalDays; DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); break; case "refresh": DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); break; } }
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"); }
private void InsertDataCalendar(DateTime start, DateTime end) { Dal.ExeSp("SetCalendar", "1", start, end, "New Event", "0"); FillCalendar(); DayPilotCalendar1.DataBind(); DayPilotCalendar1.UpdateWithMessage("New event created."); }
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(); }
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(); }
protected void DayPilotCalendar1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e) { switch (e.Command) { case "previous": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(-DayPilotCalendar1.Days); break; case "next": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(DayPilotCalendar1.Days); break; case "today": DayPilotCalendar1.StartDate = (DayPilotCalendar1.Days == 7) ? DayPilot.Utils.Week.FirstDayOfWeek(DateTime.Today) : DateTime.Today; break; case "week": DayPilotCalendar1.Days = 7; DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(DayPilotCalendar1.StartDate); break; case "day": DayPilotCalendar1.Days = 1; break; } DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); }
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"); }
protected void ButtonExport_Click(object sender, EventArgs e) { Response.Clear(); Response.ContentType = "image/png"; Response.AddHeader("Content-Disposition", "attachment;filename=print.png"); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Export(ImageFormat.Png).WriteTo(Response.OutputStream); Response.End(); }
private void LoadEvents() { DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(DateTime.Now); DateTime start = DayPilotCalendar1.StartDate; DateTime end = DayPilotCalendar1.EndDate.AddDays(1); DayPilotCalendar1.DataSource = new EventDataManager().getEvents(userid, start, end); DayPilotCalendar1.DataBind(); }
protected void DayPilotCalendar1_EventResize(object sender, DayPilot.Web.Ui.Events.EventResizeEventArgs e) { new EventDataManager().moveEvent(Convert.ToInt32(e.Id), e.NewStart, e.NewEnd); DateTime start = DayPilotCalendar1.StartDate; DateTime end = DayPilotCalendar1.EndDate.AddDays(1); DayPilotCalendar1.DataSource = new EventDataManager().getEvents(userid, start, end); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); }
// עריכה 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."); }
protected void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e) { Response.Write(e.Data); new EventDataManager().moveEvent(int.Parse(e.Id), e.NewStart, e.NewEnd); DateTime start = DayPilotCalendar1.StartDate; DateTime end = DayPilotCalendar1.EndDate.AddDays(1); DayPilotCalendar1.DataSource = new EventDataManager().getEvents(userid, start, end); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); }
protected void ButtonExport_Click(object sender, EventArgs e) { int hourHeight = DayPilotCalendar1.CellHeight * 60 / DayPilotCalendar1.CellDuration; Response.Clear(); Response.ContentType = "image/png"; Response.AddHeader("content-disposition", "attachment;filename=print.png"); MemoryStream img = DayPilotCalendar1.Export(ImageFormat.Png, 9 * hourHeight); img.WriteTo(Response.OutputStream); Response.End(); }
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; } }
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; DayPilotCalendar1.DataSource = dbGetEvents(DayPilotCalendar1.StartDate, DayPilotCalendar1.Days); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(DayPilot.Web.Ui.Enums.CallBackUpdateType.Full); break; } }
protected void DropDownListColWidth_OnSelectedIndexChanged(object sender, EventArgs e) { switch (DropDownListColWidth.SelectedValue) { case "fixed": DayPilotCalendar1.ColumnWidthSpec = ColWidthSpec.Fixed; DayPilotCalendar1.ColumnWidth = 300; break; case "auto": DayPilotCalendar1.ColumnWidthSpec = ColWidthSpec.Auto; break; } DayPilotCalendar1.DataBind(); }
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); }
protected void DayPilotCalendar1_Refresh(object sender, DayPilot.Web.Ui.Events.RefreshEventArgs e) { DayPilotCalendar1.Days = e.Days; if (e.Days == 7) { DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(e.StartDate); } else { DayPilotCalendar1.StartDate = e.StartDate; } DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); }
protected void DayPilotCalendar1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e) { switch (e.Command) { case "previous": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(-7); DayPilotCalendar1.DataBind(); break; case "next": DayPilotCalendar1.StartDate = DayPilotCalendar1.StartDate.AddDays(7); DayPilotCalendar1.DataBind(); break; } }
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."); }
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."); }
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."); }