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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
 
/**  
* Adm_tongxunluBLL.cs
*
* 功 能: 合作客户业务逻辑类
* 类 名: Adm_tongxunluBLL
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2013-4-2 15:11       吴辉      初版
* V0.02  2013-5-29 17:43      吴崎均    增加转换在线会员为厂商客户方法 
*
*
*
*
*
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL;
using CY.Model;
using AbstractFactory;
using CY.IBaseDAL;
using CY.Infrastructure.DESEncrypt;
using CY.Infrastructure.Query;
 
namespace CY.BLL
{
    public class Adm_tongxunluBLL
    {
        IAdm_tongxunluDAL _IAdm_tongxunluDAL = null;
 
        /// <summary>
        /// 初始化构造
        /// </summary>
        public Adm_tongxunluBLL()
    {
        //获取Adm_tongxunlu DAL实现
        _IAdm_tongxunluDAL = Factory.GetDALByInterfaceName(DALInterface.IAdm_tongxunluDAL) as IAdm_tongxunluDAL;
 
 
    }
 
    /// <summary>
    /// 新增送货安排
    /// </summary>
    /// <param name="rType"></param>
    /// <param name="m_OA_CustomerCommunications"></param>
    /// <param name="m_EC_AcceptWayByCustomers"></param>
    /// <returns></returns>
    public bool InsertModel(CY.Model.Adm_tongxunlu m_Adm_tongxunlu)
    {
        try
        {
 
            return _IAdm_tongxunluDAL.InserModel(m_Adm_tongxunlu);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 
    /// <summary>
    /// 修改送货安排
    /// </summary>
    /// <param name="rType"></param>
    /// <returns></returns>
    public bool UpdateModel(CY.Model.Adm_tongxunlu m_Adm_tongxunlu)
    {
        try
        {
            return _IAdm_tongxunluDAL.UpdateModel(m_Adm_tongxunlu);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 
    /// <summary>
    /// 获取全部合作客户
    /// </summary>
    /// <param name="Keyid">主键id</param>
    /// <returns></returns>
    public IEnumerable<Adm_tongxunlu> GetModelList()
    {
        Query query = new Query();
        return _IAdm_tongxunluDAL.SelectAllModel(query);
    }
 
 
    /// <summary>
    /// 根据formid获得信息
    /// </summary>
    /// <param name="Keyid">编号</param>
    /// <returns></returns>
    public IEnumerable<Model.Adm_tongxunlu> GetModelByformid(Guid formid)
    {
 
        return _IAdm_tongxunluDAL.GetModelByformid(formid);
    }
 
    /// <summary>
    /// 获取全部合作客户
    /// </summary>
    /// <param name="Keyid">主键id</param>
    /// <returns></returns>
    public Adm_tongxunlu GetModelByKeyid(int keyid)
    {
 
        return _IAdm_tongxunluDAL.GetModelByKeyid(keyid);
    }
 
 
 
        /// <summary>
        /// 获取全部合作客户
        /// </summary>
        /// <param name="Keyid">主键id</param>
        /// <returns></returns>
        public IEnumerable<Model.Adm_tongxunlu> GetModelByKeyids(string keyids)
        {
 
            return _IAdm_tongxunluDAL.GetModelByKeyids(keyids);
        }
 
 
        /// <summary>
        /// 删除合作客户
        /// </summary>
        /// <param name="rType"></param>
        /// <returns></returns>
        public bool DeleteModel(CY.Model.Adm_tongxunlu rType)
    {
        try
        {
            _IAdm_tongxunluDAL.DeleteModel(rType);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return true;
    }
 
    /// <summary>
    /// 查询合作客户分页列表
    /// </summary>
    /// <param name="pa"></param>
    /// <returns></returns>
    public IEnumerable<Adm_tongxunlu> SelectModelPage(Pagination pa, Guid FirmId, string type_id, string danwei_name,bool IsChangyongziliao,int? staffid)
        {
            string Condition = " and ok.FirmId ='" + FirmId + "' and ok.rec_status = 'A' ";
 
 
            if (!string.IsNullOrEmpty(type_id))
            {
                Condition += " and  ok.type_id = " + type_id + "";
            }
 
            if (!string.IsNullOrEmpty(danwei_name))
            {
                Condition += " and  ok.danwei_name like '%" + danwei_name + "%'";
            }
            if(IsChangyongziliao == false && staffid.HasValue && staffid>0)
            {
                Condition += " and  ok.Jusequanxian like '%," + staffid + ",%'";
            }
 
            Query query = new Query();
            IList<Criterion> criterias = new List<Criterion>()
            {
                new Criterion("", Condition),
 
                new Criterion("orderBy"," createtime desc   ")
            };
            query.Criteria = criterias;
            return _IAdm_tongxunluDAL.SelectModelPage(query, pa);
        }
 
 
 
    }
}