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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
using CY.Model;
 
namespace CY.WebForm.Pages.membermanage
{
    //吴辉
    //会员账户明细
    public partial class MemberMoneyList : BasePage
    {
        Pay_IncExpRecordBLL bll_Pay_IncExpRecordBLL = null;
        Sys_DictionaryBLL _sys_DictionaryBLL = null;
        EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
 
        //初始化
        public MemberMoneyList()
        {
            bll_Pay_IncExpRecordBLL = new Pay_IncExpRecordBLL();
            _sys_DictionaryBLL = new Sys_DictionaryBLL();
            bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
            if (!IsPostBack)
            {
                this.hidFirmId.Value = this.CurrentUser.MemberId.ToString();
                BindDropDownList();
                BindList();
            }
        }
 
        //绑定查询条件
        private void BindDropDownList()
        {
            IsNotExsit(4);
            IEnumerable<Sys_Dictionary> dicList = null;
            dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsNotExsit(p.MeanValue.Value));
            this.ddlBalanceAccount.DataSource = dicList;
            this.ddlBalanceAccount.DataTextField = "Name";
            this.ddlBalanceAccount.DataValueField = "MeanValue";
            this.ddlBalanceAccount.DataBind();
            this.ddlBalanceAccount.Items.Insert(0, new ListItem("全部", "-1"));
        }
 
        //加载数据
        private bool IsNotExsit(int meanValue)
        {
            bool isNotExsit = true;
            IList<int> list = null;
            if (CurrentUser.MemberType == "管理员")
            {
                list = new List<int>()
                {
                    2,4,5,6,11
                };
            }
            else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
            {
                list = new List<int>()
                {
                   7,8
                };
            }
            else //买家会员
            {
                list = new List<int>()
                {
                   3,7,8,10,12
                };
            }
            if (list.Contains(meanValue))
            {
                isNotExsit = false;
            }
            return isNotExsit;
        }
 
        //收入
        public bool IsExsitByIn(int meanValue)
        {
            bool isExsit = false;
            IList<int> list = null;
            if (CurrentUser.MemberType == "管理员")
            {
                list = new List<int>()
                {
                    12,13,15,7,3,10,14
                };
            }
            else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
            {
                list = new List<int>()
                {
                   0,1,2,4,5,6,9,11,15
                };
            }
            else //买家会员
            {
                list = new List<int>()
                {
                   0,1,2,9,11,15
                };
            }
            if (list.Contains(meanValue))
            {
                isExsit = true;
            }
            return isExsit;
        }
 
        //支出
        public bool IsExsitByOut(int meanValue)
        {
            bool isExsit = false;
            IList<int> list = null;
            if (CurrentUser.MemberType == "管理员")
            {
                list = new List<int>()
                {
                    0,8,1,16,9
                };
            }
            else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
            {
                list = new List<int>()
                {
                   3,4,5,6,10,12,13,14,16
                };
            }
            else //买家会员
            {
                list = new List<int>()
                {
                   4,5,6,13,14,16
                };
            }
            if (list.Contains(meanValue))
            {
                isExsit = true;
            }
            return isExsit;
        }
 
        //绑定数据
        private void BindList()
        {
            Pay_PaymentAccount m_Pay_PaymentAccount = bll_EC_MemberBasicBLL.GetPaymentAccountByMemberId(Request["MemberId"].ToGuid2());
 
            Pagination pa = new Pagination();
            pa.PageSize = UCPager1.AspNetPager.PageSize;
            pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
            string startDate = this.txtBeginData.Value.ToString();
            string endDate = this.txtEndDate.Value.ToString();
            int tradingType = ddlTradingType.SelectedValue.ToString().ToInt32().Value;
            int balanceAccount = ddlBalanceAccount.SelectedValue.ToString().ToInt32().Value;
            this.RepClientList.DataSource = bll_Pay_IncExpRecordBLL.SelectAllModelByPaging(pa, m_Pay_PaymentAccount.Keyid, startDate, endDate, tradingType, balanceAccount, "", "","","","");
            this.RepClientList.DataBind();
            UCPager1.AspNetPager.RecordCount = pa.RecordCount;
 
        }
 
        //分页事件
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
 
        //查询事件
        protected void btn_Query_Click(object sender, EventArgs e)
        {
            BindList();
        }
 
        protected void ddlTradingType_SelectedIndexChanged(object sender, EventArgs e)
        {
            IEnumerable<Sys_Dictionary> dicList = null;
            if (ddlTradingType.SelectedValue == "0")
            {
                dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsNotExsit(p.MeanValue.Value));
            }
            else if (ddlTradingType.SelectedValue == "1")
            {
                dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsExsitByIn(p.MeanValue.Value));
            }
            else
            {
                dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsExsitByOut(p.MeanValue.Value));
            }
            this.ddlBalanceAccount.DataSource = dicList;
            this.ddlBalanceAccount.DataTextField = "Name";
            this.ddlBalanceAccount.DataValueField = "MeanValue";
            this.ddlBalanceAccount.DataBind();
            this.ddlBalanceAccount.Items.Insert(0, new ListItem("全部", "-1"));
            BindList();
        }
 
        protected void ddlBalanceAccount_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindList();
        }
 
        protected void ddlMemberType_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindList();
        }
 
        protected void txtMemberName_TextChanged(object sender, EventArgs e)
        {
            BindList();
        }
    }
}