Beispiel #1
0
    private void RptBind(int id)
    {
        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        DataTable dt = bll.GetList(0, this.channel_id, "where channel_id=" + id);

        this.rptList.DataSource = dt;
        this.rptList.DataBind();

        Cms.BLL.C_Column cm        = new Cms.BLL.C_Column();
        string           classname = cm.GetModel(27).className;
        bool             bladd     = adminUser.setpurview(classname, "add");
        bool             blEdit    = adminUser.setpurview(classname, "Edit");
        bool             blDelete  = adminUser.setpurview(classname, "Delete");

        if (!bladd)
        {
            btnadd.Visible = false;
        }
        if (!blEdit)
        {
            btnSave.Visible = false;
        }
        if (!blDelete)
        {
            btnDelete.Visible = false;
        }
    }
Beispiel #2
0
    public void TreeBind(int channel_id)
    {
        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        DataTable dt = null;

        if (channel_id == 0)
        {
            dt = bll.GetList(0, channel_id, "");
        }
        else
        {
            dt = bll.GetList(0, channel_id, "where channel_id=" + channel_id);
        }

        this.ddlParentId.Items.Clear();
        this.ddlParentId.Items.Add(new ListItem("无父级", "0"));
        foreach (DataRow dr in dt.Rows)
        {
            string Id         = dr["id"].ToString();
            int    ClassLayer = int.Parse(dr["class_layer"].ToString());
            string Title      = dr["title"].ToString().Trim();

            if (ClassLayer == 1)
            {
                this.ddlParentId.Items.Add(new ListItem(Title, Id));
            }
            else
            {
                Title = "├ " + Title;
                Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                this.ddlParentId.Items.Add(new ListItem(Title, Id));
            }
        }
    }
Beispiel #3
0
    /// <summary>
    /// 分类绑定
    /// </summary>
    public void listbind()
    {
        Cms.BLL.C_article_category ccc = new Cms.BLL.C_article_category();
        DataTable dt = ccc.GetList("channel_id=7 order by sort_id asc").Tables[0];

        ddpid.DataSource     = dt.DefaultView;
        ddpid.DataTextField  = "title";
        ddpid.DataValueField = "id";
        ddpid.DataBind();
    }
Beispiel #4
0
    /// <summary>
    /// 返回类别名称
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public string typename(string type)
    {
        string str = "";

        Cms.BLL.C_article_category ccc = new Cms.BLL.C_article_category();
        DataTable dt = ccc.GetList("id=" + type).Tables[0];

        if (dt.Rows.Count > 0)
        {
            str = dt.Rows[0]["title"].ToString();
        }
        return(str);
    }
Beispiel #5
0
    public string getcolumn(int channel_id)
    {
        string result = "";

        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        DataSet ds = bll.GetList("id=" + channel_id);

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            result = ds.Tables[0].Rows[0]["title"].ToString();
        }
        return(result);
    }
Beispiel #6
0
    private bool DoEdit(int _id)
    {
        string channel_id = this.Request.QueryString["channel_id"] ?? "";//栏目ID

        try
        {
            Cms.BLL.C_article_category   bll   = new Cms.BLL.C_article_category();
            Cms.Model.C_article_category model = bll.GetModel(_id);

            int    parentId    = int.Parse(ddlParentId.SelectedValue);
            string class_layer = getclasslayer(Convert.ToInt32(this.ddlParentId.SelectedValue), 1);
            model.class_layer = Convert.ToInt32(class_layer);
            model.channel_id  = Convert.ToInt32(ddlchannel_id.SelectedValue);
            model.call_index  = txtCallIndex.Text.Trim();
            model.title       = txtTitle.Text.Trim();
            //如果选择的父ID不是自己,则更改
            if (parentId != model.id)
            {
                model.parent_id = parentId;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.seo_title       = txtSeoTitle.Text;
            model.seo_keywords    = txtSeoKeywords.Text;
            model.seo_description = txtSeoDescription.Text;
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Value.Trim();
            model.content         = txtContent.Value;
            model.isHidden        = Convert.ToInt32(this.isHidden.SelectedValue); //显示状态
            model.isTop           = 0;                                            //0 不置顶
            model.isRecommend     = 0;                                            //0 不推荐
            model.isHot           = 0;                                            //不属于热门
            model.is_msg          = 0;                                            //不属于评论
            model.is_slide        = 0;                                            //不属于幻灯片

            model.adword     = adword.Text;
            model.Fold       = Fold.Text;
            model.activetime = activetime.Text;
            model.Special    = Special.Text;
            model.video      = video.Text;
            if (bll.Update(model))
            {
                adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.title); //记录日志
                return(true);
            }
        }
        catch
        {
            return(false);
        }
        return(false);
    }
Beispiel #7
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        // ChkAdminLevel("channel_" + this.channel_name + "_category", DTEnums.ActionEnum.Delete.ToString()); //检查权限
        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        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)
            {
                adminUser.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), bll.GetModel(id).title); //记录日志
                bll.Delete(id);
            }
        }

        JscriptMsg("删除数据成功!", Utils.CombUrlTxt("category_list.aspx", "channel_id={0}", this.channel_id.ToString()), "Success");
    }
Beispiel #8
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //ChkAdminLevel("channel_" + this.channel_name + "_category", DTEnums.ActionEnum.Edit.ToString()); //检查权限
        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            int sortId;
            if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
            {
                sortId = 99;
            }
            int counts = Cms.DBUtility.DbHelperSQL.ExecuteSql("update C_article_category set sort_id=" + sortId + " where id='" + id + "'");//修改
        }
        //AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "频道栏目分类排序"); //记录日志
        int pid = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");//类别ID

        JscriptMsg("保存排序成功!", Utils.CombUrlTxt("category_list.aspx", "id={0}", pid.ToString()), "Success");
    }
Beispiel #9
0
    public string getclasslayer(int parentId, int result)
    {
        string resultone = "";

        Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
        DataSet ds = bll.GetList("id=" + parentId);

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            result = result + 1;
            int id = Convert.ToInt32(ds.Tables[0].Rows[0]["parent_id"].ToString());
            resultone = getclasslayer(id, result);
        }
        else
        {
            resultone = result.ToString();
        }
        return(resultone);
    }
Beispiel #10
0
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category();
     Cms.Model.C_article_category model = bll.GetModel(id);
     switch (e.CommandName)
     {
         case "lbtnIsMsg":
             if (model.is_msg == 1)
                 this.updateSate(id, "is_msg=0");
             else
                 this.updateSate(id, "is_msg=1");
             break;
         case "lbtnIsTop":
             if (model.isTop == 1)
                 this.updateSate(id, "isTop=0");
             else
                 this.updateSate(id, "isTop=1");
             break;
         case "lbtnIsRed":
             if (model.isRecommend == 1)
                 this.updateSate(id, "isRecommend=0");
             else
                 this.updateSate(id, "isRecommend=1");
             break;
         case "lbtnIsHot":
             if (model.isHot == 1)
                 this.updateSate(id, "isHot=0");
             else
                 this.updateSate(id, "isHot=1");
             break;
         case "lbtnIsSlide":
             if (model.is_slide == 1)
                 this.updateSate(id, "is_slide=0");
             else
                 this.updateSate(id, "is_slide=1");
             break;
     }
 }
Beispiel #11
0
    private void ShowInfo(int _id)
    {
        Cms.BLL.C_article_category   bll   = new Cms.BLL.C_article_category();
        Cms.Model.C_article_category model = bll.GetModel(_id);

        ddlParentId.SelectedValue   = model.parent_id.ToString();
        ddlchannel_id.SelectedValue = model.channel_id.ToString();
        txtCallIndex.Text           = model.call_index;
        txtTitle.Text               = model.title;
        txtSortId.Text              = model.sort_id.ToString();
        txtSeoTitle.Text            = model.seo_title;
        txtSeoKeywords.Text         = model.seo_keywords;
        txtSeoDescription.Text      = model.seo_description;
        txtLinkUrl.Text             = model.link_url;
        txtImgUrl.Value             = model.img_url;
        txtContent.Value            = model.content;
        this.isHidden.SelectedValue = model.isHidden.ToString();//显示状态

        adword.Text     = model.adword;
        Fold.Text       = model.Fold;
        activetime.Text = model.activetime;
        Special.Text    = model.Special;
        video.Text      = model.video;
    }