Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(NCPEP.Model.T_SysFun model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_SysFun set ");
            strSql.Append("DisplayName=@DisplayName,");
            strSql.Append("NodeURL=@NodeURL,");
            strSql.Append("DisplayOrder=@DisplayOrder,");
            strSql.Append("ParentNodeId=@ParentNodeId,");
            strSql.Append("FunImgNum=@FunImgNum,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("CreateDate=@CreateDate");
            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("@FunImgNum",    SqlDbType.NVarChar,  10),
                new SqlParameter("@Editor",       SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateDate",   SqlDbType.DateTime),
                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.FunImgNum;
            parameters[5].Value = model.Editor;
            parameters[6].Value = model.CreateDate;
            parameters[7].Value = model.NodeId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public NCPEP.Model.T_SysFun DataRowToModel(DataRow row)
 {
     NCPEP.Model.T_SysFun model = new NCPEP.Model.T_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());
         }
         if (row["FunImgNum"] != null)
         {
             model.FunImgNum = row["FunImgNum"].ToString();
         }
         if (row["Editor"] != null)
         {
             model.Editor = row["Editor"].ToString();
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(NCPEP.Model.T_SysFun model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_SysFun(");
            strSql.Append("DisplayName,NodeURL,DisplayOrder,ParentNodeId,FunImgNum,Editor,CreateDate)");
            strSql.Append(" values (");
            strSql.Append("@DisplayName,@NodeURL,@DisplayOrder,@ParentNodeId,@FunImgNum,@Editor,@CreateDate)");
            strSql.Append(";select @@IDENTITY");
            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("@FunImgNum",    SqlDbType.NVarChar, 10),
                new SqlParameter("@Editor",       SqlDbType.NVarChar, 50),
                new SqlParameter("@CreateDate",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.DisplayName;
            parameters[1].Value = model.NodeURL;
            parameters[2].Value = model.DisplayOrder;
            parameters[3].Value = model.ParentNodeId;
            parameters[4].Value = model.FunImgNum;
            parameters[5].Value = model.Editor;
            parameters[6].Value = model.CreateDate;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NCPEP.Model.T_SysFun GetModel(int NodeId)
        {
            StringBuilder strSql = new StringBuilder();

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

            NCPEP.Model.T_SysFun model = new NCPEP.Model.T_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);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(NCPEP.Model.T_SysFun model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(NCPEP.Model.T_SysFun model)
 {
     return(dal.Add(model));
 }