Beispiel #1
0
        //删除、推送一条文章按钮
        protected void repList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                if (e.CommandName == "Delete")
                {
                    int       articleId        = Convert.ToInt32(e.CommandArgument);
                    string    delImg           = "";
                    string    delImg_huandeng1 = "";
                    string    delHtml          = "";
                    DataTable dtDel            = artBll.SelectToDataTable("select * from t_article where id=" + articleId);
                    if (dtDel.Rows.Count > 0)
                    {
                        delImg           = dtDel.Rows[0]["pic"].ToString();           //文章图片
                        delImg_huandeng1 = dtDel.Rows[0]["huandeng1_pic"].ToString(); //文章幻灯图片
                        delHtml          = dtDel.Rows[0]["html"].ToString();          //文章静态页

                        bool isOk = DeleteOneArticle(articleId);                      //执行删除操作

                        if (isOk)
                        {
                            string strPath = HttpRuntime.AppDomainAppPath.ToString() + @ConfigurationManager.AppSettings["Article_File"].ToString() + delImg;       //删除原图
                            CommonMethod.FilePicDelete(strPath);
                            strPath = HttpRuntime.AppDomainAppPath.ToString() + @ConfigurationManager.AppSettings["Article_File"].ToString() + "100_100_" + delImg; //删除缩略图
                            CommonMethod.FilePicDelete(strPath);

                            strPath = HttpRuntime.AppDomainAppPath.ToString() + @ConfigurationManager.AppSettings["hd1"].ToString() + delImg_huandeng1;//删除幻灯图片
                            CommonMethod.FilePicDelete(strPath);

                            strPath = HttpRuntime.AppDomainAppPath.ToString() + delHtml;//删除静态页
                            CommonMethod.FilePicDelete(strPath);


                            InText.AlertAndRedirect("删除成功!", Request.Url.ToString());//刷新当前页
                        }
                        else
                        {
                            InText.AlertAndRedirect("删除失败,请重试!", Request.Url.ToString());//刷新当前页
                        }
                    }
                }
                if (e.CommandName == "ts_baidu")//执行推送百度
                {
                    //string[] array = e.CommandArgument.ToString().Split('|');
                    //int art_id = Utils.CheckInt(array[0]);
                    //string html = array[1];
                    //SEO seo = new SEO();
                    //string resultStr = seo.TS_baidu(art_id, html);
                    //InText.AlertAndRedirect(resultStr, Request.Url.ToString());

                    string[] array  = e.CommandArgument.ToString().Split('|');
                    int      art_id = Utils.CheckInt(array[0]);
                    string   html   = array[1];
                    SEO      seo    = new SEO();

                    if (Request.Url.ToString().Contains("http://www.up927.com/"))
                    {
                        string resultStr = seo.TS_baidu(art_id, html);
                        InText.AlertAndRedirect(resultStr, Request.Url.ToString());
                    }
                    else
                    {
                        InText.AlertAndRedirect("本地不能推送百度", Request.Url.ToString());
                    }
                }
            }
        }