protected void SaveClicked(object o, EventArgs e) { if (!SecurityContextManager.Current.CurrentURL.Contains("New")) { var se = new ScheduleEventServices().GetByID(((ScheduleEvent)SecurityContextManager.Current.CurrentItem.ItemReference).ID); se.Description = tbDescription.Text; se.EventTypeID = Convert.ToInt16(ddlEventType.SelectedValue); se.IsActive = cbIsActive.Checked; se.Name = tbName.Text; se.StaffID = Convert.ToInt16(ddlStaff.SelectedValue); new ScheduleEventServices().Save(se); Response.Redirect("/Schedules/" + se.ID.ToString()); } else { var se = new ScheduleEvent(); se.Description = tbDescription.Text; se.EventTypeID = Convert.ToInt16(ddlEventType.SelectedValue); se.IsActive = cbIsActive.Checked; se.Name = tbName.Text; se.StaffID = Convert.ToInt16(ddlStaff.SelectedValue); new ScheduleEventServices().Save(se); } LoadEvent(); }
protected void ItemCommand(object o, GridCommandEventArgs e) { if (e.CommandName == RadGrid.InitInsertCommandName) { Response.Redirect("/Schedules/New"); } if (e.CommandName == RadGrid.DeleteCommandName) { var t = new ScheduleEventServices().GetByID((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]); new ScheduleEventServices().Delete(t); } }
public IHttpHandler GetHttpHandler(RequestContext requestContext) { string id = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["id"]); string isnew = HttpUtility.HtmlDecode((string)requestContext.RouteData.Values["new"]); HttpPageHelper.CurrentItem = null; if (!string.IsNullOrEmpty(id)) { var p = new ScheduleEventServices().GetByID(Convert.ToInt32(id)); var item = new Item(); item.Description = p.Name; item.Name = p.Name; item.ItemReference = p; item.SEOTitle = p.Name; HttpPageHelper.CurrentItem = item; } else { var item = new Item(); item.Description = "New Schedule Event"; item.Name = "New Schedule Event"; item.SEOTitle = "New Schedule Event"; item.ItemReference = new ScheduleEvent(); HttpPageHelper.CurrentItem = item; } var cp = new PageServices().GetByNameAccessLevel("Schedule", 60, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"])); HttpPageHelper.CurrentPage = cp; AdminBasePage page; page = (AdminBasePage)BuildManager.CreateInstanceFromVirtualPath("~/Schedule.aspx", typeof(System.Web.UI.Page)); HttpPageHelper.IsValidRequest = true; return(page); }