Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
 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");
     }
 }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        protected string getNewsTypeName(string id)
        {
            if (id == "-1")
            {
                return("Gốc");
            }
            var newsType = new KLNewsType(int.Parse(id));

            return(newsType.Name);
        }
Beispiel #6
0
 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();
 }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
 private void Ddlnewtype_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlnewtypechild.DataSource = KLNewsType.GetAll().Where(nt => nt.ParentID.ToString() == ddlnewtype.SelectedValue);
     ddlnewtypechild.DataBind();
 }
Beispiel #11
0
 private void getNewsType()
 {
     ddlParent.DataSource = KLNewsType.GetAll().Where(p => p.IsDelected != true).ToList();
     ddlParent.DataBind();
 }