Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCLCMS.Data.Model.View.v_UserInfo GetModel(long UserInfoID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from v_UserInfo  WITH(NOLOCK)  ");
            strSql.Append(" where UserInfoID=@UserInfoID ");
            XCLCMS.Data.Model.View.v_UserInfo model = new XCLCMS.Data.Model.View.v_UserInfo();
            Database  db        = base.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "UserInfoID", DbType.Int64, UserInfoID);
            DataSet ds  = db.ExecuteDataSet(dbCommand);
            var     lst = XCLNetTools.Generic.ListHelper.DataSetToList <XCLCMS.Data.Model.View.v_UserInfo>(ds);

            return(null != lst && lst.Count > 0 ? lst[0] : null);
        }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCLCMS.Data.Model.View.v_UserInfo GetModel(long UserInfoID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from v_UserInfo  WITH(NOLOCK)  ");
            strSql.Append(" where UserInfoID=@UserInfoID ");
            XCLCMS.Data.Model.View.v_UserInfo model = new XCLCMS.Data.Model.View.v_UserInfo();
            Database  db        = base.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "UserInfoID", DbType.Int64, UserInfoID);
            using (var dr = db.ExecuteReader(dbCommand))
            {
                return(XCLNetTools.DataSource.DataReaderHelper.DataReaderToEntity <XCLCMS.Data.Model.View.v_UserInfo>(dr));
            }
        }