/// <summary> /// 是否存在该记录 /// </summary> public bool IsExistsByQS_RTID(int QS_RTID) { QueryQS_RulesTable query = new QueryQS_RulesTable(); query.QS_RTID = QS_RTID; DataTable dt = new DataTable(); int count = 0; dt = GetQS_RulesTable(query, string.Empty, 1, 1, out count); if (count > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Entities.QS_RulesTable GetQS_RulesTable(int QS_RTID) { QueryQS_RulesTable query = new QueryQS_RulesTable(); query.QS_RTID = QS_RTID; DataTable dt = new DataTable(); int count = 0; dt = GetQS_RulesTable(query, string.Empty, 1, 1, out count); if (count > 0) { return(LoadSingleQS_RulesTable(dt.Rows[0])); } else { return(null); } }
/// <summary> /// 根据参数表名TableName和显示字段名ShowField、字段ID名IDField、状态TableStatus得到需要的json对象 /// </summary> /// <param name="msg"></param> private void GetFieldNameByTable(out string msg) { msg = string.Empty; //DataTable dt = BLL.Util.GetTableInfoByTableName(TableName, TableStatus); Entities.QueryQS_RulesTable query = new QueryQS_RulesTable(); int count = 0; query.LoginID = BLL.Util.GetLoginUserID(); query.RuleTableStatus = TableStatus; DataTable dt = BLL.QS_RulesTable.Instance.GetQS_RulesTable(query, "QS_RulesTable.CreateTime DESC", 1, 10000, out count); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string showname = dr[ShowField].ToString(); showname = showname.Replace("'", "′"); msg += i == 0 ? "[{ID:" + dr[IDField] + ",Name:'" + showname + "'}" : ",{ID:'" + dr[IDField] + "',Name:'" + showname + "'}"; if (i == dt.Rows.Count - 1) { msg += "]"; } } }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetQS_RulesTable(QueryQS_RulesTable query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.QS_RulesTable.Instance.GetQS_RulesTable(query, order, currentPage, pageSize, out totalCount)); }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetQS_RulesTable(QueryQS_RulesTable query, string order, int currentPage, int pageSize, out int totalCount) { string where = string.Empty; #region 条件 if (query.QS_RTID != Constant.INT_INVALID_VALUE) { where += "and QS_RulesTable.QS_RTID=" + query.QS_RTID; } if (query.RuleTableStatus != Constant.STRING_INVALID_VALUE && query.RuleTableStatus != string.Empty) { where += "and QS_RulesTable.Status in (" + Dal.Util.SqlFilterByInCondition(query.RuleTableStatus) + ")"; } if (query.RuleTableInUseStatus != Constant.STRING_INVALID_VALUE && query.RuleTableInUseStatus != string.Empty) { string[] array = query.RuleTableInUseStatus.Split(','); if (array.Length > 1) { //未使用、使用的都显示,不加限制条件 } else { if (array[0] == "10001")//未使用 { where += " and isInUse=0 "; } else { where += " and isInUse>0 "; } } } if (query.Name != Constant.STRING_INVALID_VALUE) { where += " and QS_RulesTable.Name like '%" + StringHelper.SqlFilter(query.Name) + "%'"; } if (query.BeginTime != Constant.STRING_INVALID_VALUE && query.BeginTime != Constant.STRING_EMPTY_VALUE) { where += " and QS_RulesTable.CreateTime>='" + StringHelper.SqlFilter(query.BeginTime) + " 0:0:0'"; } if (query.EndTime != Constant.STRING_INVALID_VALUE && query.EndTime != Constant.STRING_EMPTY_VALUE) { where += " and QS_RulesTable.CreateTime<='" + StringHelper.SqlFilter(query.EndTime) + " 23:59:59'"; } if (query.CreateUserID != Constant.INT_INVALID_VALUE && query.CreateUserID != -1) { where += " and QS_RulesTable.CreateUserID=" + query.CreateUserID; } where += " and QS_RulesTable.Status<>10004"; #endregion DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar, 40000), new SqlParameter("@order", SqlDbType.NVarChar, 200), new SqlParameter("@pagesize", SqlDbType.Int, 4), new SqlParameter("@indexpage", SqlDbType.Int, 4), new SqlParameter("@totalRecorder", SqlDbType.Int, 4) }; parameters[0].Value = where; parameters[1].Value = order; parameters[2].Value = pageSize; parameters[3].Value = currentPage; parameters[4].Direction = ParameterDirection.Output; ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_QS_RULESTABLE_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }