using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL.EC;
|
using CY.Model;
|
using CY.Infrastructure.Common;
|
using CY.BLL;
|
namespace CY.WebForm.Pages.sysInquiry
|
{
|
public partial class SelectBusinessRange : BasePage
|
{
|
#region 变量
|
EC_SellerBusinessLimitsBLL _eC_SellerBusinessLimitsBLL = new EC_SellerBusinessLimitsBLL();
|
EC_MemberBasicBLL _EC_MemberBasicBLL = new EC_MemberBasicBLL();
|
#endregion
|
|
#region 属性
|
#endregion
|
|
#region 方法
|
/// <summary>
|
/// 初始化绑定页面
|
/// </summary>
|
private void BindPage()
|
{
|
int isShowInquiry = _EC_MemberBasicBLL.GetMemberByMemberId(CurrentUser.MemberId).IsShowInquiry;
|
if (isShowInquiry == 1)
|
{
|
this.cbkIsShowInquiry.Checked = true;
|
}
|
else
|
{
|
this.cbkIsShowInquiry.Checked = false;
|
}
|
IList<SysInquiry_PrintingType> list = _eC_SellerBusinessLimitsBLL.GetBusinessRangeByFirmId(CurrentUser.MemberId);
|
this.RepBusinessRangeList.DataSource = list;
|
this.RepBusinessRangeList.DataBind();
|
IList<EC_SellerBusinessLimits> limitList = _eC_SellerBusinessLimitsBLL.GetBusinessRangeDetaiByFirmId(CurrentUser.MemberId);
|
foreach (RepeaterItem item in this.RepBusinessRangeList.Items)
|
{
|
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
|
{
|
CheckBox cbkSel = item.FindControl("cbkSel") as CheckBox;
|
CheckBox cbkHBSel = item.FindControl("cbkHBSel") as CheckBox;
|
CheckBox cbkZBSel = item.FindControl("cbkZBSel") as CheckBox;
|
Label lblKeyId = item.FindControl("lblKeyId") as Label;
|
int keyId=lblKeyId.Text.ToInt32().Value;
|
EC_SellerBusinessLimits model = limitList.Single<EC_SellerBusinessLimits>(p => p.BusinessId == keyId) as EC_SellerBusinessLimits;
|
if (model.JoinFlag.HasValue)
|
{
|
if (model.JoinFlag.Value == 1)
|
{
|
cbkHBSel.Checked = true;
|
}
|
else if (model.JoinFlag.Value == -1)
|
{
|
cbkHBSel.Checked = true;
|
cbkHBSel.Visible = false;
|
cbkHBSel.Text = "-1";
|
}
|
}
|
if (model.SpecialFlag.HasValue)
|
{
|
if (model.SpecialFlag.Value == 1)
|
{
|
cbkZBSel.Checked = true;
|
}
|
else if (model.SpecialFlag.Value == -1)
|
{
|
cbkZBSel.Checked = true;
|
cbkZBSel.Visible = false;
|
cbkZBSel.Text = "-1";
|
}
|
}
|
if (cbkHBSel.Checked || cbkZBSel.Checked)
|
{
|
cbkSel.Checked = true;
|
}
|
}
|
}
|
}
|
#endregion
|
|
#region 事件
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
BindPage();
|
}
|
}
|
|
/// <summary>
|
/// 保存事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btnSave_Click(object sender, EventArgs e)
|
{
|
bool isSuccess = true;
|
IList<EC_SellerBusinessLimits> list = new List<EC_SellerBusinessLimits>();
|
EC_SellerBusinessLimits model = null;
|
foreach (RepeaterItem item in this.RepBusinessRangeList.Items)
|
{
|
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
|
{
|
CheckBox cbkHBSel = item.FindControl("cbkHBSel") as CheckBox;
|
CheckBox cbkZBSel = item.FindControl("cbkZBSel") as CheckBox;
|
Label lblKeyId = item.FindControl("lblKeyId") as Label;
|
int keyId = lblKeyId.Text.ToInt32().Value;
|
model = new EC_SellerBusinessLimits();
|
model.SellerId = CurrentUser.MemberId;
|
model.BusinessId = keyId;
|
if (cbkHBSel.Text == "-1")
|
{
|
model.JoinFlag = -1;
|
}
|
else
|
{
|
if (cbkHBSel.Checked)
|
{
|
model.JoinFlag = 1;
|
}
|
else
|
{
|
model.JoinFlag = 0;
|
}
|
}
|
if (cbkZBSel.Text == "-1")
|
{
|
model.SpecialFlag = -1;
|
}
|
else
|
{
|
if (cbkZBSel.Checked)
|
{
|
model.SpecialFlag = 1;
|
}
|
else
|
{
|
model.SpecialFlag = 0;
|
}
|
}
|
list.Add(model);
|
}
|
}
|
isSuccess = _eC_SellerBusinessLimitsBLL.SaveBusinessRangeDetailByFirmId(list);
|
if (isSuccess)
|
{
|
JavaScript.MessageBox("保存成功", this);
|
}
|
else
|
{
|
JavaScript.MessageBox("保存失败", this);
|
}
|
}
|
|
/// <summary>
|
/// 保存事件2
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btnSave2_Click(object sender, EventArgs e)
|
{
|
int isShowInquiry = 1;
|
if (!this.cbkIsShowInquiry.Checked)
|
{
|
isShowInquiry = 0;
|
}
|
bool isSuccess = _EC_MemberBasicBLL.UpdateIsShowInquiry(CurrentUser.MemberId, isShowInquiry);
|
if (isSuccess)
|
{
|
JavaScript.MessageBox("保存成功", this);
|
}
|
else
|
{
|
JavaScript.MessageBox("保存失败", this);
|
}
|
}
|
#endregion
|
}
|
}
|