示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BookShop.Model.SysFun model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SysFun set ");
            strSql.Append("DisplayName=@DisplayName,");
            strSql.Append("NodeURL=@NodeURL,");
            strSql.Append("DisplayOrder=@DisplayOrder,");
            strSql.Append("ParentNodeId=@ParentNodeId");
            strSql.Append(" where NodeId=@NodeId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DisplayName",  SqlDbType.NVarChar, 50),
                new SqlParameter("@NodeURL",      SqlDbType.NVarChar, 50),
                new SqlParameter("@DisplayOrder", SqlDbType.Int,       4),
                new SqlParameter("@ParentNodeId", SqlDbType.Int,       4),
                new SqlParameter("@NodeId",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.DisplayName;
            parameters[1].Value = model.NodeURL;
            parameters[2].Value = model.DisplayOrder;
            parameters[3].Value = model.ParentNodeId;
            parameters[4].Value = model.NodeId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
文件: SysFun.cs 项目: JayZeeWen/Book
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BookShop.Model.SysFun model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SysFun(");
            strSql.Append("NodeId,DisplayName,NodeURL,DisplayOrder,ParentNodeId)");
            strSql.Append(" values (");
            strSql.Append("@NodeId,@DisplayName,@NodeURL,@DisplayOrder,@ParentNodeId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NodeId",       SqlDbType.Int,       4),
                new SqlParameter("@DisplayName",  SqlDbType.NVarChar, 50),
                new SqlParameter("@NodeURL",      SqlDbType.NVarChar, 50),
                new SqlParameter("@DisplayOrder", SqlDbType.Int,       4),
                new SqlParameter("@ParentNodeId", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.NodeId;
            parameters[1].Value = model.DisplayName;
            parameters[2].Value = model.NodeURL;
            parameters[3].Value = model.DisplayOrder;
            parameters[4].Value = model.ParentNodeId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
文件: SysFun.cs 项目: JayZeeWen/Book
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public BookShop.Model.SysFun DataRowToModel(DataRow row)
 {
     BookShop.Model.SysFun model = new BookShop.Model.SysFun();
     if (row != null)
     {
         if (row["NodeId"] != null && row["NodeId"].ToString() != "")
         {
             model.NodeId = int.Parse(row["NodeId"].ToString());
         }
         if (row["DisplayName"] != null)
         {
             model.DisplayName = row["DisplayName"].ToString();
         }
         if (row["NodeURL"] != null)
         {
             model.NodeURL = row["NodeURL"].ToString();
         }
         if (row["DisplayOrder"] != null && row["DisplayOrder"].ToString() != "")
         {
             model.DisplayOrder = int.Parse(row["DisplayOrder"].ToString());
         }
         if (row["ParentNodeId"] != null && row["ParentNodeId"].ToString() != "")
         {
             model.ParentNodeId = int.Parse(row["ParentNodeId"].ToString());
         }
     }
     return(model);
 }
示例#4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public BookShop.Model.SysFun DataRowToModel(DataRow row)
 {
     BookShop.Model.SysFun model=new BookShop.Model.SysFun();
     if (row != null)
     {
         if(row["NodeId"]!=null && row["NodeId"].ToString()!="")
         {
             model.NodeId=int.Parse(row["NodeId"].ToString());
         }
         if(row["DisplayName"]!=null)
         {
             model.DisplayName=row["DisplayName"].ToString();
         }
         if(row["NodeURL"]!=null)
         {
             model.NodeURL=row["NodeURL"].ToString();
         }
         if(row["DisplayOrder"]!=null && row["DisplayOrder"].ToString()!="")
         {
             model.DisplayOrder=int.Parse(row["DisplayOrder"].ToString());
         }
         if(row["ParentNodeId"]!=null && row["ParentNodeId"].ToString()!="")
         {
             model.ParentNodeId=int.Parse(row["ParentNodeId"].ToString());
         }
     }
     return model;
 }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BookShop.Model.SysFun GetModel(int NodeId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 NodeId,DisplayName,NodeURL,DisplayOrder,ParentNodeId from SysFun ");
            strSql.Append(" where NodeId=@NodeId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NodeId", SqlDbType.Int, 4)
            };
            parameters[0].Value = NodeId;

            BookShop.Model.SysFun model = new BookShop.Model.SysFun();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["NodeId"].ToString() != "")
                {
                    model.NodeId = int.Parse(ds.Tables[0].Rows[0]["NodeId"].ToString());
                }
                model.DisplayName = ds.Tables[0].Rows[0]["DisplayName"].ToString();
                model.NodeURL     = ds.Tables[0].Rows[0]["NodeURL"].ToString();
                if (ds.Tables[0].Rows[0]["DisplayOrder"].ToString() != "")
                {
                    model.DisplayOrder = int.Parse(ds.Tables[0].Rows[0]["DisplayOrder"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ParentNodeId"].ToString() != "")
                {
                    model.ParentNodeId = int.Parse(ds.Tables[0].Rows[0]["ParentNodeId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BookShop.Model.SysFun GetModel(int NodeId)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 NodeId,DisplayName,NodeURL,DisplayOrder,ParentNodeId from SysFun ");
            strSql.Append(" where NodeId=@NodeId ");
            SqlParameter[] parameters = {
                    new SqlParameter("@NodeId", SqlDbType.Int,4)			};
            parameters[0].Value = NodeId;

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