/// <summary> /// ��Grid /// </summary> protected void BindGrid() { WListBB listBB = new WListBB(); DataSet ds = new DataSet(); try { ds = listBB.GetList(this.StrWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //��ֵ��¼������ҳ������ this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { listBB.Dispose(); } }
private void ShowInfo(string id) { WListBB listBB = new WListBB(); WListData model = new WListData(); try { model = listBB.GetModel(id); this.workflowNo.Text = model.workflowNo; this.workflowNm.Text = model.workflowNm; this.workTableNm.Text = model.workTableNm; this.recordKeyField.Text = model.recordKeyField; this.keyIsInt.Text = model.keyIsInt.ToString(); this.titleField.Text = model.titleField; this.itemNo.Text = model.itemNo; this.remark.Text = model.remark; this.isRun.Text = model.isRun.ToString(); } finally { listBB.Dispose(); } }
protected void btnAdd_Click(object sender, EventArgs e) { WListData model = new WListData(); WListBB listBB = new WListBB(); try { if (this.State == "1") { this.SetModel(ref model); listBB.AddRecord(model); } else if (this.State == "2") { model = listBB.GetModel(this.IdValue); this.SetModel(ref model); listBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true); return; } finally { listBB.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { this.IdValue = Request.Params["id"]; } if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty) { this.State = Request.Params["state"].ToString(); switch (this.State) { case "1": //add break; case "2": //update //���ؿؼ� WListBB listBB = new WListBB(); WListData listData = new WListData(); try { listData = listBB.GetModel(this.IdValue); //����й��������˴�Ҫ��֤�Ƿ������� this.ShowInfo(this.IdValue); } finally { listBB.Dispose(); } break; default: break; } } } this.BindGrid(this.IdValue); }
/// <summary> /// ɾ�� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; WListBB listBB = new WListBB(); try { //��ȡѡ�е�����Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; string workflowNo = Convert.ToString(chkId.ValidationGroup); listBB.DeleteRecord(workflowNo); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { listBB.Dispose(); } if (retChecked) { this.BindGrid(); } }