Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ModMenu model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update IACenter_Menu set ");
            strSql.Append("menuName=@menuName,");
            strSql.Append("menuTarget=@menuTarget,");
            strSql.Append("parentMenuId=@parentMenuId,");
            strSql.Append("orderIndex=@orderIndex,");
            strSql.Append("isShow=@isShow");
            strSql.Append(" where uniqueId=@uniqueId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@uniqueId",     SqlDbType.Int,       4),
                new SqlParameter("@menuName",     SqlDbType.VarChar,  50),
                new SqlParameter("@menuTarget",   SqlDbType.VarChar, 500),
                new SqlParameter("@parentMenuId", SqlDbType.Int,       4),
                new SqlParameter("@orderIndex",   SqlDbType.Int,       4),
                new SqlParameter("@isShow",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.uniqueId;
            parameters[1].Value = model.menuName;
            parameters[2].Value = model.menuTarget;
            parameters[3].Value = model.parentMenuId;
            parameters[4].Value = model.orderIndex;
            parameters[5].Value = model.isShow;

            adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(ModMenu model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into IACenter_Menu(");
            strSql.Append("menuName,menuTarget,parentMenuId,orderIndex,isShow)");
            strSql.Append(" values (");
            strSql.Append("@menuName,@menuTarget,@parentMenuId,@orderIndex,@isShow)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@menuName",     SqlDbType.VarChar,  50),
                new SqlParameter("@menuTarget",   SqlDbType.VarChar, 500),
                new SqlParameter("@parentMenuId", SqlDbType.Int,       4),
                new SqlParameter("@orderIndex",   SqlDbType.Int,       4),
                new SqlParameter("@isShow",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.menuName;
            parameters[1].Value = model.menuTarget;
            parameters[2].Value = model.parentMenuId;
            parameters[3].Value = model.orderIndex;
            parameters[4].Value = model.isShow;

            adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);
        }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ModMenu GetModel(int uniqueId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 uniqueId,menuName,menuTarget,parentMenuId,orderIndex,isShow from IACenter_Menu ");
            strSql.Append(" where uniqueId=@uniqueId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@uniqueId", SqlDbType.Int, 4)
            };
            parameters[0].Value = uniqueId;

            ModMenu model = new ModMenu();

            DataSet ds = adoHelper.ExecuteSqlDataset(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["uniqueId"].ToString() != "")
                {
                    model.uniqueId = int.Parse(ds.Tables[0].Rows[0]["uniqueId"].ToString());
                }
                model.menuName   = ds.Tables[0].Rows[0]["menuName"].ToString();
                model.menuTarget = ds.Tables[0].Rows[0]["menuTarget"].ToString();
                if (ds.Tables[0].Rows[0]["parentMenuId"].ToString() != "")
                {
                    model.parentMenuId = int.Parse(ds.Tables[0].Rows[0]["parentMenuId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["orderIndex"].ToString() != "")
                {
                    model.orderIndex = int.Parse(ds.Tables[0].Rows[0]["orderIndex"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isShow"].ToString() != "")
                {
                    model.isShow = int.Parse(ds.Tables[0].Rows[0]["isShow"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ModMenu model)
 {
     dal.Update(model);
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ModMenu model)
 {
     dal.Add(model);
 }