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