Beispiel #1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_recycle", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                                                               //成功数量
            int errorCount = 0;                                                                               //失败数量

            BLL.article bll     = new BLL.article();
            Repeater    rptList = this.rptList1;

            //获取站点信息
            Model.channel_site site = new BLL.channel_site().GetSiteModel(this.channel_id);
            //循环删除
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.article model = bll.GetModel(id);
                    if (null != model)
                    {
                        if (bll.Delete(id))
                        {
                            sucCount++;
                            //是否开启百度推送
                            if (site.bdsend == 1 && !string.IsNullOrEmpty(site.bdtoken))
                            {
                                string url = get_url_rewrite(channel_name, "detail", model.call_index, model.id);
                                if (!string.IsNullOrEmpty(url))
                                {
                                    if (string.IsNullOrEmpty(site.domain))
                                    {
                                        url = siteConfig.weburl + url;
                                    }
                                    else
                                    {
                                        url = site.domain + url;
                                    }
                                    SeoHelper.BaiduDel(url, site.bdtoken);
                                }
                            }
                        }
                        else
                        {
                            errorCount++;
                        }
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "频道内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("recycle_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
                                                                                        this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property));
        }