Пример #1
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString();

            int      typeid       = 0;
            DateTime articlePtime = DateTime.Now;

            modelarticle = bllarticle.GetModel(Convert.ToInt32(id));
            if (modelarticle != null)
            {
                typeid       = Convert.ToInt32(modelarticle.dbo_Typeid);
                articlePtime = Convert.ToDateTime(modelarticle.dbo_Ptime);
            }

            bllarticle.Delete(Convert.ToInt32(id));
            bllarticleimg.DeleteByArticleId(Convert.ToInt32(id));

            string strDir = sys.getSpcDir(Convert.ToInt32(spcId));

            if (typeid != 0)
            {
                sys.deleteArticleFile(Convert.ToInt32(id), strDir, articlePtime);
            }

            if (sys.IsStatic)
            {
                if (typeid != 0)
                {
                    sys.ToStaticListWithArticleEdit(typeid, strDir);
                }
            }
            else//判断是否需要生成首页
            {
                sys.ToStaticPageWithActive(Convert.ToInt32(spcId));
            }
            this.BindData();
        }