private void BindData() { string id = Request.QueryString["id"]; OutStockBLL bll = null; OutStockBillView info = new OutStockBillView(); try { bll = BLLFactory.CreateBLL <OutStockBLL>(); if (string.IsNullOrEmpty(id) == false) { info.ID = id; info = bll.GetViewInfo(info); UIBindHelper.BindForm(this.Page, info); foreach (OutStockDetailView detail in info.Details) { detail.UnitName = string.IsNullOrEmpty(detail.UnitName) == false ? detail.UnitName : detail.MainUnitName; if (detail.OutAmount == 0) { detail.OutAmount = detail.MainUnitAmount; detail.UnitName = detail.MainUnitName; } } this.GvList.DataSource = info.Details; this.GvList.DataBind(); } } catch (Exception ex) { throw ex; } }
private void BindData() { string id = Request.QueryString["id"]; OutStockBLL bll = null; OutStockBill info = new OutStockBill(); try { bll = BLLFactory.CreateBLL <OutStockBLL>(); if (string.IsNullOrEmpty(id) == false) { info.ID = id; info = bll.GetInfo(info); info.Details = info.Details.OrderBy(p => p.Seq).ToList(); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.ID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiUPDATEUSER.Value = info.UPDATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); this.btAdd.Visible = false; this.BillDate.Text = info.BillDate.ToString("yyyy年MM月dd日"); } else { info = new OutStockBill(); info.Details = new List <OutStockDetail>(); this.BillNO.Text = bll.GetNewBillNO(); this.BillDate.Text = DateTime.Now.ToString("yyyy年MM月dd日"); } //绑定明细 DataGridResult <OutStockDetail> matList = new DataGridResult <OutStockDetail>(); matList.Total = 0; matList.Rows = info.Details; foreach (OutStockDetail detail in info.Details) { detail.UnitName = string.IsNullOrEmpty(detail.UnitName) == false ? detail.UnitName : detail.MainUnitName; detail.OutSpecName = string.IsNullOrEmpty(detail.OutSpecName) == false ? detail.OutSpecName : detail.SpecCode; if (detail.OutAmount == 0) { detail.OutAmount = detail.MainUnitAmount; detail.UnitName = detail.MainUnitName; } detail.DeleteAction = "none"; } this.hiMatList.Value = matList.GetJsonSource(); } catch (Exception ex) { throw ex; } }
private void BindData() { OutStockBLL bll = null; DataPage dp = new DataPage(); OutStockBill condition = new OutStockBill(); try { bll = BLLFactory.CreateBLL <OutStockBLL>(); condition.StartDate = this.StartDate.Text; condition.EndDate = this.EndDate.Text; condition.OutStockMode = this.OutStockMode.SelectedValue; condition.Warehouse = this.Warehouse.SelectedValue; condition.ProductType = this.ProductType.SelectedValue; condition.MatID = this.MatID.SelectedValue; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <OutStockBill> list = dp.Result as List <OutStockBill>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString()); //绑定编辑功能 (this.GvList.Rows[i].Cells[10].Controls[0] as WebControl).Attributes.Add("onclick", click); //绑定查看功能 (this.GvList.Rows[i].Cells[11].FindControl("lbtView") as LinkButton).PostBackUrl = "ViewOutStockBill.aspx?id=" + this.GvList.DataKeys[i]["ID"].ToString(); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { OutStockBill info = new OutStockBill(); OutStockBLL bll = null; string result = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <OutStockBLL>(); info.Details = JsonConvertHelper.DeserializeObject <List <OutStockDetail> >(this.hiMatList.Value); if (this.hiID.Value == "") { result = bll.OutStorage(info); } else { info.CREATEUSER = this.HiCREATEUSER.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.ID = this.hiID.Value; bll.Update(info); } if (string.IsNullOrEmpty(result) == true) { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + result + "');", true); } } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { OutStockBill info = new OutStockBill(); OutStockBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); info.Warehouse = this.Warehouse.SelectedValue; info.Details = LAF.Common.Serialization.JsonConvertHelper.DeserializeObject <List <OutStockDetail> >(this.hiMatList.Value); foreach (OutStockDetail detail in info.Details) { detail.OutAmount = 0; detail.SaveSite = this.SaveSite.SelectedValue; } bll = BLLFactory.CreateBLL <OutStockBLL>(); string result = ""; if (this.hiID.Value == "") { result = bll.MLOutStorage(info); } if (result == "") { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSA('提示', '出库完成', function () { window.location.href='OutMatSplitPackage.aspx'; });", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSA('提示', '" + result + "', function () { window.location.href='OutMatSplitPackage.aspx'; });", true); } } catch (Exception ex) { throw ex; } }