Exemple #1
0
 public override bool Delete(PanelContext data)
 {
     if (data.DataKey["ID"] != null)
     {
         ArticleHelper.DeleteArticle(data.DataKey["ID"].ToString());
     }
     return(true);
 }
Exemple #2
0
        private void grdArticleList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int articleId = (int)this.grdArticleList.DataKeys[e.RowIndex].Value;

            if (ArticleHelper.DeleteArticle(articleId))
            {
                this.BindSearch();
                this.ShowMsg("成功删除了一篇文章", true);
                return;
            }
            this.ShowMsg("删除失败", false);
        }
        private void grdArticleList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int articleId = (int)grdArticleList.DataKeys[e.RowIndex].Value;

            if (ArticleHelper.DeleteArticle(articleId))
            {
                BindSearch();
                ShowMsg("成功删除了一篇文章", true);
            }
            else
            {
                ShowMsg("删除失败", false);
            }
        }
        private void Delete(HttpContext context)
        {
            int value = base.GetIntParam(context, "articleId", false).Value;

            if (value <= 0)
            {
                throw new HidistroAshxException("错误的参数");
            }
            if (ArticleHelper.DeleteArticle(value))
            {
                base.ReturnSuccessResult(context, "删除成功!", 0, true);
                return;
            }
            throw new HidistroAshxException("删除失败!");
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str  = base.Request.QueryString["articletype"];
            string str2 = base.Request.Form["posttype"];
            string s    = base.Request.Form["id"];

            int.TryParse(s, out this.articleid);
            if ((str2 == "del") && (this.articleid > 0))
            {
                base.Response.ContentType = "application/json";
                string    str4   = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                DataSet   set    = ArticleHelper.ArticleIsInWeiXinReply(this.articleid);
                DataTable table  = set.Tables[0];
                DataTable table2 = set.Tables[1];
                DataTable table3 = set.Tables[2];
                if (Globals.ToNum(table.Rows[0][0]) > 0)
                {
                    str4 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“微信->自动回复”中使用。\"}";
                }
                else if (Globals.ToNum(table2.Rows[0][0]) > 0)
                {
                    str4 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“微博->自动回复”中使用。\"}";
                }
                else if (Globals.ToNum(table3.Rows[0][0]) > 0)
                {
                    str4 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“服务窗->自动回复”中使用。\"}";
                }
                else if (ArticleHelper.DeleteArticle(this.articleid))
                {
                    str4 = "{\"type\":\"1\",\"tips\":\"删除成功\"}";
                }
                base.Response.Write(str4);
                base.Response.End();
            }
            else if (str2 == "clearweixin")
            {
                base.Response.ContentType = "application/json";
                WeiXinHelper.ClearWeiXinMediaID();
                string str5 = "{\"type\":\"1\",\"tips\":\"更新成功\"}";
                base.Response.Write(str5);
                base.Response.End();
            }
            else
            {
                this.LoadParameters(str);
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string stype = base.Request.QueryString["articletype"];
            string a     = base.Request.Form["posttype"];
            string s     = base.Request.Form["id"];

            int.TryParse(s, out this.articleid);
            if (a == "del" && this.articleid > 0)
            {
                base.Response.ContentType = "application/json";
                string s2 = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                System.Data.DataSet   dataSet    = ArticleHelper.ArticleIsInWeiXinReply(this.articleid);
                System.Data.DataTable dataTable  = dataSet.Tables[0];
                System.Data.DataTable dataTable2 = dataSet.Tables[1];
                System.Data.DataTable dataTable3 = dataSet.Tables[2];
                if (Globals.ToNum(dataTable.Rows[0][0]) > 0)
                {
                    s2 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“微信->自动回复”中使用。\"}";
                }
                else if (Globals.ToNum(dataTable2.Rows[0][0]) > 0)
                {
                    s2 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“微博->自动回复”中使用。\"}";
                }
                else if (Globals.ToNum(dataTable3.Rows[0][0]) > 0)
                {
                    s2 = "{\"type\":\"0\",\"tips\":\"删除失败,该素材已在栏目“服务窗->自动回复”中使用。\"}";
                }
                else if (ArticleHelper.DeleteArticle(this.articleid))
                {
                    s2 = "{\"type\":\"1\",\"tips\":\"删除成功\"}";
                }
                base.Response.Write(s2);
                base.Response.End();
                return;
            }
            if (a == "clearweixin")
            {
                base.Response.ContentType = "application/json";
                WeiXinHelper.ClearWeiXinMediaID();
                string s3 = "{\"type\":\"1\",\"tips\":\"更新成功\"}";
                base.Response.Write(s3);
                base.Response.End();
                return;
            }
            this.LoadParameters(stype);
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str  = base.Request.QueryString["articletype"];
            string str2 = base.Request.Form["posttype"];
            string s    = base.Request.Form["id"];

            int.TryParse(s, out this.articleid);
            if ((str2 == "del") && (this.articleid > 0))
            {
                base.Response.ContentType = "application/json";
                string str4 = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                if (ArticleHelper.DeleteArticle(this.articleid))
                {
                    str4 = "{\"type\":\"1\",\"tips\":\"删除成功\"}";
                }
                base.Response.Write(str4);
                base.Response.End();
            }
            else
            {
                this.LoadParameters(str);
            }
        }
Exemple #8
0
        protected void DeleteBtn_Click(object sender, EventArgs e)
        {
            if (DemoSiteMessage)
            {
                return;                 //是否是演示站点
            }
            List <string> list = new List <string>();

            list = GetIDs();
            int count = 0;

            if (list.Count > 0)
            {
                foreach (string id in list)
                {
                    try
                    {
                        InsertArticleProcessHistory(id);
                        //ArticleProcessHelper.DelArticleProcess(id);
                        ArticleHelper.DeleteArticle(id);
                        count++;
                    }
                    catch
                    { }
                }
            }
            //记录日志
            string content = string.Format(DateTime.Now.ToString() + "您已经成功删除{0}条记录", count.ToString());

            AddLog("文章监控管理", content);

            string message = string.Format("您已经成功删除{0}条记录", count);

            Messages.ShowMessage(message);
            LoadArticles();
        }
Exemple #9
0
        public override DataTable Query(PanelContext data, out int recordcount, ref int pageindex)
        {
            DataSet ds = CreateDataSet(data.Model);

            recordcount = GetCount(data);
            int startindex, itemscount;

            We7.Framework.Util.Utils.BuidlPagerParam(recordcount, data.PageSize, ref pageindex, out startindex, out itemscount);
            List <Article> list = ArticleHelper.Assistant.List <Article>(CreateCriteria(data), new Order[] { new Order("Updated", OrderMode.Desc) }, startindex, itemscount);

            foreach (Article a in list)
            {
                try
                {
                    if (String.IsNullOrEmpty(a.ModelXml))
                    {
                        continue;
                    }
                    ReadXml(ds, a.ModelXml);
                    DataRowCollection rows = ds.Tables[data.Table.Name].Rows;
                    if (rows.Count > 0)
                    {
                        rows[rows.Count - 1][OBJECTCOLUMN] = a;
                    }
                }
                catch (Exception ex)
                {
                    ArticleHelper.DeleteArticle(a.ID);
                    Logger.WriteLine();
                    Logger.WriteDate();
                    Logger.Write("模型内容错误" + ex.Message);
                    Logger.Write(a.ModelXml);
                }
            }
            return(ds.Tables[data.Table.Name]);
        }