void btnDelete_Click(object sender, EventArgs e) { try { bool isDeleted = false; foreach (GridDataItem data in grid.SelectedItems) { int typeId = Convert.ToInt32(data.GetDataKeyValue("NewsTypeID")); CheckBox cbDelete = (CheckBox)data.FindControl("cbDelete"); bool isDel = Convert.ToBoolean(data.GetDataKeyValue("IsDel")); KLNewsType newType = new KLNewsType(typeId); if (newType != null && newType.NewsTypeID != -1) { newType.IsDelected = true; newType.Save(); isDeleted = true; } } if (isDeleted) { SiteUtils.QueueIndexing(); grid.Rebind(); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); } } catch (Exception ex) { log.Error(ex); } }
private void PopulateControls() { SiteUser current = SiteUtils.GetCurrentSiteUser(); if (current != null) { KLAuthor author = KLAuthor.GetKLAuthorByUserID(current.UserId); GeneralVariables.NameAuthor = current.Name; GeneralVariables.Level = author.LevelAuthor; if (news != null) { shortcontent.Content = news.BriefContent; fullcontent.Content = news.FullContent; newstitle.Text = news.Title; KLNewsType temp = new KLNewsType(KLnews.NewType); ddlnewtype.SelectedValue = temp.ParentID.ToString(); ddlnewtypechild.SelectedValue = temp.NewsTypeID.ToString(); } else { litabimages.Visible = false; } } else { WebUtils.SetupRedirect(this, SiteRoot); } }
protected void btnDelete_Click(object sender, EventArgs e) { if (newsType != null && newsType.NewsTypeID > 0) { LogActivity.Write("Delete news category ", newsType.Name); KLNewsType.Delete(newsType.NewsTypeID); WebUtils.SetupRedirect(this, SiteRoot + "/Custtom/NewTypeList.aspx"); } }
void grid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { bool isApplied = gridPersister.IsAppliedSortFilterOrGroup; int iCount = KLNewsType.GetCount(); int startRowIndex = isApplied ? 1 : grid.CurrentPageIndex + 1; int maximumRows = isApplied ? iCount : grid.PageSize; grid.DataSource = KLNewsType.GetPage(startRowIndex, maximumRows, out iCount); }
protected string getNewsTypeName(string id) { if (id == "-1") { return("Gốc"); } var newsType = new KLNewsType(int.Parse(id)); return(newsType.Name); }
protected virtual void PopulateLabels() { //fullcontent.WebEditor.ToolBar = ToolBar.FullWithTemplates; //fullcontent.WebEditor.Height = Unit.Pixel(500); //shortcontent.WebEditor.ToolBar = ToolBar.FullWithTemplates; //shortcontent.WebEditor.Height = Unit.Pixel(500); ddlnewtype.DataSource = KLNewsType.GetAll().Where(kt => kt.ParentID == -1); ddlnewtype.DataBind(); ddlnewtypechild.DataSource = KLNewsType.GetAll().Where(nt => nt.ParentID.ToString() == ddlnewtype.SelectedValue); ddlnewtypechild.DataBind(); }
private void LoadParams() { PageId = WebUtils.ParseInt32FromQueryString("pageid", PageId); ModuleId = WebUtils.ParseInt32FromQueryString("mid", ModuleId); typeId = WebUtils.ParseInt32FromQueryString("TypeID", typeId); if (typeId > -1) { newsType = new KLNewsType(typeId); } HideControls(); }
protected List <KLNewsType> GetNewsType(int newsTypeID) { List <KLNewsType> lstNewsType = new List <KLNewsType>(); var newsType = new KLNewsType(newsTypeID); if (newsType.ParentID > 0) { var newsTypeParent = new KLNewsType(newsType.ParentID); lstNewsType.Add(newsTypeParent); } lstNewsType.Add(newsType); return(lstNewsType); }
private int Save() { Page.Validate("NewType"); if (!Page.IsValid) { return(-1); } if (newsType == null) { newsType = new KLNewsType(); } newsType.Name = txtName.Text; newsType.Url = txtUrl.Text; if (ddlParent.SelectedValue != "Gốc") { newsType.ParentID = int.Parse(ddlParent.SelectedValue); } // newsType.IsDelected = ckDelete.Checked; newsType.Save(); if (newsType.NewsTypeID > 0) { LogActivity.Write("Update news category ", newsType.Name); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "UpdateSuccessMessage"); } else { LogActivity.Write("Create new news category ", newsType.Name); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "InsertSuccessMessage"); } return(newsType.NewsTypeID); }
private void Ddlnewtype_SelectedIndexChanged(object sender, EventArgs e) { ddlnewtypechild.DataSource = KLNewsType.GetAll().Where(nt => nt.ParentID.ToString() == ddlnewtype.SelectedValue); ddlnewtypechild.DataBind(); }
private void getNewsType() { ddlParent.DataSource = KLNewsType.GetAll().Where(p => p.IsDelected != true).ToList(); ddlParent.DataBind(); }