protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; InspectItemBLL bll = null; try { bll = BLLFactory.CreateBLL <InspectItemBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { bll.Delete(new InspectItemEntity { Id = key.ToString() }); } this.BindData(); } catch (Exception ex) { throw ex; } }
private void BindData() { InspectItemBLL bll = null; DataPage dp = new DataPage(); InspectItemEntity condition = new InspectItemEntity(); try { bll = BLLFactory.CreateBLL <InspectItemBLL>(); condition.ItemCode = this.ItemCode.Text; condition.ItemName = this.ItemName.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <InspectItemEntity> list = dp.Result as List <InspectItemEntity>; 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; } }
private void BindData() { string Id = Request.QueryString["Id"]; InspectItemBLL bll = null; InspectItemEntity info = new InspectItemEntity(); try { bll = BLLFactory.CreateBLL <InspectItemBLL>(); if (string.IsNullOrEmpty(Id) == false) { info.Id = Id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.hiID.Value = info.Id; this.ItemCode.Text = info.ItemCode; this.ItemName.Text = info.ItemName; this.Unit.Text = info.Unit; this.PointCount.Text = info.PointCount + ""; this.Remark.Text = info.Remark; this.HiCREATEUSER.Value = info.CreateUser; this.HiCREATETIME.Value = info.CreateTime.ToString(); } else { info = new InspectItemEntity(); } } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { InspectItemEntity info = new InspectItemEntity(); InspectItemBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <InspectItemBLL>(); 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; } }
private void InitForm() { //绑定仓设备类型 CommonDropdown commonDropdown = new CommonDropdown(); Tools.BindDataToDDL(this.DeviceType, commonDropdown.getInspectDeviceType(), ""); //绑定监测项目 List <InspectItemEntity> itemList = new InspectItemBLL().GetAllItemInfo(new InspectItemEntity()); List <DictInfo> dictsItem = itemList.Select(p => new DictInfo { ID = p.ItemCode, Des = p.ItemName }).ToList <DictInfo>(); Tools.BindDataToDDL(this.ItemCode, dictsItem, ""); this.StartDate.Value = DateTime.Now.ToString("yyyy-MM-01"); this.EndDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); this.StartDateShow.Value = DateTime.Now.ToString("yyyy年MM月01日"); this.EndDateShow.Value = DateTime.Now.ToString("yyyy年MM月dd日"); }