/// <summary> /// 获取对象 /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回Remark表格</returns> public object GetObject(DataBaseType dbType, RemarkFields showField, List<RemarkWhereFields> whereFields) { string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:Remark表查询操作/File:RemarkAccess.cs/Fun:GetTopRemarkTable*/"; StringBuilder sql = new StringBuilder(); sql.Append(sqlDescription); sql.Append("select "+ showField.ToString()+" from ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[Remark] 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>返回Remark表格</returns> public object GetObject(RemarkFields showField, List<RemarkWhereFields> 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<RemarkFields> list, RemarkFields field) { foreach ( RemarkFields 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, RemarkFields field, string fieldVariable, object fieldValue) { switch ( field ) { case RemarkFields.RId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.Int)); break; case RemarkFields.ROrderSerialNo: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case RemarkFields.RRemarkType: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; case RemarkFields.RRemarkContent: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case RemarkFields.RRemarkTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; case RemarkFields.RRemarkReply: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case RemarkFields.RReplyTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; case RemarkFields.RRemarkState: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; case RemarkFields.RRowValid: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; } }
/// <summary> ///Remark字段值 /// </summary> /// <param name="field">Remark字段</param> /// <param name="fieldValue">字段值</param> public RemarkFieldValuePair(RemarkFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; }
/// <summary> ///Remark字段值 /// </summary> /// <param name="field">Remark字段</param> /// <param name="fieldValue">字段值</param> /// <param name="queryOperator">条件操作类型</param> /// <param name="queryCondition">条件关系</param> public RemarkWhereFields(RemarkFields field,object fieldValue, QueryCondition queryCondition,QueryOperator queryOperator) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = queryOperator; this.queryCondition = queryCondition; }
/// <summary> ///Remark字段值 /// </summary> /// <param name="field">Remark字段</param> /// <param name="fieldValue">字段值</param> public RemarkWhereFields(RemarkFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = QueryOperator.And; this.queryCondition = QueryCondition.Equal; }
/// <summary> ///Remark排序字段 /// </summary> /// <param name="field">Remark字段</param> /// <param name="order">排序类型</param> public RemarkOrderFields(RemarkFields field, OrderType order) { this.field = field; this.order = order; }
/// <summary> ///Remark排序字段 /// </summary> /// <param name="field">Remark字段</param> public RemarkOrderFields(RemarkFields field) { this.field = field; this.order = OrderType.Asc; }