예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <OS.Model.contents.category_field> GetList(int category_id)
        {
            List <OS.Model.contents.category_field> modelList = new List <OS.Model.contents.category_field>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,category_id,field_id from " + databaseprefix + "category_field ");
            strSql.Append(" where category_id=" + category_id);
            DataTable dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];

            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                OS.Model.contents.category_field model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.contents.category_field();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["category_id"] != null && dt.Rows[n]["category_id"].ToString() != "")
                    {
                        model.category_id = int.Parse(dt.Rows[n]["category_id"].ToString());
                    }
                    if (dt.Rows[n]["field_id"] != null && dt.Rows[n]["field_id"].ToString() != "")
                    {
                        model.field_id = int.Parse(dt.Rows[n]["field_id"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtCallIndex.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtCallIndex.Focus(); //设置焦点,防止JS无法提交
            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.Text          = model.img_url;
            txtContent.Value        = model.content;
            rblStatus.SelectedValue = model.model_id.ToString();
            if (model.is_add_category == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_add_content == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_show_top == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_show_foot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_albums == 1)
            {
                cbIsAlbums.Checked = true;
            }
            if (model.is_attach == 1)
            {
                cbIsAttach.Checked = true;
            }
            txtPageSize.Text = model.page_size.ToString();
            //赋值扩展字段
            if (model.category_fields != null)
            {
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    Model.contents.category_field modelt = model.category_fields.Find(p => p.field_id == int.Parse(cblAttributeField.Items[i].Value)); //查找对应的字段ID
                    if (modelt != null)
                    {
                        cblAttributeField.Items[i].Selected = true;
                    }
                }
            }
        }