Пример #1
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            ProductLine    info = new ProductLine();
            ProductLineBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <ProductLineBLL>();

                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;
            }
        }
Пример #2
0
        private void BindData()
        {
            string         id   = Request.QueryString["id"];
            ProductLineBLL bll  = null;
            ProductLine    info = new ProductLine();

            try
            {
                bll = BLLFactory.CreateBLL <ProductLineBLL>();
                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 ProductLine();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList      pkArray = null;
            ProductLineBLL bll     = null;

            try
            {
                bll = BLLFactory.CreateBLL <ProductLineBLL>();

                pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0);

                foreach (object key in pkArray)
                {
                    if (!bll.HasWorkStation(key.ToString()))
                    {
                        bll.DeleteProductLine(new ProductLine {
                            PID = key.ToString()
                        });
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('选中的生产线有工位,不能被删除');", true);
                    }
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        private void BindData()
        {
            ProductLineBLL bll       = null;
            DataPage       dp        = new DataPage();
            ProductLine    condition = new ProductLine();

            try
            {
                bll = BLLFactory.CreateBLL <ProductLineBLL>();
                condition.PLCODE = this.PLCODE.Text;
                condition.PLNAME = this.PLNAME.Text;

                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <ProductLine> list = dp.Result as List <ProductLine>;
                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[6].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        private void BindProductLineList()
        {
            ProductLineBLL     bll   = null;
            List <ProductLine> array = null;

            bll   = BLLFactory.CreateBLL <ProductLineBLL>();
            array = bll.GetList();

            this.PRID.DataSource = array;
            this.PRID.DataBind();
        }
Пример #6
0
        private void BindProductLineList()
        {
            List <DictInfo>    dicts = null;
            ProductLineBLL     bll   = null;
            List <ProductLine> array = null;

            bll   = BLLFactory.CreateBLL <ProductLineBLL>();
            array = bll.GetList();

            dicts = array.Select(p => new DictInfo {
                ID = p.PID, Des = p.PLNAME
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.PRID, dicts, Tools.QueryDDLFirstItem);
        }
Пример #7
0
        /// <summary>
        /// 获取仓库树数据源
        /// </summary>
        /// <returns></returns>
        public string GetWSList()
        {
            List <TreeNodeResult> list   = new List <TreeNodeResult>();
            FactoryInfoBLL        bllF   = null;
            ProductLineBLL        bllP   = null;
            List <FactoryInfo>    arrayF = null;
            List <ProductLine>    arrayP = null;

            try
            {
                bllF   = BLLFactory.CreateBLL <FactoryInfoBLL>();
                bllP   = BLLFactory.CreateBLL <ProductLineBLL>();
                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 <ProductLine> plines = arrayP.Where(o => o.FACTORYPID == infoF.PID).ToList();
                    foreach (ProductLine infoP in plines)
                    {
                        TreeNodeResult nodeP = new TreeNodeResult();
                        nodeP.Tid   = infoP.PID + "|P";
                        nodeP.Ttext = infoP.PLCODE + "|" + infoP.PLNAME;
                        node.AddchildNode(nodeP);
                    }
                }
                list.Add(rootNode);
                return(TreeNodeResult.GetResultJosnS(list.ToArray()));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }