username@email.com
2025-05-21 a980cd04341d71216e0f59bd4b7327fe9fc50032
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**  
* 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;
        }
 
    }
}