Exemple #1
0
        private void BindData()
        {
            MatUnitBLL bll = null;
            DataPage dp = new DataPage();
            MatUnit condition = new MatUnit();

            try
            {
                bll = BLLFactory.CreateBLL<MatUnitBLL>();
                condition.Description = this.Description.Text;

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

                List<MatUnit> list = dp.Result as List<MatUnit>;
                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[3].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            MatUnit    info = new MatUnit();
            MatUnitBLL bll  = null;

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

                bll = BLLFactory.CreateBLL <MatUnitBLL>();

                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.ID         = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        private void BindData()
        {
            string     id   = Request.QueryString["id"];
            MatUnitBLL bll  = null;
            MatUnit    info = new MatUnit();

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

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                }
                else
                {
                    info = new MatUnit();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        private void InitForm()
        {
            List <DictInfo> dicts = null;

            //货品
            List <WHMat> matList = BLLFactory.CreateBLL <WHMatBLL>().GetList();

            dicts = matList.Select(p => new DictInfo {
                ID = p.ID, Des = p.MatName
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.MatID, dicts, Tools.QueryDDLFirstItem);

            //绑定计量单位
            dicts = new MatUnitBLL().GetList().Select(p => new DictInfo {
                ID = p.ID, Des = p.Description
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.UnitID, dicts, "");
        }
Exemple #5
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList pkArray = null;
            MatUnitBLL bll = null;
            try
            {
                bll = BLLFactory.CreateBLL<MatUnitBLL>();

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

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

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
        private void InitForm()
        {
            List <DictInfo> dicts = null;

            //绑定货品类别
            dicts = new MatTypeBLL().GetList().Select(p => new DictInfo {
                ID = p.ID, Des = p.Description
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.ProductType, dicts, "");

            //绑定计量单位
            dicts = new MatUnitBLL().GetList().Select(p => new DictInfo {
                ID = p.ID, Des = p.Description
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.UnitCode, dicts, "");

            //绑定规格
            dicts = new WHSpecBLL().GetList().Select(p => new DictInfo {
                ID = p.ID, Des = p.Description
            }).ToList <DictInfo>();
            Tools.BindDataToDDL(this.SpecCode, dicts, "");
        }