Пример #1
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList      pkArray = null;
            WorkStationBLL bll     = null;

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

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

                foreach (object key in pkArray)
                {
                    if (!bll.HasUsed(key.ToString()))
                    {
                        bll.DeleteWorkStation(new WorkStation {
                            PID = key.ToString()
                        });
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('选中的工位被使用过,不能被删除');", true);
                    }
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        private void BindData()
        {
            string         id   = Request.QueryString["id"];
            WorkStationBLL bll  = null;
            WorkStation    info = new WorkStation();

            try
            {
                bll = BLLFactory.CreateBLL <WorkStationBLL>();
                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 WorkStation();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            WorkStation    info = new WorkStation();
            WorkStationBLL bll  = null;

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

                bll = BLLFactory.CreateBLL <WorkStationBLL>();

                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;
            }
        }
Пример #4
0
        private void BindWorkStation()
        {
            WorkStationBLL     bll   = null;
            List <WorkStation> array = null;

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

            this.STID.DataSource = array;
            this.STID.DataBind();
        }
Пример #5
0
        private void BindData()
        {
            WorkStationBLL bll       = null;
            DataPage       dp        = new DataPage();
            WorkStation    condition = new WorkStation();
            string         wsID      = Request.QueryString["wsID"];

            if (!string.IsNullOrEmpty(wsID))
            {
                if (wsID.Split('|')[1] == "F")
                {
                    condition.FACTORYPID = wsID.Split('|')[0];
                }
                else
                {
                    condition.PRODUCTLINEPID = wsID.Split('|')[0];
                }
            }
            try
            {
                bll = BLLFactory.CreateBLL <WorkStationBLL>();
                condition.WSCODE = this.WSCODE.Text;
                condition.WSNAME = this.WSNAME.Text;
                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <WorkStation> list = dp.Result as List <WorkStation>;
                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[8].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }