username@email.com
2025-05-09 66beb245e516809514642c00922f0339bf760518
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**  
* OA_VisitNoteDAL.cs
*
* 功 能: 订单回访信息数据访问接口实现类
* 类 名: OA_VisitNoteDAL
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2013-5-21 16:10      吴崎均   初版
* V0.02  2013-5-21 16:50      吴崎均   增加更新回访记录方法、根据订单编号获取回访记录
*
*
*
*
*/
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 OA_VisitNoteDAL : IOA_VisitNoteDAL
    {
        Database _dataBase = null;
        /// <summary>
        /// 初始化构造
        /// </summary>
        public OA_VisitNoteDAL()
        {
            _dataBase = new Database();
        }
 
        #region 废代码
 
        public bool InserModel(Infrastructure.Domain.IAggregateRoot model)
        {
            throw new NotImplementedException();
        }
 
        public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model)
        {
            throw new NotImplementedException();
        }
 
        public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model)
        {
            throw new NotImplementedException();
        }
 
        public IEnumerable<Model.OA_VisitNote> SelectModelPage(Infrastructure.Query.Query query, Infrastructure.Query.Pagination pagination)
        {
            throw new NotImplementedException();
        }
 
        public IEnumerable<Model.OA_VisitNote> SelectAllModel(Infrastructure.Query.Query query)
        {
            throw new NotImplementedException();
        }
        #endregion
 
        /// <summary>
        /// 更新回访记录
        /// </summary>
        /// <param name="visitNote">回访记录</param>
        /// <returns></returns>
        public bool UpdateVisitNote(OA_VisitNote visitNote)
        {
            if (visitNote == null)
            {
                return false;
            }
            else { }
            IList<SqlParameter> sqlParms = new List<SqlParameter>()
            {
                new SqlParameter("@Keyid",visitNote.Keyid){SqlDbType=System.Data.SqlDbType.Int},
                new SqlParameter("@IsVisited",visitNote.IsVisited){SqlDbType=System.Data.SqlDbType.Bit},
                new SqlParameter("@Scores",visitNote.Scores){SqlDbType=System.Data.SqlDbType.VarChar,Size=30},
                new SqlParameter("@Reason",visitNote.Reason){SqlDbType=System.Data.SqlDbType.VarChar,Size=300},
                new SqlParameter("@Advice",visitNote.Advice){SqlDbType=System.Data.SqlDbType.VarChar,Size=300},
                new SqlParameter("@Operator",visitNote.Operator){SqlDbType=System.Data.SqlDbType.VarChar,Size=20}
            };
            try
            {
                _dataBase.Query("sp_OA_VisitNote_Update", CommandType.StoredProcedure, sqlParms.ToArray<SqlParameter>());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return true;
 
        }
        /// <summary>
        /// 根据订单编号获取回访记录
        /// </summary>
        /// <param name="orderId">订单编号</param>
        /// <returns></returns>
        public OA_VisitNote SelectVisitNoteById(int orderId)
        {
 
            if (0 >= orderId) return null; else ;
            List<OA_VisitNote> result = null;
            try
            {
                using (IDataReader reader = _dataBase.QueryDataReader("sp_OA_VisitNote_SelectRow", CommandType.StoredProcedure, new SqlParameter("@orderId", orderId)))
                {
                    result = _dataBase.ReadDataToModel<OA_VisitNote>(reader);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return null == result || 0 == result.Count ? null : result[0];
 
        }
    }
}