/// <summary> /// 获取实体列表 /// </summary> /// <param name="showFields">显示字段</param> /// <param name="reader">IDataReader</param> /// <returns>返回Comments实体列表</returns> public static List<CommentsModel> GetList(List<CommentsFields> showFields, IDataReader reader) { List< CommentsModel> list = new List< CommentsModel>(); while ( reader.Read() ) { CommentsModel comments= new CommentsModel(); if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CId)) && reader["CId"] !=DBNull.Value) { comments.CId = Convert.ToInt32(reader["CId"]); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.COrderSerialNo)) && reader["COrderSerialNo"] !=DBNull.Value) { comments.COrderSerialNo = reader["COrderSerialNo"].ToString(); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CCommentsType)) && reader["CCommentsType"] !=DBNull.Value) { comments.CCommentsType = Convert.ToByte(reader["CCommentsType"]); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CCommentsContent)) && reader["CCommentsContent"] !=DBNull.Value) { comments.CCommentsContent = reader["CCommentsContent"].ToString(); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CCommentsTime)) && reader["CCommentsTime"] !=DBNull.Value) { comments.CCommentsTime = Convert.ToDateTime(reader["CCommentsTime"]); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CCommentsReply)) && reader["CCommentsReply"] !=DBNull.Value) { comments.CCommentsReply = reader["CCommentsReply"].ToString(); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CReplyTime)) && reader["CReplyTime"] !=DBNull.Value) { comments.CReplyTime = Convert.ToDateTime(reader["CReplyTime"]); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CCommentsState)) && reader["CCommentsState"] !=DBNull.Value) { comments.CCommentsState = Convert.ToByte(reader["CCommentsState"]); } if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, CommentsFields.CRowValid)) && reader["CRowValid"] !=DBNull.Value) { comments.CRowValid = Convert.ToByte(reader["CRowValid"]); } list.Add(comments); } reader.Close(); return list; }
/// <summary> ///Comments 添加操作 /// </summary> /// <param name="comments">Comments实体类</param> /// <returns>执行成功返回true,否则为false</returns> public bool Add(CommentsModel comments) { return dataAccess.Add(comments); }
/// <summary> /// Comments 添加操作 /// </summary> /// <param name="comments">Comments实体类</param> /// <param name="transaction">事务</param> /// <returns>执行成功返回true,否则为false</returns> public bool Add(CommentsModel comments,DbTransaction transaction) { string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:Comments表增加操作/File:CommentsAccess.cs/Fun:Add*/"; StringBuilder sql = new StringBuilder(); sql.Append(sqlDescription); sql.Append("insert ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[Comments] (COrderSerialNo,CCommentsType,CCommentsContent,CCommentsTime,CCommentsReply,CReplyTime,CCommentsState,CRowValid) values(@COrderSerialNo,@CCommentsType,@CCommentsContent,@CCommentsTime,@CCommentsReply,@CReplyTime,@CCommentsState,@CRowValid)"); SqlParameterWrapperCollection Collection = new SqlParameterWrapperCollection(); Collection.Add(new SqlParameterWrapper("@COrderSerialNo", comments.COrderSerialNo,SqlDbType.NVarChar)); Collection.Add(new SqlParameterWrapper("@CCommentsType", comments.CCommentsType,SqlDbType.TinyInt)); Collection.Add(new SqlParameterWrapper("@CCommentsContent", comments.CCommentsContent,SqlDbType.NVarChar)); Collection.Add(new SqlParameterWrapper("@CCommentsTime", comments.CCommentsTime,SqlDbType.DateTime)); Collection.Add(new SqlParameterWrapper("@CCommentsReply", comments.CCommentsReply,SqlDbType.NVarChar)); Collection.Add(new SqlParameterWrapper("@CReplyTime", comments.CReplyTime,SqlDbType.DateTime)); Collection.Add(new SqlParameterWrapper("@CCommentsState", comments.CCommentsState,SqlDbType.TinyInt)); Collection.Add(new SqlParameterWrapper("@CRowValid", comments.CRowValid,SqlDbType.TinyInt)); return SqlHelper.ExecuteNonQuery(DatabaseFactory.GetWriteDatabase(DatabaseManager.Db_JQEBookingConfig),sql.ToString(),Collection,transaction) > 0; }