using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL.Inquiry; using CY.Infrastructure.Common; using CY.Model; using System.Web.UI.HtmlControls; namespace CY.WebForm.Pages.sysInquiry { public partial class GramWeightSelect : BasePage { #region 变量 PaperInfoBLL _paperInfoBLL = new PaperInfoBLL(); RangeofBusinessBLL _rangeofBusinessBLL = new RangeofBusinessBLL(); #endregion #region 属性 #endregion #region 方法 private void BindGramWeightList() { int papeId=-1; int printTypeId=-1; if (Request["PapeId"] != null) { papeId = int.Parse(Request["PapeId"].ToString()); hidPaperId.Value = papeId.ToString(); } if(Request["PrintTypeId"]!=null) { printTypeId=int.Parse(Request["PrintTypeId"].ToString()); } List list = _paperInfoBLL.GetPaperListBygramWeight(papeId); this.RepGramWeightList.DataSource = list; this.RepGramWeightList.DataBind(); List gramWeightList = _rangeofBusinessBLL.GramWeightByPrintTypeId(printTypeId, papeId); if (gramWeightList.Count > 0) { foreach (RepeaterItem item in this.RepGramWeightList.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { HtmlInputCheckBox cbk = item.FindControl("cbk") as HtmlInputCheckBox; if (!IsExit(gramWeightList, cbk.Value.ToInt32().Value)) { cbk.Checked = false; } } } } } public bool IsExit(List gramWeightList, int value) { foreach (int i in gramWeightList) { if (i == value) return true; } return false; } #endregion #region 事件 /// /// 初始化 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindGramWeightList(); } } #endregion } }