protected void Page_Load(object sender, EventArgs e) { Security s = Session["sec"] as Security; if (s == null) { Response.Redirect("error.aspx"); } string sxtj = Session["sxtj"] as string; dbModule dm = new dbModule(); if ( sxtj == "" || sxtj == null ) { SqlDataSource1.SelectCommand = "SELECT [ID], [SYBH], [SYMC], [KCMC], [JSXM], [SYSMC], [SYRS], [SYXN], [SYXINGQ], [SYXQ], [SYSDD], [XINGQMC], [ZMC], [MC], [sqrs], [sprs] FROM [V_YWCXSRSB] where sqzt=1 and syid in (select syid from t_syxxb where kcid in (select id from v_kcxxb where id in( select kcbh from t_kcxxb where id in (select kcid from t_xsxkb where xsxh='" + s.getUserCode() + "')) and (xslb='不限' or xslb='" + dm.getXslbByXh(s.getUserCode()) + "'))) order by sybh"; } else { SqlDataSource1.SelectCommand = "SELECT [ID], [SYBH], [SYMC], [KCMC], [JSXM], [SYSMC], [SYRS], [SYXN], [SYXINGQ], [SYXQ], [SYSDD], [XINGQMC], [ZMC], [MC], [sqrs], [sprs] FROM [V_YWCXSRSB] where sqzt=1 and syid in (select syid from t_syxxb where kcid in (select id from v_kcxxb where id in( select kcbh from t_kcxxb where id in (select kcid from t_xsxkb where xsxh='" + s.getUserCode() + "')) and (xslb='不限' or xslb='" + dm.getXslbByXh(s.getUserCode()) + "')" + " and (sybh like '%" + sxtj + "%' or symc like '%" + sxtj + "%' or jsxm like '%" + sxtj + "%' or sysdd like '%" + sxtj + "%' or zmc like '%" + sxtj + "%' or mc like '%" + sxtj + "%' or syxn like '%" + sxtj + "%' or syxq like '%" + sxtj + "%'))) order by sybh"; } }
protected void Button1_Click(object sender, EventArgs e) { pbModule pm = new pbModule(); string xsxh = XSXHTextBox.Text.Trim(); if (!pm.isValidString(xsxh)) { messageLabel.Text = Resources.Resource.strNotValidString; return; } dbModule dm = new dbModule(); string xsxm = dm.getXsxmByXh(xsxh); if (xsxm.Equals("error!")) { messageLabel.Text = Resources.Resource.strNotFoundString; return; } string xslb = dm.getXslbByXh(xsxh); string yqlb = DetailsView1.Rows[5].Cells[1].Text; int syjhid = Convert.ToInt32(Request["ID"]); Security sec = Session["sec"] as Security; string shrid = sec.getUserCode(); if ( dm.cfxk( syjhid , xsxh ) != 0 )//重复选课 { messageLabel.Text = Resources.Resource.strDuplicateXKString; return; } if (xslb.Trim().Equals(yqlb) || yqlb.Equals("不限")) { dm.sqxk(syjhid ,xsxh ,shrid); messageLabel.Text = "学生:" + xsxm + "已经添加!"; } else { messageLabel.Text = "学生类别:" + xslb + "与实验要求类别:" + yqlb + "不一致,无法添加该学生:" + xsxm; return; } }