/// <summary> ///JQResource字段值 /// </summary> /// <param name="field">JQResource字段</param> /// <param name="fieldValue">字段值</param> public JQResourceWhereFields(JQResourceFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = QueryOperator.And; this.queryCondition = QueryCondition.Equal; }
/// <summary> ///JQResource字段值 /// </summary> /// <param name="field">JQResource字段</param> /// <param name="fieldValue">字段值</param> /// <param name="queryOperator">条件操作类型</param> /// <param name="queryCondition">条件关系</param> public JQResourceWhereFields(JQResourceFields field,object fieldValue, QueryCondition queryCondition,QueryOperator queryOperator) { this.field = field; this.fieldValue = fieldValue; this.queryOperator = queryOperator; this.queryCondition = queryCondition; }
/// <summary> ///JQResource排序字段 /// </summary> /// <param name="field">JQResource字段</param> public JQResourceOrderFields(JQResourceFields field) { this.field = field; this.order = OrderType.Asc; }
/// <summary> ///JQResource排序字段 /// </summary> /// <param name="field">JQResource字段</param> /// <param name="order">排序类型</param> public JQResourceOrderFields(JQResourceFields field, OrderType order) { this.field = field; this.order = order; }
/// <summary> ///JQResource字段值 /// </summary> /// <param name="field">JQResource字段</param> /// <param name="fieldValue">字段值</param> public JQResourceFieldValuePair(JQResourceFields field,object fieldValue) { this.field = field; this.fieldValue = fieldValue; }
/// <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, JQResourceFields field, string fieldVariable, object fieldValue) { switch ( field ) { case JQResourceFields.JQRId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.Int)); break; case JQResourceFields.JQRScenicId: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRScenicName: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRScenicDecribe: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRPrincipal: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRAddress: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRTelephone: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQREmail: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.NVarChar)); break; case JQResourceFields.JQRRowValid: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.TinyInt)); break; case JQResourceFields.JQRCreateTime: collection.Add(new SqlParameterWrapper("@" + fieldVariable, fieldValue, SqlDbType.DateTime)); break; } }
/// <summary> /// 判断字段是否存在 /// </summary> /// <param name="list">列表</param> /// <param name="field">字段</param> /// <returns>返回true存在,否则不存在</returns> public static bool IsExistField(List<JQResourceFields> list, JQResourceFields field) { foreach ( JQResourceFields f in list ) { if ( f == field ) { return true; } } return false; }
/// <summary> /// 获取对象 /// </summary> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回JQResource表格</returns> public object GetObject(JQResourceFields showField, List<JQResourceWhereFields> whereFields) { return GetObject(DataBaseType.Read,showField,whereFields); }
/// <summary> /// 获取对象 /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="showField">字段</param> /// <param name="whereFields">条件字段</param> /// <returns>返回JQResource表格</returns> public object GetObject(DataBaseType dbType, JQResourceFields showField, List<JQResourceWhereFields> whereFields) { string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:JQResource表查询操作/File:JQResourceAccess.cs/Fun:GetTopJQResourceTable*/"; StringBuilder sql = new StringBuilder(); sql.Append(sqlDescription); sql.Append("select "+ showField.ToString()+" from ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[JQResource] 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); }