/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { SOperatDiaryBB operatDiaryBB = new SOperatDiaryBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (this.operateStartDt.Text != "") { strWhere += " and operateDt>='" + this.operateStartDt.Text + "'"; } if (this.operateEndDt.Text != "") { strWhere += " and operateDt<'" + Convert.ToDateTime(this.operateEndDt.Text).AddDays(1).ToString() + "'"; } if (this.ddlFunctionId.SelectedValue != "") { strWhere += " and functionId='" + this.ddlFunctionId.SelectedValue + "'"; } if (this.operateContent.Text != "") { strWhere += " and operateContent like '%" + this.operateContent.Text + "%'"; } ds = operatDiaryBB.GetVList(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 { operatDiaryBB.Dispose(); } }
/// <summary> /// 记录操作日志 /// </summary> /// <param name="recordId">记录Id</param> /// <param name="logContent">操作内容</param> public void MakeOperatDiarylog(string recordId, string logContent) { SOperatDiaryData operatDiaryData = new SOperatDiaryData(); SOperatDiaryBB operatDiaryBB = new SOperatDiaryBB(); try { operatDiaryData.empId = this.currentUser.empId; operatDiaryData.functionId = this.itemNo; operatDiaryData.recordId = recordId; operatDiaryData.operateContent = logContent; operatDiaryData.operateDt = DateTime.Now.ToString(); operatDiaryBB.AddRecord(operatDiaryData); } finally { operatDiaryBB.Dispose(); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; SOperatDiaryBB operatDiaryBB = new SOperatDiaryBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); operatDiaryBB.DeleteRecord(id); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { operatDiaryBB.Dispose(); } if (retChecked) { this.BindGrid(); } }