protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; FactoryInfoBLL bll = null; try { bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { if (!bll.HasProductLine(key.ToString())) { bll.DeleteFactory(new FactoryInfo { PID = key.ToString() }); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('选中的工厂有生产线,不能被删除');", true); } } this.BindData(); } catch (Exception ex) { throw ex; } }
private void BindData() { FactoryInfoBLL bll = null; DataPage dp = new DataPage(); FactoryInfo condition = new FactoryInfo(); try { bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); condition.PCODE = this.PCODE.Text; condition.PNAME = this.PNAME.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <FactoryInfo> list = dp.Result as List <FactoryInfo>; 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[5].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { FactoryInfo info = new FactoryInfo(); FactoryInfoBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); 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; } }
private void BindData() { string id = Request.QueryString["id"]; FactoryInfoBLL bll = null; FactoryInfo info = new FactoryInfo(); try { bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); if (string.IsNullOrEmpty(id) == false) { info.PID = id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.PID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); } else { info = new FactoryInfo(); } } catch (Exception ex) { throw ex; } }
private void BindFactoryList() { FactoryInfoBLL bll = null; List <FactoryInfo> array = null; bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); array = bll.GetList(); this.FACTORYPID.DataSource = array; this.FACTORYPID.DataBind(); }
private void BindFactoryList() { List <DictInfo> dicts = null; FactoryInfoBLL bll = null; List <FactoryInfo> array = null; bll = BLLFactory.CreateBLL <FactoryInfoBLL>(); array = bll.GetList(); dicts = array.Select(p => new DictInfo { ID = p.PID, Des = p.PNAME }).ToList <DictInfo>(); Tools.BindDataToDDL(this.FACTORYPID, dicts, Tools.QueryDDLFirstItem); }
/// <summary> /// 获取仓库树数据源 /// </summary> /// <returns></returns> public string GetWSList() { List <TreeNodeResult> list = new List <TreeNodeResult>(); FactoryInfoBLL bllF = null; ProcessFlowBLL bllP = null; List <FactoryInfo> arrayF = null; List <ProcessFlow> arrayP = null; try { bllF = BLLFactory.CreateBLL <FactoryInfoBLL>(); bllP = BLLFactory.CreateBLL <ProcessFlowBLL>(); arrayF = bllF.GetList(); arrayP = bllP.GetList(); TreeNodeResult rootNode = new TreeNodeResult(); rootNode.Tid = ""; rootNode.Ttext = "工厂/工艺流程"; foreach (FactoryInfo infoF in arrayF) { TreeNodeResult node = new TreeNodeResult(); node.Tid = infoF.PID + "|F"; node.Ttext = infoF.PCODE + "|" + infoF.PNAME; rootNode.AddchildNode(node); List <ProcessFlow> plines = arrayP.Where(o => o.FACTORYPID == infoF.PID).ToList(); foreach (ProcessFlow infoP in plines) { TreeNodeResult nodeP = new TreeNodeResult(); nodeP.Tid = infoP.PID + "|P"; nodeP.Ttext = infoP.PCODE + "|" + infoP.PNAME; node.AddchildNode(nodeP); } } list.Add(rootNode); return(TreeNodeResult.GetResultJosnS(list.ToArray())); } catch (Exception ex) { throw ex; } }