protected new void Page_Load(object sender, EventArgs e) { //调用基类方法检测session是否存在 base.Page_Load(sender, e); //删除全部数据 Response.Clear(); //检测是否含有session if (Session.Count < 5) { //跳转 Response.Redirect("/Account/Login", true); //停止加载后续内容 Response.End(); //直接返回 return; } //当前用户所在部门 string procName = Session["proc_name"].ToString(); //当前角色id Int16 roleId = Convert.ToInt16(Session["role_id"]); //检测是否有权限 if (procName != mustProcName || roleId < 0 || roleId > 6) { //设置页面不可用 throw new Exception("您没有打印该单据的权限!"); } //用户传入的送货单号 var bnum = Request["bnum"]; if (bnum == null || bnum.Length == 0) { Response.Write("未检测到传入的送货单号!"); return; } var billNums = bnum.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (billNums.Length <= 0) { Response.Write("传入的送货单号不正确!"); return; } //去重 var lBillNum = new List<string>(); foreach (var billNum in billNums) { if (!lBillNum.Contains(billNum)) { lBillNum.Add(billNum); } } //排序 lBillNum.Sort(); //修改标题 this.Title = "送货单预览 - " + bnum; //表头表身数据表 tabHead = new DataSetDeliveryBillMgr.v_delivery_bill_head_join_custDataTable(); tabContent = new DataSetDeliveryBillMgr.t_delivery_bill_contentDataTable(); //数据适配器 using (var da = new v_delivery_bill_head_join_custTableAdapter()) { //获取表头数据 foreach (var billNum in lBillNum) { tabHead.Merge(da.GetDataByBillNum(billNum)); } if (tabHead.Rows.Count <= 0) { Response.Write("未找到送货单!"); return; } } //数据适配器 using (var da = new t_delivery_bill_contentTableAdapter()) { //获取内容数据 foreach (var billNum in lBillNum) { tabContent.Merge(da.GetDataByBillNum(billNum)); } } }
/// <summary> /// 获取模版1的单据 /// </summary> /// <param name="bnums">传递的单据编号的key名称</param> /// <param name="tabHead">返回的表头数据</param> /// <param name="tabContent">返回的表身数据</param> private void GetBillData( string bnums, DataSetDeliveryBillMgr.v_delivery_bill_head_join_custDataTable tabHead, DataSetDeliveryBillMgr.t_delivery_bill_contentDataTable tabContent ) { //用户传入的送货单号 var bnum = Request[bnums]; if (bnum == null || bnum.Length == 0) { //Response.Write("未检测到传入的送货单号!"); return; } var billNums = bnum.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (billNums.Length <= 0) { //Response.Write("传入的送货单号不正确!"); return; } //去重 var lBillNum = new List<string>(); foreach (var billNum in billNums) { if (!lBillNum.Contains(billNum)) { lBillNum.Add(billNum); } } //排序 lBillNum.Sort(); //修改标题 this.Title = "送货单预览"; //数据适配器 using (var da = new v_delivery_bill_head_join_custTableAdapter()) { //获取表头数据 foreach (var billNum in lBillNum) { tabHead.Merge(da.GetDataByBillNum(billNum)); } if (tabHead.Rows.Count <= 0) { //Response.Write("未找到送货单!"); return; } } //数据适配器 using (var da = new t_delivery_bill_contentTableAdapter()) { //获取内容数据 foreach (var billNum in lBillNum) { tabContent.Merge(da.GetDataByBillNum(billNum)); } } }