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 DayPilotScheduler1_OnEventDelete(object sender, EventDeleteEventArgs e) { int id = Convert.ToInt32(e.Id); Db.DeleteAppointmentIfFree(id); LoadAppointments(); }
protected void DayPilotScheduler1_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 setDataSourceAndBind(); DayPilotScheduler1.UpdateWithMessage("Event deleted."); }
protected void DayPilotMonth1_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 DayPilotMonth1.DataSource = getData(DayPilotMonth1.VisibleStart, DayPilotMonth1.VisibleEnd, (string)DayPilotMonth1.ClientState["filter"]); DayPilotMonth1.DataBind(); DayPilotMonth1.UpdateWithMessage("Event deleted."); }
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.Update("Event deleted."); }
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."); }