protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; UseMatBLL bll = null; try { bll = BLLFactory.CreateBLL <UseMatBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { bll.Delete(new UseMatBill { PID = key.ToString() }); } this.BindData(); } catch (Exception ex) { throw ex; } }
protected void GvList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "buildBill") { string supplyID = e.CommandArgument.ToString(); UseMatBLL bll = BLLFactory.CreateBLL <UseMatBLL>(); bll.Build(supplyID); ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MS('提示', '生成完成')", true); } this.BindData(); }
private void BindData() { UseMatBLL bll = null; DataPage dp = new DataPage(); UseMatBill condition = new UseMatBill(); try { bll = BLLFactory.CreateBLL <UseMatBLL>(); condition.BatchNumber = this.BatchNumber.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <UseMatBill> list = dp.Result as List <UseMatBill>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string pid = null; if (this.GvList.DataKeys[i]["PID"] != null) { pid = this.GvList.DataKeys[i]["PID"].ToString(); string viewClick = string.Format("return view('{0}');", pid); (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Attributes.Add("onclick", viewClick); (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Text = "查看"; (this.GvList.Rows[i].Cells[7].FindControl("LinkBuild") as LinkButton).Visible = false; } else { (this.GvList.Rows[i].Cells[6].FindControl("LinkView") as LinkButton).Enabled = false; } } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
private void BindData() { string id = Request.QueryString["id"]; UseMatBLL bll = null; UseMatBill info = new UseMatBill(); try { bll = BLLFactory.CreateBLL <UseMatBLL>(); if (!string.IsNullOrEmpty(id)) { info.PID = id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); PDNAME.Text = info.ProduceName; FNAME.Text = info.FactoryName; REMARK.Text = info.REMARK; DELIVERYDATE.Text = info.DELIVERYDATE.ToString(); } //绑定明细 DataGridResult <UseMatAmount> supplyMaterialInfo = new DataGridResult <UseMatAmount>(); supplyMaterialInfo.Total = info.Amounts.Count; supplyMaterialInfo.Rows = info.Amounts; this.hiMaterialList.Value = supplyMaterialInfo.GetJsonSource(); DataGridResult <UseMatDetail> details = new DataGridResult <UseMatDetail>(); details.Total = info.Details.Count; details.Rows = info.Details; this.hiUseMatList.Value = details.GetJsonSource(); } catch (Exception ex) { throw ex; } }