Beispiel #1
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            WHMatSpec    info = new WHMatSpec();
            WHMatSpecBLL bll  = null;

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

                bll        = BLLFactory.CreateBLL <WHMatSpecBLL>();
                info.MatID = this.hiMatID.Value;
                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.ID = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList    pkArray = null;
            WHMatSpecBLL bll     = null;

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

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

                foreach (object key in pkArray)
                {
                    bll.Delete(new WHMatSpec {
                        ID = key.ToString()
                    });
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private void BindData()
        {
            string       id   = Request.QueryString["id"];
            WHMatSpecBLL bll  = null;
            WHMatSpec    info = new WHMatSpec();

            try
            {
                bll = BLLFactory.CreateBLL <WHMatSpecBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value = info.ID;
                }
                else
                {
                    info = new WHMatSpec();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #4
0
        private void BindData()
        {
            WHMatSpecBLL bll       = null;
            DataPage     dp        = new DataPage();
            WHMatSpec    condition = new WHMatSpec();
            string       matID     = Request.QueryString["matID"];

            try
            {
                bll = BLLFactory.CreateBLL <WHMatSpecBLL>();
                this.MatID.Value = matID;

                WHMat mat = BLLFactory.CreateBLL <WHMatBLL>().Get(new WHMat {
                    ID = matID
                });
                this.MatCode.Text = mat.MatCode;
                this.MatName.Text = mat.MatName;

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

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