コード例 #1
0
    public void DataAdd()
    {
        Cms.BLL.C_Column   bllcolumn   = new Cms.BLL.C_Column();
        Cms.Model.C_Column modelcolumn = new Cms.Model.C_Column();
        modelcolumn.parentId = Convert.ToInt32(this.parentId.SelectedValue);//上级栏目ID
        string class_layer = getclasslayer(Convert.ToInt32(this.parentId.SelectedValue), 1);

        modelcolumn.class_layer = Convert.ToInt32(class_layer);
        modelcolumn.modelId     = Convert.ToInt32(this.modelId.SelectedValue);   //栏目模型ID
        modelcolumn.className   = this.className.Text.Trim();                    //栏目名称
        modelcolumn.sub_title   = this.sub_title.Text.Trim();                    //副名称
        modelcolumn.engName     = this.engName.Text.Trim();                      //栏目英文名称
        modelcolumn.orderNumber = Convert.ToInt32(this.orderNumber.Text.Trim()); //栏目排序
        modelcolumn.photoUrl    = this.photoUrl.Value.Trim();                    //栏目缩略图
        modelcolumn.photoUrlone = this.photoUrlone.Value;                        //栏目图标True
        modelcolumn.photoUrltwo = this.photoUrltwo.Value;                        //栏目图标False

        modelcolumn.nav_type = Cms.Common.Enums.NavigationEnum.WebSite.ToString();

        modelcolumn.isShowChannel = 0;//是否参与导航 0是参与导航
        if (isShowChannel.Checked == true)
        {
            modelcolumn.isShowChannel = 1; //是否参与导航 1是不参与导航
        }
        modelcolumn.isShowNext = 0;        //是否显示子栏目 0是显示
        if (isShowNext.Checked == true)
        {
            modelcolumn.isShowNext = 1; //是否显示子栏目 1是隐藏
        }
        modelcolumn.isBlank = 0;        //是否打开新窗口 0是不打开新窗口
        if (isBlank.Checked == true)
        {
            modelcolumn.isBlank = 1; //是否打开新窗口 1是打开新窗口
        }
        modelcolumn.isHidden = 0;    //是否隐藏 0是显示
        if (isHidden.Checked == true)
        {
            modelcolumn.isHidden = 1;                        //是否打开新窗口 1是隐藏
        }
        modelcolumn.linkUrl      = this.linkUrl.Text.Trim(); //列表调用地址
        modelcolumn.tplChannel   = this.tplChannel.Text.Trim();
        modelcolumn.tplContent   = this.tplContent.Text.Trim();
        modelcolumn.listinfopath = this.listinfopath.Text.Trim();     //后台列表信息地址
        modelcolumn.name         = txtCallIndex.Text;                 //调用别名
        modelcolumn.related      = columnchose.Text;                  //关联栏目

        modelcolumn.seoTitle       = this.seoTitle.Text.Trim();       //SEO标题
        modelcolumn.seoKeyword     = this.seoKeyword.Text.Trim();     //SEO关键字
        modelcolumn.seoDescription = this.seoDescription.Text.Trim(); //SEO描述
        modelcolumn.intro          = this.intro.Text;                 //栏目简介
        modelcolumn.content        = this.content.Value;              //栏目内容

        modelcolumn.w_isShowChannel = 0;                              //是否参与手机导航 0是参与导航
        if (w_isShowChannel.Checked == true)
        {
            modelcolumn.w_isShowChannel = 1;          //是否参与手机导航 1是不参与导航
        }
        modelcolumn.w_linkUrl = this.w_linkUrl.Text;  //手机链接地址

        modelcolumn.w_intro   = this.w_intro.Text;    //手机站简介
        modelcolumn.w_content = this.w_content.Value; //手机站内容

        modelcolumn.e_isShowChannel = 0;              //是否参与英文导航 0是参与导航
        if (e_isShowChannel.Checked == true)
        {
            modelcolumn.e_isShowChannel = 1;                              //是否参与英文导航 1是不参与导航
        }
        modelcolumn.e_linkUrl = this.e_linkUrl.Text;                      //手英文链接地址

        modelcolumn.e_intro          = this.e_intro.Text;                 //英文站简介
        modelcolumn.e_content        = this.e_content.Value;              //英文站内容
        modelcolumn.e_seoTitle       = this.e_seoTitle.Text.Trim();       //英文站SEO标题
        modelcolumn.e_seoKeyword     = this.e_seoKeyword.Text.Trim();     //英文站SEO关键字
        modelcolumn.e_seoDescription = this.e_seoDescription.Text.Trim(); //英文站SEO描述

        if (cbIsAlbums.Checked == true)
        {
            modelcolumn.is_albums = 1;
        }
        if (cbIsAttach.Checked == true)
        {
            modelcolumn.is_attach = 1;
        }

        modelcolumn.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10);

        //添加操作权限类型
        string action_type_str = string.Empty;

        for (int i = 0; i < cblActionType.Items.Count; i++)
        {
            if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value))
            {
                action_type_str += cblActionType.Items[i].Value + ",";
            }
        }
        if (action_type_str == "")
        {
            modelcolumn.action_type = action_type_str;
        }
        else
        {
            modelcolumn.action_type = Utils.DelLastComma(action_type_str);
        }

        #region 添加频道扩展字段========================
        List <Cms.Model.C_Column_field> ls = new List <Cms.Model.C_Column_field>();
        for (int i = 0; i < cblAttributeField.Items.Count; i++)
        {
            if (cblAttributeField.Items[i].Selected)
            {
                ls.Add(new Cms.Model.C_Column_field {
                    field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0)
                });
            }
        }
        modelcolumn.channel_fields = ls;
        #endregion

        int result = bllcolumn.Add(modelcolumn);
        if (result > 0)
        {
            adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加" + this.className.Text.Trim()); //记录日志

            JscriptMsg("添加栏目信息成功!", "SinglePage_edit.aspx", "Success");
        }
        else
        {
            JscriptMsg("添加栏目信息失败!", "SinglePage_edit.aspx", "Error");
        }
    }