Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CMS.Model.CMS_SysMod Model = new CMS.Model.CMS_SysMod();

            ParentModel = dal.GetModel(parentid);

            string mod_name = this.txtmod_name.Text;
            int mod_parentid = parentid;
            //string mod_defaultpage = this.txtmod_defaultpage.Text;
            string mod_URL = this.txtmod_URL.Text;
            int mod_level = (ParentModel != null) ? ParentModel.mod_level + 1 : 1;//int.Parse(this.txtmod_level.Text);
            //bool mod_enable = this.chkmod_enable.Checked;
            string mod_desc = this.txtmod_desc.Text;
            int mod_sortnum = int.Parse(this.txtmod_sortnum.Text);
            bool mod_isvisible = this.cbxisvisible.Checked;

            CMS.Model.CMS_SysMod model = new CMS.Model.CMS_SysMod();
            model.mod_name = mod_name;
            model.mod_parentid = mod_parentid;
            //model.mod_defaultpage = mod_defaultpage;
            model.mod_URL = mod_URL;
            model.mod_level = mod_level;
            //model.mod_enable = mod_enable;
            model.mod_desc = mod_desc;
            model.mod_sortnum = mod_sortnum;
            model.mod_isvisible = mod_isvisible;

            dal.Add(model);

            JscriptPrint("菜单添加成功啦!", "MenuList.aspx", "Success");
        }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            model = dal.GetModel(id);
            //int id = int.Parse(this.hdfid.Value);
            string mod_name = this.txtmod_name.Text;
            //int mod_parentid = int.Parse(this.txtmod_parentid.Text);
            //string mod_defaultpage = this.txtmod_defaultpage.Text;
            string mod_URL = this.txtmod_URL.Text;
            //int mod_level = int.Parse(this.txtmod_level.Text);
            //bool mod_enable = this.chkmod_enable.Checked;
            string mod_desc = this.txtmod_desc.Text;
            int mod_sortnum = int.Parse(this.txtmod_sortnum.Text);
            bool mod_isvisible = this.cbxisvisible.Checked;

            //model.id = id;
            model.mod_name = mod_name;
            //model.mod_parentid = mod_parentid;
            //model.mod_defaultpage = mod_defaultpage;
            model.mod_URL = mod_URL;
            //model.mod_level = mod_level;
            //model.mod_enable = mod_enable;
            model.mod_desc = mod_desc;
            model.mod_sortnum = mod_sortnum;
            model.mod_isvisible = mod_isvisible;

            if (dal.Update(model))
            {
                JscriptPrint("菜单修改成功!", "MenuList.aspx", "Success");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 
 /// </summary>
 private void InitData()
 {
     model = dal.GetModel(id);
     this.txtmod_name.Text = model.mod_name;
     this.txtmod_URL.Text = model.mod_URL;
     this.cbxisvisible.Checked = model.mod_isvisible ? true : false;
     this.txtmod_sortnum.Text = model.mod_sortnum.ToString();
     this.txtmod_desc.Text = model.mod_desc;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        private void InitData()
        {
            if (parentid != 0)
            {

                ParentModel = dal.GetModel(parentid);

                this.lblPMod_name.Text = ParentModel.mod_name;
            }
            else
            {
                this.lblPMod_name.Text = "顶级菜单";
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CMS.Model.CMS_SysMod DataRowToModel(DataRow row)
 {
     CMS.Model.CMS_SysMod model = new CMS.Model.CMS_SysMod();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["mod_name"] != null)
         {
             model.mod_name = row["mod_name"].ToString();
         }
         if (row["mod_parentid"] != null && row["mod_parentid"].ToString() != "")
         {
             model.mod_parentid = int.Parse(row["mod_parentid"].ToString());
         }
         if (row["mod_defaultpage"] != null)
         {
             model.mod_defaultpage = row["mod_defaultpage"].ToString();
         }
         if (row["mod_URL"] != null)
         {
             model.mod_URL = row["mod_URL"].ToString();
         }
         if (row["mod_level"] != null && row["mod_level"].ToString() != "")
         {
             model.mod_level = int.Parse(row["mod_level"].ToString());
         }
         if (row["mod_enable"] != null && row["mod_enable"].ToString() != "")
         {
             if ((row["mod_enable"].ToString() == "1") || (row["mod_enable"].ToString().ToLower() == "true"))
             {
                 model.mod_enable = true;
             }
             else
             {
                 model.mod_enable = false;
             }
         }
         if (row["mod_desc"] != null)
         {
             model.mod_desc = row["mod_desc"].ToString();
         }
         if (row["mod_sortnum"] != null && row["mod_sortnum"].ToString() != "")
         {
             model.mod_sortnum = int.Parse(row["mod_sortnum"].ToString());
         }
         if (row["mod_isvisible"] != null && row["mod_isvisible"].ToString() != "")
         {
             if ((row["mod_isvisible"].ToString() == "1") || (row["mod_isvisible"].ToString().ToLower() == "true"))
             {
                 model.mod_isvisible = true;
             }
             else
             {
                 model.mod_isvisible = false;
             }
         }
     }
     return model;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CMS.Model.CMS_SysMod GetModel(int id)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" id,mod_name,mod_parentid,mod_defaultpage,mod_URL,mod_level,mod_enable,mod_desc,mod_sortnum,mod_isvisible ");
     strSql.Append(" from CMS_SysMod ");
     strSql.Append(" where id=" + id + "");
     CMS.Model.CMS_SysMod model = new CMS.Model.CMS_SysMod();
     DataSet ds = DbHelperSQL.Query(strSql.ToString());
     if (ds.Tables[0].Rows.Count > 0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }