using CY.BLL;
using CY.BLL.OA;
using CY.BLL.Sys;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
using CY.Model;
using CY.SQLDAL;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace CY.WebForm.Pages.business
{
public partial class CorporateClientsWiFuTiXingList : BasePage
{
///
/// 获取当前可能的节日
///
public string JirRI { get; set; }
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
Sys_DictionaryBLL _Sys_DictionaryBLL = null;
OA_StaffBLL bll_OA_StaffBLL = null;
OA_CustomerApplyBLL bll_OA_CustomerApplyBLL = null;
EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
Sys_CitySiteBLL bll_Sys_CitySiteBLL = null;
//增加订单查询
EC_OrderBasicDAL bll_eC_OrderBasicDAL = null;
//初始化
public CorporateClientsWiFuTiXingList()
{
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
bll_OA_StaffBLL = new OA_StaffBLL();
bll_OA_CustomerApplyBLL = new OA_CustomerApplyBLL();
bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
bll_Sys_CitySiteBLL = new Sys_CitySiteBLL();
bll_eC_OrderBasicDAL = new EC_OrderBasicDAL();
}
protected void Page_Load(object sender, EventArgs e)
{
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
if (!IsPostBack)
{
BindProvince();
// InitialSelectData();
BindList();
//InitialSelectData();
}
if (!string.IsNullOrEmpty(Request["delete"]))
{
OA_CorporateClients model = bll_OA_CorporateClientsBLL.GetModel(Request["delete"].ToGuid2());
if (model != null && model.Keyid != null)
{
if (bll_OA_CorporateClientsBLL.DeleteModel(model))
Response.Redirect("/Pages/business/CorporateClientsList.aspx");
else
JavaScript.MessageBox("删除失败", this);
}
else
JavaScript.MessageBox("删除失败", this);
}
}
///
/// 获取当前节日显示
///
///
public string getJieri()
{
if (JirRI != null)
return JirRI;
//该段代码是为了节日提醒是什么节日 做的准备
DateTime time = DateTime.Now;
ChineseLunisolarCalendar chineseLunisolarCalendar = new ChineseLunisolarCalendar();
int lmonth = chineseLunisolarCalendar.GetMonth(time);
int lday = chineseLunisolarCalendar.GetDayOfMonth(time);
switch (lmonth)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
JirRI = "端午节";
break;
case 5:
JirRI = "端午节";
break;
case 6:
JirRI = "端午节";
break;
case 7:
JirRI = "中秋节";
break;
case 8:
JirRI = "中秋节";
break;
case 9:
JirRI = "中秋节";
break;
case 10:
break;
case 11:
break;
case 12:
JirRI = "春节";
break;
case 13:
JirRI = "春节";
break;
default:
break;
}
return JirRI;
}
//绑定列表
private void BindList()
{
bool? needWeifu = null;
bool? needJiejiaRiWeiFu = null;
string shifouwanjie = null;
if (this.seltixing.Value == "1"|| this.seltixing.Value == "0")
needWeifu = true;
else
needWeifu = null;
if (this.seltixing.Value == "" || this.seltixing.Value == "2")
{
needJiejiaRiWeiFu = true;
}
else
{
needJiejiaRiWeiFu = null;
if (this.seltixing.Value == "0")
shifouwanjie = "1";
else
shifouwanjie = "2";
}
Pagination pa = new Pagination();
pa.PageSize = UCPager1.AspNetPager.PageSize;
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.GetModelPageListEx(pa,
CurrentUser.MemberId,
this.txtquery_userName.Value,
Province: this.selectProvince.SelectedItem.Text.Replace("全部", ""),
City: this.selectCity.SelectedItem.Text.Replace("全部", ""),
County: this.selectCounty.SelectedItem.Text.Replace("全部", ""),
IsStaff:(CurrentUser.TrueType == "员工"),
StaffMemberId: CurrentUser.TrueMemberId,
StaffId: CurrentUser.StaffId,
Shifouwanjie: shifouwanjie,
NeedWeifu: needWeifu,
NeedJiejiaRiWeiFu: needJiejiaRiWeiFu
);
this.RepClientList.DataBind();
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
//分页事件
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindList();
}
//查询事件
protected void btn_Search_Click(object sender, EventArgs e)
{
BindList();
}
//绑定省
protected void BindProvince()
{
this.selectProvince.Items.Clear();
if (CurrentUser.TrueType == "员工")
this.selectProvince.DataSource = bll_Sys_CitySiteBLL.SelectStaffManageProvinceList(CurrentUser.TrueMemberId);
else
this.selectProvince.DataSource = bll_Sys_CitySiteBLL.SelectAllNextModel(0, 0, 1);
this.selectProvince.DataTextField = "Name";
this.selectProvince.DataValueField = "Keyid";
this.selectProvince.DataBind();
this.selectProvince.Items.Insert(0, new ListItem("全部", ""));
this.selectCity.Items.Insert(0, new ListItem("全部", ""));
this.selectCounty.Items.Insert(0, new ListItem("全部", ""));
}
//改变省绑定市
protected void ChangeProvince(object sender, EventArgs e)
{
this.selectCity.Items.Clear();
this.selectCounty.Items.Clear();
Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(this.selectProvince.SelectedValue.ToInt32() ?? 0);
if (m_Sys_CitySite != null)
{
if (CurrentUser.TrueType == "员工")
this.selectCity.DataSource = bll_Sys_CitySiteBLL.SelectStaffManageCityList(m_Sys_CitySite.Keyid, CurrentUser.TrueMemberId);
else
this.selectCity.DataSource = bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2);
this.selectCity.DataTextField = "Name";
this.selectCity.DataValueField = "Keyid";
this.selectCity.DataBind();
}
this.selectCity.Items.Insert(0, new ListItem("全部", ""));
this.selectCounty.Items.Insert(0, new ListItem("全部", ""));
}
//改变市绑定区
protected void ChangeCity(object sender, EventArgs e)
{
this.selectCounty.Items.Clear();
Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(this.selectCity.SelectedValue.ToInt32() ?? 0);
if (m_Sys_CitySite != null)
{
if (CurrentUser.TrueType == "员工")
this.selectCounty.DataSource = bll_Sys_CitySiteBLL.SelectStaffManageCountryList(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, CurrentUser.TrueMemberId);
else
this.selectCounty.DataSource = bll_Sys_CitySiteBLL.SelectProxyNextModel(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, 3);
this.selectCounty.DataTextField = "Name";
this.selectCounty.DataValueField = "Keyid";
this.selectCounty.DataBind();
}
this.selectCounty.Items.Insert(0, new ListItem("全部", ""));
}
}
}