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