- cs代码如下:
- public partial class Gz_Sign : PageBase
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- this.BindSignGrid();
- this.BindNoSignGrid();
- }
- }
- #region 绑定事件
- protected void BindSignGrid()
- {
- ExtAspNet.GridColumn gc = gd_sign.FindColumn(gd_sign.SortColumn);
- this.BindGridwithSort(gc.SortField, gd_sign.SortDirection,gd_sign,"1");
- }
- protected void BindNoSignGrid()
- {
- ExtAspNet.GridColumn gc = gd_nosign.FindColumn(gd_nosign.SortColumn);
- this.BindGridwithSort(gc.SortField, gd_nosign.SortDirection, gd_nosign, "0");
- }
- protected void BindGridwithSort(string sortField, string sortDirection,ExtAspNet.Grid gd,string sign)
- {
- string _sql = "select * from m_gzml where bmid='2312100' and zt='发布' and sfbj='"+sign+"'";
- DataTable dtb = DbHelperOra.GetDataSet(_sql, CommandType.Text);
- DataView dv = dtb.DefaultView;
- dv.Sort = String.Format("{0} {1}", sortField, sortDirection);
- gd.DataSource = dv;
- gd.DataBind();
- }
- #endregion
- #region 页面函数
- protected void Sign_gz(string gzid)
- {
- Business.OracleField[] arrList = new Business.OracleField[1];
- Business.OracleField field = new Business.OracleField();
- field.p_datatype = "string";
- field.p_fieldname = "sfbj";
- field.p_fieldvalue = "1";
- arrList[0] = field;
- string con = " where gzid = to_number('" + gzid + "')";
- string update_sql = Business.GetUpdateSql("m_gzml", arrList, con);
- DbHelperOra.ExecuteSql(update_sql);
- }
- protected void No_Sign_gz(string gzid)
- {
- Business.OracleField[] arrList = new Business.OracleField[1];
- Business.OracleField field = new Business.OracleField();
- field.p_datatype = "string";
- field.p_fieldname = "sfbj";
- field.p_fieldvalue = "0";
- arrList[0] = field;
- string con = " where gzid = to_number('" + gzid + "')";
- string update_sql = Business.GetUpdateSql("m_gzml", arrList, con);
- DbHelperOra.ExecuteSql(update_sql);
- }
- #endregion
- #region 事件
- protected void gd_nosign_Sort(object sender, ExtAspNet.GridSortEventArgs e)
- {
- this.BindGridwithSort(e.SortField, e.SortDirection, gd_nosign, "0");
- }
- protected void gd_sign_Sort(object sender, ExtAspNet.GridSortEventArgs e)
- {
- this.BindGridwithSort(e.SortField, e.SortDirection, gd_sign, "1");
- }
- protected void gd_nosign_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
- {
- gd_nosign.PageIndex = e.NewPageIndex;
- }
- protected void gd_sign_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
- {
- gd_sign.PageIndex = e.NewPageIndex;
- }
- protected void gd_nosign_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
- {
- if (e.CommandName == "Sign")
- {
- string gzid = gd_nosign.Rows[e.RowIndex].DataKeys[0].ToString();
- this.Sign_gz(gzid);
- Alert.ShowInTop("规章标记成功!");
- this.BindSignGrid();
- this.BindNoSignGrid();
- }
- }
- protected void gd_sign_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
- {
- if (e.CommandName == "NoSign")
- {
- string gzid = gd_sign.Rows[e.RowIndex].DataKeys[0].ToString();
- this.No_Sign_gz(gzid);
- Alert.ShowInTop("取消标记规章成功!");
- this.BindSignGrid();
- this.BindNoSignGrid();
- }
- }
- protected void btn_sign_Click(object sender, EventArgs e)
- {
- if (gd_nosign.SelectedRowIndexArray.Length > 0)
- {
- foreach (int row in gd_nosign.SelectedRowIndexArray)
- {
- string gzid = gd_nosign.DataKeys[row][0].ToString();
- this.Sign_gz(gzid);
- }
- this.BindNoSignGrid();
- this.BindSignGrid();
- Alert.ShowInTop("已将已选规章进行标记!");
- }
- else { Alert.Show("没有需要标记的规章!"); }
- }
- protected void btn_sign_all_Click(object sender, EventArgs e)
- {
- if (gd_nosign.Rows.Count > 0)
- {
- foreach (ExtAspNet.GridRow row in gd_nosign.Rows)
- {
- string gzid = row.DataKeys[0].ToString();
- this.Sign_gz(gzid);
- }
- this.BindNoSignGrid();
- this.BindSignGrid();
- Alert.ShowInTop("已将全部规章进行标记!");
- }
- else
- {
- Alert.Show("没有规章需要标记!");
- }
- }
- protected void btn_nosign_Click(object sender, EventArgs e)
- {
- if (gd_sign.SelectedRowIndexArray.Length > 0)
- {
- foreach (int row in gd_sign.SelectedRowIndexArray)
- {
- string gzid = gd_sign.DataKeys[row][0].ToString();
- this.No_Sign_gz(gzid);
- }
- this.BindNoSignGrid();
- this.BindSignGrid();
- Alert.ShowInTop("已取消所选规章标记!");
- }
- else
- {
- Alert.Show("没有标记规章需取消!");
- }
- }
- protected void btn_nosign_all_Click(object sender, EventArgs e)
- {
- if (gd_sign.Rows.Count > 0)
- {
- foreach (ExtAspNet.GridRow row in gd_sign.Rows)
- {
- string gzid = row.DataKeys[0].ToString();
- this.No_Sign_gz(gzid);
- }
- this.BindNoSignGrid();
- this.BindSignGrid();
- Alert.ShowInTop("已取消全部规章标记!");
- }
- else
- Alert.Show("没有标记规章需取消!");
- }
- protected void gd_nosign_RowDoubleClick(object sender, ExtAspNet.GridRowClickEventArgs e)
- {
- string url = "Gz_View.aspx?gzid=" + gd_nosign.Rows[e.RowIndex].DataKeys[0].ToString();
-
- PageContext.RegisterStartupScript(Window1.GetShowReference(url, "查看规章"));
- }
- protected void gd_sign_RowDoubleClick(object sender, ExtAspNet.GridRowClickEventArgs e)
- {
- string url = "Gz_View.aspx?gzid=" + gd_sign.Rows[e.RowIndex].DataKeys[0].ToString();
-
- PageContext.RegisterStartupScript(Window1.GetShowReference(url, "查看规章"));
- }
- protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
- {
- if (TabStrip1.ActiveTabIndex == 0)
- {
- this.BindSignGrid();
- }
- else
- {
- this.BindNoSignGrid();
- }
- }
- #endregion
- }
复制代码 |