protected void Page_Load(object sender, EventArgs e) { long id; if (long.TryParse(Request["id"], out id)) { selectedItem = ScheduledTasksMapper.GetByID(id); if (!IsPostBack) { UpdateFieldsFromObject(); } } this.Page.Title = this.SectionTitle.Text = GetSectionTitle(); }
protected void Save_OnClick(object sender, EventArgs e) { if (selectedItem == null) { selectedItem = ScheduledTasksMapper.CreateObject(); } else { selectedItem = BaseMapper.GetObjectFromContext <ScheduledTask>(selectedItem); } UpdateObjectFromFields(); Return returnObj = BaseMapper.GenerateReturn(""); if (selectedItem.ID == 0) { returnObj = ScheduledTasksMapper.Insert(selectedItem); } else { returnObj = ScheduledTasksMapper.Update(selectedItem); } if (returnObj.IsError) { DisplayErrorMessage("Error Saving Item", returnObj.Error); } else { DisplaySuccessMessage("Successfully Saved Item"); /*var rootDetails = BaseMapper.GetObjectFromContext((MediaDetail)FrameworkBaseMedia.RootMediaDetail); * rootDetails.VirtualPath = URIHelper.GetBaseUrlWithScheduledTask(selectedItem);*/ /*returnObj = MediaDetailsMapper.Update(rootDetails); * * if (!returnObj.IsError) * MediaDetailsMapper.StartUpdateVirtualPathForAllChildren(rootDetails); * else * DisplaySuccessMessage("Error updating root media item");*/ } }
public string DeleteItemPermanently(long id) { var item = BaseMapper.GetObjectFromContext(ScheduledTasksMapper.GetByID(id)); if (item != null) { Return returnObj = ScheduledTasksMapper.DeletePermanently(item); if (returnObj.IsError) { return(jGrowlHelper.GenerateCode(new jGrowlMessage("Error", "Error deleting item permanently", jGrowlMessage.jGrowlMessageType.Error, returnObj.Error), true)); } else { return(jGrowlHelper.GenerateCode(new jGrowlMessage("Success", "Item was successfully deleted permanently", jGrowlMessage.jGrowlMessageType.Success), false)); } } return(""); }