protected void btSave_Click(object sender, EventArgs e) { InStockBill info = new InStockBill(); InStockBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); info.InStockMode = this.InStockMode.SelectedValue; info.Warehouse = this.Warehouse.SelectedValue; info.Details = LAF.Common.Serialization.JsonConvertHelper.DeserializeObject <List <InStockDetail> >(this.hiMatList.Value); foreach (InStockDetail detail in info.Details) { detail.SaveSite = this.SaveSite.SelectedValue; if (detail.MatBarCode == null) { detail.MatBarCode = ""; } } bll = BLLFactory.CreateBLL <InStockBLL>(); if (this.hiID.Value == "") { bll.InMatStorage(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSA('提示', '入库完成', function () { window.location.href='InMatStorageMobile.aspx'; });", true); } catch (Exception ex) { throw ex; } }
private void BindData() { string id = Request.QueryString["id"]; InStockBLL bll = null; InStockBillView info = new InStockBillView(); try { bll = BLLFactory.CreateBLL <InStockBLL>(); if (string.IsNullOrEmpty(id) == false) { info.ID = id; info = bll.GetViewInfo(info); UIBindHelper.BindForm(this.Page, info); foreach (InStockDetailView detail in info.Details) { detail.UnitName = string.IsNullOrEmpty(detail.UnitName) == false ? detail.UnitName : detail.MainUnitName; } this.GvList.DataSource = info.Details; this.GvList.DataBind(); } } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { InStockBill info = new InStockBill(); InStockBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <InStockBLL>(); info.Details = JsonConvertHelper.DeserializeObject <List <InStockDetail> >(this.hiMatList.Value); if (this.hiID.Value == "") { bll.InStorage(info); } else { info.CREATEUSER = this.HiCREATEUSER.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.ID = this.hiID.Value; bll.Update(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } catch (Exception ex) { throw ex; } }
private void BindData() { string id = Request.QueryString["id"]; InStockBLL bll = null; InStockBill info = new InStockBill(); try { bll = BLLFactory.CreateBLL <InStockBLL>(); 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 InStockBill(); info.Details = new List <InStockDetail>(); this.BillNO.Text = bll.GetNewBillNO(); this.BillDate.Text = DateTime.Now.ToString("yyyy年MM月dd日"); } //绑定明细 DataGridResult <InStockDetail> matList = new DataGridResult <InStockDetail>(); matList.Total = 0; matList.Rows = info.Details; foreach (InStockDetail detail in info.Details) { detail.UnitName = string.IsNullOrEmpty(detail.UnitName) == false ? detail.UnitName : detail.MainUnitName; detail.InSpecName = string.IsNullOrEmpty(detail.InSpecName) == false ? detail.InSpecName : detail.SpecCode; detail.DeleteAction = "none"; } this.hiMatList.Value = matList.GetJsonSource(); } catch (Exception ex) { throw ex; } }
private void BindData() { InStockBLL bll = null; DataPage dp = new DataPage(); InStockBill condition = new InStockBill(); try { bll = BLLFactory.CreateBLL <InStockBLL>(); condition.StartDate = this.StartDate.Text; condition.EndDate = this.EndDate.Text; condition.InStockMode = this.InStockMode.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 <InStockBill> list = dp.Result as List <InStockBill>; 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 = "ViewInStockBill.aspx?id=" + this.GvList.DataKeys[i]["ID"].ToString(); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }