protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; WHInModeBLL bll = null; try { bll = BLLFactory.CreateBLL <WHInModeBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { bll.DeleteWHInMode(new WHInMode { ID = key.ToString() }); } this.BindData(); } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { WHInMode info = new WHInMode(); WHInModeBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <WHInModeBLL>(); 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; } }
private void BindData() { WHInModeBLL bll = null; DataPage dp = new DataPage(); WHInMode condition = new WHInMode(); try { bll = BLLFactory.CreateBLL <WHInModeBLL>(); condition.Description = this.Description.Text; PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <WHInMode> list = dp.Result as List <WHInMode>; 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; } }
private void BindData() { string id = Request.QueryString["id"]; WHInModeBLL bll = null; WHInMode info = new WHInMode(); try { bll = BLLFactory.CreateBLL <WHInModeBLL>(); 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 WHInMode(); } } catch (Exception ex) { throw ex; } }