Exemple #1
0
 /// <summary>
 /// 绑定类别详细信息
 /// </summary>
 /// <param name="id">类别编号</param>
 void BindDetail(int id)
 {
     model                       = bll.GetModel(id);
     txtExplain.Text             = model.Explain;
     txtSortNum.Text             = model.SortNum.ToString();
     txtSubTitle.Text            = model.SubTitle;
     txtTitle.Text               = model.Title;
     ddlParentType.SelectedValue = model.ParentId.ToString();
     ckState.Checked             = model.StateInfo == 1 ? true : false;
 }
Exemple #2
0
        /// <summary>
        /// 绑定下拉列表类别
        /// </summary>
        public void BindddlType(int PID, DropDownList ddl, bool state = false)
        {
            BLL.Category   bll   = new BLL.Category();
            Model.Category model = new Model.Category();

            int typelevel = 0;

            if (PID != 0)
            {
                model     = bll.GetModel(PID);
                typelevel = model.LevelNum + 1;
            }


            DataTable dt = bll.GetListChild(PID, state);

            foreach (DataRow item in dt.Rows)
            {
                string value    = item["Id"].ToString();
                int    levelNum = int.Parse(item["LevelNum"].ToString()) - typelevel;
                string title    = item["Title"].ToString();

                if (levelNum > 0)
                {
                    title = "|--" + title;
                    title = Utils.StringOfChar(levelNum, " ") + title;
                }

                ddl.Items.Add(new ListItem(title, value));
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取类别名称
        /// </summary>
        /// <param name="cid"></param>
        /// <returns></returns>
        public string GetCategoryName(int cid)
        {
            string cName = "";

            if (cid == 0)
            {
                cName = "顶级类别";
            }
            else
            {
                BLL.Category bll = new BLL.Category();
                cName = bll.GetModel(cid).Title;
            }

            return(cName);
        }
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void Bind()
 {
     //如果当前是编辑进入页面,择执行修改操作
     if (!string.IsNullOrEmpty(cId))
     {
         if (cBll == null)
         {
             cBll = new BLL.Category();
         }
         Model.Category model = cBll.GetModel(cId);
         ListItem       li    = null;
         if (model != null)
         {
             txtCategoryname.Value = model.CategoryName;
             li = ddlCategory.Items.FindByValue(model.ParentID);
             if (li != null)
             {
                 li.Selected = true;
             }
             txtRemark.Value = model.Remark;
         }
     }
 }