Пример #1
0
        /// <summary>
        ///  获取实体列表
        /// </summary>
        /// <param name="showFields">显示字段</param>
        /// <param name="reader">IDataReader</param>
        /// <returns>返回TicketType实体列表</returns>
        public static List<TicketTypeModel> GetList(List<TicketTypeFields> showFields, IDataReader reader)
        {
            List< TicketTypeModel> list = new List< TicketTypeModel>();
            while ( reader.Read() )
            {
                 TicketTypeModel tickettype= new TicketTypeModel();
                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTId)) && reader["TTId"] !=DBNull.Value)
                {
                   tickettype.TTId = Convert.ToInt32(reader["TTId"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTTypeId)) && reader["TTTypeId"] !=DBNull.Value)
                {
                   tickettype.TTTypeId = reader["TTTypeId"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTTypeName)) && reader["TTTypeName"] !=DBNull.Value)
                {
                   tickettype.TTTypeName = reader["TTTypeName"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTScenicId)) && reader["TTScenicId"] !=DBNull.Value)
                {
                   tickettype.TTScenicId = reader["TTScenicId"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTStartTime)) && reader["TTStartTime"] !=DBNull.Value)
                {
                   tickettype.TTStartTime = Convert.ToDateTime(reader["TTStartTime"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTDeadline)) && reader["TTDeadline"] !=DBNull.Value)
                {
                   tickettype.TTDeadline = Convert.ToDateTime(reader["TTDeadline"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTRowValid)) && reader["TTRowValid"] !=DBNull.Value)
                {
                   tickettype.TTRowValid = Convert.ToByte(reader["TTRowValid"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, TicketTypeFields.TTCreateTime)) && reader["TTCreateTime"] !=DBNull.Value)
                {
                   tickettype.TTCreateTime = Convert.ToDateTime(reader["TTCreateTime"]);
                }

                  list.Add(tickettype);
            }
            reader.Close();
            return list;
        }
Пример #2
0
 /// <summary>
 /// TicketType 添加操作
 /// </summary>
 /// <param name="tickettype">TicketType实体类</param>
 /// <param name="transaction">事务</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public bool Add(TicketTypeModel tickettype,DbTransaction transaction)
 {
     string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:TicketType表增加操作/File:TicketTypeAccess.cs/Fun:Add*/";
        StringBuilder sql = new StringBuilder();
        sql.Append(sqlDescription);
        sql.Append("insert ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[TicketType] (TTTypeId,TTTypeName,TTScenicId,TTStartTime,TTDeadline,TTRowValid,TTCreateTime) values(@TTTypeId,@TTTypeName,@TTScenicId,@TTStartTime,@TTDeadline,@TTRowValid,@TTCreateTime)");
        SqlParameterWrapperCollection Collection = new SqlParameterWrapperCollection();
        Collection.Add(new SqlParameterWrapper("@TTTypeId", tickettype.TTTypeId,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@TTTypeName", tickettype.TTTypeName,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@TTScenicId", tickettype.TTScenicId,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@TTStartTime", tickettype.TTStartTime,SqlDbType.DateTime));
        Collection.Add(new SqlParameterWrapper("@TTDeadline", tickettype.TTDeadline,SqlDbType.DateTime));
        Collection.Add(new SqlParameterWrapper("@TTRowValid", tickettype.TTRowValid,SqlDbType.TinyInt));
        Collection.Add(new SqlParameterWrapper("@TTCreateTime", tickettype.TTCreateTime,SqlDbType.DateTime));
        return SqlHelper.ExecuteNonQuery(DatabaseFactory.GetWriteDatabase(DatabaseManager.Db_JQEBookingConfig),sql.ToString(),Collection,transaction) > 0;
 }
Пример #3
0
 /// <summary>
 ///TicketType 添加操作
 /// </summary>
 /// <param name="tickettype">TicketType实体类</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public bool Add(TicketTypeModel tickettype)
 {
     return dataAccess.Add(tickettype);
 }