protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx';</script>"); return; } if (!IsPostBack) { //本科录取省份 string str_sql = "select 地区,录取完毕 from lqsf where 本专科='本科'"; OleDbDataReader reader = DBFun.dataReader(str_sql); int i = 0; while (reader.Read()) { cbxlist_bk.Items.Add(reader["地区"].ToString()); cbxlist_bk.Items[i].Selected = (reader["录取完毕"].ToString() == "是"); i++; } reader.Close(); reader.Dispose(); //专科录取省份 str_sql = "select 地区,录取完毕 from lqsf where 本专科='专科'"; OleDbDataReader reader1 = DBFun.dataReader(str_sql); i = 0; while (reader1.Read()) { cbxlist_zk.Items.Add(reader1["地区"].ToString()); cbxlist_zk.Items[i].Selected = (reader1["录取完毕"].ToString() == "是"); i++; } reader1.Close(); reader1.Dispose(); } }
private void bindData() { string strqry = "SELECT ID, " + " sfzh, " + " yourname, " + " xingbie, " + " iif( DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth)) ), Format(Now(),'yyyy-mm-dd') " + " ) = 0,'', DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth))),Format(Now(),'yyyy-mm-dd') " + " ) ) AS nianling, " + " xrzw, " + " sbzw, " + " iif (isnull(tj_flag),'未审核',tj_flag) as tuijian, " + " iif(edit_flag,'已提交','未提交') as tijiao, " + " fenlei " + " FROM cpry " + " where gzdw = '" + Session["admin_id"].ToString() + "'"; if (RadioButtonList1.SelectedValue != "all") { strqry = strqry + " and iif (isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'"; } strqry = strqry + " ORDER BY ID asc;"; Session["dv_detail"] = DBFun.GetDataView(strqry); DataView dv = (DataView)Session["dv_detail"]; GridView1.DataSource = dv; GridView1.DataBind(); string str_sfzh; RadioButtonList rbtnList_1; for (int i = 0; i < this.GridView1.Rows.Count; i++) { str_sfzh = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); rbtnList_1 = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbtnList_tjjg"); rbtnList_1.SelectedValue = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["tuijian"].ToString(); } strqry = "select gz , count(gz) as num from " + "( SELECT iif(isnull(csgz),'未填写',csgz) as gz FROM cpry " + " WHERE gzdw = '" + Session["admin_id"].ToString() + "' and edit_flag = false "; if (RadioButtonList1.SelectedValue != "all") { strqry += " and iif(isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'"; } strqry += ") GROUP BY gz;"; OleDbDataReader reader = DBFun.dataReader(strqry); lbl_tongji.Text = ""; while (reader.Read()) { lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>"; } DBFun.closeDataReader(ref reader); }
private void bindData() { string strqry = "SELECT ID,sfzh, yourname,xingbie, DateDiff('YYYY', CDate(birth),Format(Now(),'yyyy-mm-dd')) AS nianling, xrzw, sbzw, tj_flag,edit_flag,fenlei FROM cpry where edit_flag = false and gzdw = '" + Session["admin_id"].ToString() + "' "; if (Session["admin_type"].ToString() == "zhuanjia") { strqry = "SELECT cpry.id,cpry.sfzh ,yourname,xingbie, DateDiff('YYYY', CDate(birth),Format(Now(),'yyyy-mm-dd')) AS nianling,xrzw,sbzw,tj_flag from cpry,zjry where edit_flag = false and zjid = " + Session["admin_id"].ToString() + " and cpry.sfzh=zjry.sfzh"; } if (RadioButtonList1.SelectedValue != "all") { strqry = strqry + " and tj_flag = '" + RadioButtonList1.SelectedValue + "'"; } strqry = strqry + " ORDER BY ID;"; DataView dv = DBFun.GetDataView(strqry);//dv null 为什么 Session["dv_detail"] = dv; GridView1.DataSource = dv; GridView1.DataBind(); //for (int i = 0; i < GridView1.Rows.Count; i++) //{ // CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("ckb_Sle"); // ckb.Checked = Convert.ToBoolean(dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["edit_flag"].ToString()); //} strqry = " SELECT csgz, count(csgz) AS num " + " FROM cpry " + " WHERE gzdw = '" + Session["admin_id"].ToString() + "' "; if (RadioButtonList1.SelectedValue != "all") { strqry += " and tj_flag = '" + RadioButtonList1.SelectedValue + "'"; } strqry += " GROUP BY csgz;"; OleDbDataReader reader = DBFun.dataReader(strqry); lbl_tongji.Text = ""; while (reader.Read()) { lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>"; } DBFun.closeDataReader(ref reader); }
protected void bindData_zj() { string str_sql = "select zjid,ryid from zjry where ryid = " + lbl_zjid.Text; OleDbDataReader reader = DBFun.dataReader(str_sql); string str_zjid = "0,"; while (reader.Read()) { str_zjid = str_zjid + reader["zjid"].ToString() + ","; } DBFun.closeDataReader(ref reader); str_sql = ""; str_sql = str_sql + " where id in (" + str_zjid + ") ORDER BY ID;"; Session["dv_zhuanjia"] = DBFun.GetDataView(str_sql); DataView dv = (DataView)Session["dv_zhuanjia"]; gv_zhuanjia.DataSource = dv; gv_zhuanjia.DataBind(); gv_zhuanjia.Visible = true; }
private void bindData() { string strqry = "SELECT ID, " + " sfzh, " + " yourname, " + " xingbie, " + " iif( DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth)) ), Format(Now(),'yyyy-mm-dd') " + " ) = 0,'', DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth))),Format(Now(),'yyyy-mm-dd') " + " ) ) AS nianling, " + " cplb, " + " dwtjyj, " + " iif (isnull(tj_flag),'未审核',tj_flag) as tuijian, " + " iif(edit_flag,'已提交','未提交') as tijiao " + " FROM yxxwlw_cpry " + " where tjdw = '" + Session["admin_id"].ToString() + "'"; if (RadioButtonList1.SelectedValue != "all") { strqry = strqry + " and iif (isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'"; } strqry = strqry + " ORDER BY ID asc;"; Session["dv_detail"] = DBFun.GetDataView(strqry); DataView dv = (DataView)Session["dv_detail"]; GridView1.DataSource = dv; GridView1.DataBind(); string str_sfzh; RadioButtonList rbtnList_1; for (int i = 0; i < this.GridView1.Rows.Count; i++) { str_sfzh = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); rbtnList_1 = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbtnList_tjjg"); rbtnList_1.SelectedValue = dv.Table.Rows[i + GridView1.PageIndex * GridView1.PageSize]["tuijian"].ToString(); } strqry = "select gz , count(gz) as num from " + "( SELECT iif(isnull(csgz),'未填写',csgz) as gz FROM cpry " + " WHERE gzdw = '" + Session["admin_id"].ToString() + "' and edit_flag = false "; if (RadioButtonList1.SelectedValue != "all") { strqry += " and iif(isnull(tj_flag),'未审核',tj_flag) = '" + RadioButtonList1.SelectedValue + "'"; } strqry += ") GROUP BY gz;"; OleDbDataReader reader = DBFun.dataReader(strqry); lbl_tongji.Text = ""; while (reader.Read()) { lbl_tongji.Text = lbl_tongji.Text + reader.GetString(0).ToString() + ":" + reader.GetInt32(1).ToString() + "<br/>"; } DBFun.closeDataReader(ref reader); //计算推荐人员人数 strqry = "SELECT count(*) FROM yxxwlw_cpry WHERE tjdw = '" + Session["admin_id"].ToString() + "' and edit_flag = false and iif(isnull(tj_flag),'未审核',tj_flag) = '推荐' "; string ls_count = DBFun.ExecuteScalar(strqry).ToString(); this.btn_commit.Attributes.Add("onclick", "return confirm (\"拟向中国地震局拟推荐参评人员 " + ls_count + " 位,一旦提交不可修改,确定提交?\");"); }