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 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 list = null; if (CurrentUser.MemberType == "管理员") { list = new List() { 2,4,5,6,11 }; } else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店") { list = new List() { 7,8 }; } else //买家会员 { list = new List() { 3,7,8,10,12 }; } if (list.Contains(meanValue)) { isNotExsit = false; } return isNotExsit; } //收入 public bool IsExsitByIn(int meanValue) { bool isExsit = false; IList list = null; if (CurrentUser.MemberType == "管理员") { list = new List() { 12,13,15,7,3,10,14 }; } else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店") { list = new List() { 0,1,2,4,5,6,9,11,15 }; } else //买家会员 { list = new List() { 0,1,2,9,11,15 }; } if (list.Contains(meanValue)) { isExsit = true; } return isExsit; } //支出 public bool IsExsitByOut(int meanValue) { bool isExsit = false; IList list = null; if (CurrentUser.MemberType == "管理员") { list = new List() { 0,8,1,16,9 }; } else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店") { list = new List() { 3,4,5,6,10,12,13,14,16 }; } else //买家会员 { list = new List() { 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 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(); } } }