Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = string.Empty;
            if (!IsPostBack)
            {
                //绑定到前台的select
                menuList = menuBll.GetModelList(" pId='0' or pId='20150012'");
                id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    menuModle = menuBll.GetModel(id);
                }
            }
            else
            {

                menuModle.id = Context.Request.Form["id"];
                menuModle.className = Context.Request.Form["className"];
                menuModle.pId = Context.Request.Form["Pid"];
                menuModle.classOrder = Convert.ToInt32(Context.Request.Form["classOrder"]);
                menuModle.OutLinkURL = Context.Request.Form["OutLinkURL"];
                if (string.IsNullOrEmpty(menuModle.id))
                {
                    menuModle.id = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString()+DateTime.Now.Second.ToString();
                    menuBll.Add(menuModle);
                }
                else
                {
                    menuBll.Update(menuModle);
                }

                Response.Redirect("/Admin/Menu/MenuInfo.aspx");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public shaoqi.Model.Menu DataRowToModel(DataRow row)
 {
     shaoqi.Model.Menu model = new shaoqi.Model.Menu();
     if (row != null)
     {
         if (row["id"] != null)
         {
             model.id = row["id"].ToString();
         }
         if (row["pId"] != null)
         {
             model.pId = row["pId"].ToString();
         }
         if (row["className"] != null)
         {
             model.className = row["className"].ToString();
         }
         if (row["classOrder"] != null && row["classOrder"].ToString() != "")
         {
             model.classOrder = int.Parse(row["classOrder"].ToString());
         }
         if (row["ClassType"] != null && row["ClassType"].ToString() != "")
         {
             model.ClassType = int.Parse(row["ClassType"].ToString());
         }
         if (row["isOpen"] != null && row["isOpen"].ToString() != "")
         {
             model.isOpen = int.Parse(row["isOpen"].ToString());
         }
         if (row["isSystem"] != null && row["isSystem"].ToString() != "")
         {
             model.isSystem = int.Parse(row["isSystem"].ToString());
         }
         if (row["Webtype"] != null)
         {
             model.Webtype = row["Webtype"].ToString();
         }
         if (row["OutLinkURL"] != null)
         {
             model.OutLinkURL = row["OutLinkURL"].ToString();
         }
         if (row["classNameEn"] != null)
         {
             model.classNameEn = row["classNameEn"].ToString();
         }
     }
     return model;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public shaoqi.Model.Menu GetModel(string id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,pId,className,classOrder,ClassType,isOpen,isSystem,Webtype,OutLinkURL,classNameEn from Menu ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.VarChar,50)			};
            parameters[0].Value = id;

            shaoqi.Model.Menu model = new shaoqi.Model.Menu();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }