/// <summary> /// 获取对象 /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回TicketType表格</returns> public object GetObject(DataBaseType dbType, TicketTypeFields showField, List<TicketTypeWhereFields> whereFields) { string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:TicketType表查询操作/File:TicketTypeAccess.cs/Fun:GetTopTicketTypeTable*/"; StringBuilder sql = new StringBuilder(); sql.Append(sqlDescription); sql.Append("select "+ showField.ToString()+" from ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[TicketType] with(nolock)"); SqlParameterWrapperCollection collection = new SqlParameterWrapperCollection(); if ( whereFields != null && whereFields.Count > 0 ) { sql.Append(" where "); sql.Append(GetSqlString(null, whereFields)); } GetSqlParameterWrapperCollection(collection, null, whereFields); return SqlHelper.ExecuteScalar(DatabaseManager.GetDataBase(DatabaseManager.Db_JQEBookingConfig,dbType),sql.ToString(),collection); }
/// <summary> /// 获取对象 /// </summary> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回TicketType表格</returns> public object GetObject(TicketTypeFields showField, List<TicketTypeWhereFields> whereFields) { return GetObject(DataBaseType.Read,showField,whereFields); }
/// <summary> /// 判断字段是否存在 /// </summary> /// <param name="list">列表</param> /// <param name="field">字段</param> /// <returns>返回true存在,否则不存在</returns> public static bool IsExistField(List<TicketTypeFields> list, TicketTypeFields field) { foreach ( TicketTypeFields f in list ) { if ( f == field ) { return true; } } return false; }
/// <summary> /// 设置SqlParameterWrapperCollection /// </summary> /// <param name="collection">SqlParameterWrapperCollection</param> /// <param name="field">字段</param> /// <param name="fieldVariable">字段变量</param> /// <param name="fieldValue">值</param> public static void SetSqlParameterWrapperCollection(SqlParameterWrapperCollection collection, TicketTypeFields field, string fieldVariable, object fieldValue) { switch ( field ) { case TicketTypeFields.TTId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.Int)); break; case TicketTypeFields.TTTypeId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case TicketTypeFields.TTTypeName: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case TicketTypeFields.TTScenicId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case TicketTypeFields.TTStartTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; case TicketTypeFields.TTDeadline: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; case TicketTypeFields.TTRowValid: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; case TicketTypeFields.TTCreateTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; } }
/// <summary> ///TicketType字段值 /// </summary> /// <param name="field">TicketType字段</param> /// <param name="fieldValue">字段值</param> public TicketTypeFieldValuePair(TicketTypeFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; }
/// <summary> ///TicketType字段值 /// </summary> /// <param name="field">TicketType字段</param> /// <param name="fieldValue">字段值</param> /// <param name="queryOperator">条件操作类型</param> /// <param name="queryCondition">条件关系</param> public TicketTypeWhereFields(TicketTypeFields field,object fieldValue, QueryCondition queryCondition,QueryOperator queryOperator) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = queryOperator; this.queryCondition = queryCondition; }
/// <summary> ///TicketType字段值 /// </summary> /// <param name="field">TicketType字段</param> /// <param name="fieldValue">字段值</param> public TicketTypeWhereFields(TicketTypeFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = QueryOperator.And; this.queryCondition = QueryCondition.Equal; }
/// <summary> ///TicketType排序字段 /// </summary> /// <param name="field">TicketType字段</param> /// <param name="order">排序类型</param> public TicketTypeOrderFields(TicketTypeFields field, OrderType order) { this.field = field; this.order = order; }
/// <summary> ///TicketType排序字段 /// </summary> /// <param name="field">TicketType字段</param> public TicketTypeOrderFields(TicketTypeFields field) { this.field = field; this.order = OrderType.Asc; }