/**
|
* EC_OrderDAL.cs
|
*
|
* 功 能: 订单请求数据访问接口实现类
|
* 类 名: EC_OrderDAL
|
*
|
* Ver 变更日期 负责人 变更内容
|
* ───────────────────────────────────
|
* V0.01 2013-5-11 15:20 吴崎均 增加分页查询方法
|
* V0.02 2013-5-11 16:38 吴崎均 修改分页查询,非必要条件改用集合传输
|
* V0.03 2013-6-7 15:58 吴崎均 修改分页查询申请方法使可以按申请人查询
|
*
|
*
|
*
|
*
|
*/
|
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using CY.IDAL;
|
using CY.Model;
|
using System.Data.SqlClient;
|
using System.Data;
|
|
namespace CY.SQLDAL
|
{
|
/// <summary>
|
/// 订单请求数据访问接口实现类
|
/// </summary>
|
public class EC_OrderDialogueDAL : IEC_OrderDialogueDAL
|
{
|
Database _database = null;
|
/// <summary>
|
/// 初始化构造
|
/// </summary>
|
public EC_OrderDialogueDAL()
|
{
|
_database = new Database();
|
}
|
|
/// <summary>
|
/// 分页查询订单请求
|
/// </summary>
|
/// <param name="pagination">分页对象</param>
|
/// <param name="memberId">会员编号</param>
|
/// <param name="searchParam">可空查询条件</param>
|
/// <returns></returns>
|
public IEnumerable<EC_OrderDialogue> SelectModelPage(Infrastructure.Query.Pagination pagination, Dictionary<int, object> searchParam)
|
{
|
|
|
|
if (null == pagination || null == searchParam || (!searchParam.ContainsKey(8) && !searchParam.ContainsKey(9))) return null; else { }
|
|
IList<SqlParameter> sqlParms = new List<SqlParameter>()
|
{
|
new SqlParameter() { ParameterName = "@BeginSubmit", SqlDbType = SqlDbType.Date, Value = DBNull.Value },//0
|
new SqlParameter() { ParameterName = "@EndSubmit", SqlDbType = SqlDbType.Date, Value = DBNull.Value },//1
|
new SqlParameter() { ParameterName = "@OrderId", SqlDbType = SqlDbType.VarChar, Value = DBNull.Value, Size = 25 },//2
|
new SqlParameter() { ParameterName = "@DialogueTypeId", SqlDbType = SqlDbType.Int, Value = DBNull.Value },//3
|
new SqlParameter() { ParameterName = "@IsAllow", SqlDbType = SqlDbType.Int, Value = DBNull.Value },//4
|
new SqlParameter() { ParameterName = "@IsExecuted", SqlDbType = SqlDbType.Int, Value = DBNull.Value },//5
|
new SqlParameter() { ParameterName = "@BeginReply", SqlDbType = SqlDbType.Date, Value = DBNull.Value },//6
|
new SqlParameter() { ParameterName = "@EndReply", SqlDbType = SqlDbType.Date, Value = DBNull.Value },//7
|
new SqlParameter() { ParameterName = "@ReceiverId", SqlDbType = SqlDbType.UniqueIdentifier, Value = DBNull.Value },//8 接手人
|
new SqlParameter() { ParameterName = "@InitiatorId", SqlDbType = SqlDbType.UniqueIdentifier, Value = DBNull.Value }//9 申请人
|
|
};
|
|
sqlParms.Add(new SqlParameter() { ParameterName = "@pageIndex", SqlDbType = SqlDbType.Int, Value = pagination.PageIndex });
|
sqlParms.Add(new SqlParameter() { ParameterName = "@pageSize", SqlDbType = SqlDbType.Int, Value = pagination.PageSize });
|
sqlParms.Add(new SqlParameter() { ParameterName = "@pageCount", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output });
|
sqlParms.Add(new SqlParameter() { ParameterName = "@recordCount", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output });
|
|
|
/*
|
* 拷贝参数
|
*/
|
if (null != searchParam && 0 < searchParam.Count)
|
{
|
foreach (int index in searchParam.Keys)
|
{
|
if (0 > index || index >= sqlParms.Count)
|
continue;
|
else
|
sqlParms[index].Value = searchParam[index];
|
}
|
}
|
else
|
{
|
|
}
|
|
IList<EC_OrderDialogue> result = null;
|
//执行分页存储
|
using (IDataReader reader = _database.QueryDataReader("sp_OrderPropertyChangeRequestGetterByPage", CommandType.StoredProcedure, sqlParms.ToArray()))
|
{
|
result = _database.ReadDataToModel<EC_OrderDialogue>(reader);
|
}
|
/*获取页数与返回数据条数*/
|
int? resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[12].Value);
|
pagination.PageCount = resultValue.HasValue ? resultValue.Value : 0;
|
resultValue = CY.Infrastructure.Common.MyConvert.ConvertToInt32(sqlParms[13].Value);
|
pagination.RecordCount = resultValue.HasValue ? resultValue.Value : 0;
|
|
return result;
|
}
|
|
}
|
}
|