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; } }
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(); Hashtable ht = new Hashtable(); ht["message"] = "Event moved."; ht["id"] = e.Id; DayPilotCalendar1.Update(ht); }
private void LoadCalendarData(int selectedBarberId = 0) // selectedBarberId default value is 0, which means loading data for all barbers { if (appointments == null) { if (selectedBarberId == 0) { LoadAppointmentsOfCurrentCustomer(); } else { LoadAppointmentsOfCurrentCustomerAndSelectedBarberId(selectedBarberId); } } DayPilotCalendar1.DataSource = appointments; DayPilotCalendar1.DataStartField = "appointment_start"; DayPilotCalendar1.DataEndField = "appointment_end"; DayPilotCalendar1.DataIdField = "appointmentID"; DayPilotCalendar1.DataTextField = "customer_name"; DayPilotCalendar1.DataTagFields = "appointment_status"; DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); }
private void UpdatePage(string roomName) { var room = GetRoom(roomName, _startDate, _endDate); lblLastUpdateTime.Text = $"Updated {room.LastUpdate.ToString("h:mm:ss tt")}"; lblTemp.Text = $"{room.Temperature.ToString()}°F"; lblHumidity.Text = $"{room.Humidity.ToString()}%"; if (room.Motion) { lblMotion.Text = "Occupied"; lblMotion.ForeColor = System.Drawing.Color.Red; } else { lblMotion.Text = "Unoccupied"; lblMotion.ForeColor = System.Drawing.Color.Green; } DayPilotCalendar1.DataSource = room.Events; DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); }
// מחיקה protected void DayPilotCalendar1_EventMenuClick(object sender, EventMenuClickEventArgs e) { if (e.Command == "Delete") { //#region Simulation of database update //DataRow dr = table.Rows.Find(e.Value); //if (dr != null) //{ // table.Rows.Remove(dr); // table.AcceptChanges(); //} //#endregion Dal.ExeSp("SetCalendar", "3", e.Start, e.End, e.Text, e.Value); FillCalendar(); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(); } }
protected void DayPilotCalendar1_EventSelect(object sender, DayPilotEventArgs e) { DayPilotCalendar1.Update(); }
protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e) { DayPilotCalendar1.Update(); }
protected void DayPilotCalendar1_Refresh(object sender, RefreshEventArgs e) { DayPilotCalendar1.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(e.StartDate); DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update(CallBackUpdateType.Full); }
protected void DayPilotCalendar1_EventDelete(object sender, EventDeleteEventArgs e) { #region Simulation of database update DataRow dr = table.Rows.Find(e.Id); if (e.Recurrent) { if (e.RecurrentException) // replace this exception with a deleted exception { if (dr != null) { // save the original start DateTime start = RecurrenceRule.DecodeStart((string)dr["recurrence"]); // delete the "modified" exception table.Rows.Remove(dr); table.AcceptChanges(); // add "deleted" exception dr = table.NewRow(); dr["id"] = Guid.NewGuid().ToString(); dr["start"] = start; dr["end"] = start; dr["recurrence"] = RecurrenceRule.EncodeExceptionDeleted(e.RecurrentMasterId, start); table.Rows.Add(dr); table.AcceptChanges(); } } else { // not an exception, look for the request string which = (string)e.Data["which"]; switch (which) { case "this": // add "deleted" exception 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(); break; case "series": // delete the master DataRow master = table.Rows.Find(e.RecurrentMasterId); table.Rows.Remove(master); // delete all exceptions string prefix = RecurrenceRule.Prefix(e.RecurrentMasterId); DataRow[] rows = table.Select(String.Format("recurrence like '{0}%'", prefix)); foreach (DataRow r in rows) { table.Rows.Remove(r); } table.AcceptChanges(); break; } } } else { if (dr != null) { table.Rows.Remove(dr); table.AcceptChanges(); } } #endregion DayPilotCalendar1.DataBind(); DayPilotCalendar1.Update("Event deleted."); }