protected void btSave_Click(object sender, EventArgs e) { ProduceBOM info = new ProduceBOM(); ProduceDOMBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceDOMBLL>(); info.Details = JsonConvertHelper.DeserializeObject <List <BOMDetail> >(this.hiBomDetailList.Value); if (this.hiID.Value == "") { bll.Insert(info); } else { info.CREATEUSER = this.HiCREATEUSER.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.PID = this.hiID.Value; bll.Update(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } catch (Exception ex) { throw ex; } }
protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; ProduceDOMBLL bll = null; try { bll = BLLFactory.CreateBLL <ProduceDOMBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { bll.Delete(new ProduceBOM { PID = key.ToString() }); } this.BindData(); } catch (Exception ex) { throw ex; } }
private void BindData() { ProduceDOMBLL bll = null; DataPage dp = new DataPage(); ProduceBOM condition = new ProduceBOM(); try { bll = BLLFactory.CreateBLL <ProduceDOMBLL>(); condition.PRODUCENAME = this.PRODUCENAME.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <ProduceBOM> list = dp.Result as List <ProduceBOM>; 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]["PID"].ToString()); (this.GvList.Rows[i].Cells[4].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentEncoding = Encoding.UTF8; context.Response.ContentType = "application/json"; ProducePlanBLL ppbll = BLLFactory.CreateBLL <ProducePlanBLL>(); SupplyInfoBLL sibll = BLLFactory.CreateBLL <SupplyInfoBLL>(); string planID = context.Request.QueryString["planID"]; SupplyInfo siresult = ppbll.GetProducePlanInfoByID(planID); if (siresult == null) { siresult = new SupplyInfo(); if (siresult != null) { siresult.PID = "none"; } } else { //获取生产计划 ProducePlan plan = new ProducePlanBLL().Get(new ProducePlan { PID = planID }); //获取bom明细 siresult.Details = sibll.GetMaterialListByBOM(siresult.ProductionID); //获取bom基本信息 ProduceBOM bomBase = new ProduceDOMBLL().GetByProduceID(siresult.ProductionID); //生成要货明细 foreach (SupplyMaterialInfo detail in siresult.Details) { if (bomBase.Amount != 0) { detail.AMOUNT = Convert.ToInt32(decimal.Parse(plan.PLANAMOUNT)) / bomBase.Amount; } else { detail.AMOUNT = 0; } } } context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(siresult)); }
private void BindData() { string id = Request.QueryString["id"]; ProduceDOMBLL bll = null; ProduceBOM info = new ProduceBOM(); try { bll = BLLFactory.CreateBLL <ProduceDOMBLL>(); if (!string.IsNullOrEmpty(id)) { info.PID = id; info = bll.Get(info); info.Details = bll.GetList(info.PID); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.PID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); } else { info = new ProduceBOM(); info.Details = new List <BOMDetail>(); } //绑定明细 DataGridResult <BOMDetail> bomDetail = new DataGridResult <BOMDetail>(); bomDetail.Total = info.Details.Count; bomDetail.Rows = info.Details; foreach (BOMDetail detail in info.Details) { detail.DeleteAction = "deleteItem(\'" + detail.MATRIALID + "\')"; } this.hiBomDetailList.Value = bomDetail.GetJsonSource(); } catch (Exception ex) { throw ex; } }