protected void BindBanji() { int kechengid = int.Parse(Session["kechengid"].ToString()); string tu = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; DropDownListbj.DataSource = BanjiInfo.GetTeacherRenkeBanji(tu, kechengid); DropDownListbj.DataBind(); }
protected void BindBanji() { string kechengid = Session["kechengid"].ToString(); string username = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; DataSet ds = BanjiInfo.GetTeacherRenkeBanji(username, int.Parse(kechengid)); DropDownList_banji.DataSource = ds; DropDownList_banji.DataBind(); }
protected void BindBanji() { string tun = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; string kechengid = Session["kechengid"].ToString(); DataSet banjidt = BanjiInfo.GetTeacherRenkeBanji(tun, int.Parse(kechengid)); ListBoxbanji.DataSource = banjidt; ListBoxbanji.DataBind(); }
protected void BindBanji()//绑定任课班级 { int kechengid; string zuoyeid = Request.QueryString["zuoyeid"]; SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); comm.CommandText = "select kechengid from teacherzuoye where zuoyeid=" + zuoyeid; conn.Open(); kechengid = (int)(comm.ExecuteScalar()); conn.Close(); DataSet ds = BanjiInfo.GetTeacherRenkeBanji(((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name, kechengid); DropDownList1.DataSource = ds; DropDownList1.DataTextField = "banjiname"; DropDownList1.DataValueField = "banjiid"; DropDownList1.DataBind(); }
protected void StartNextButton_Click(object sender, EventArgs e)//验证是否有班级、题目,如果有,则跳转到下一步 { //查询相关知识点、课程有无任课班级、题目 bool banjicunzai = false; bool timucunzai = false; string kechengid = Session["kechengid"].ToString(); string username = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; string kechengname = KechengInfo.getKechengname(kechengid); //查询是否有班级 DataSet ds = BanjiInfo.GetTeacherRenkeBanji(username, int.Parse(kechengid)); if (ds.Tables[0].Rows.Count > 0) { banjicunzai = true; } if (!banjicunzai) { ScriptManager.RegisterClientScriptBlock(this, typeof(String), "", "<script language='javascript'>alert('没有找到您任教课程" + kechengname + "的班级,请选择其他班级!');</script>", false); return; } //查询是否有题目 //显示每种题型的数量,选择数量,分值 //获取选择的知识点及其下位知识点 List <string> nodeandchilren = TreeView1.CheckedNodesAndChildrenIds;// 选择的知识点及其子孙知识点id StringBuilder nodeandchildrenSB = new StringBuilder(); //从题库中查询符合条件的题目 SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); //建立临时表,记录选择的知识点id号 string temptablename = "#temptable" + username + DateTime.Now.Ticks.ToString(); comm.CommandText = "create table " + temptablename + "(id int)"; conn.Open(); comm.ExecuteNonQuery(); foreach (string nodeid in nodeandchilren) { nodeandchildrenSB.Append(nodeid + ","); comm.CommandText = "insert into " + temptablename + "(id) values(" + int.Parse(nodeid) + ")"; comm.ExecuteNonQuery(); } //查询符合条件的第一题 comm.CommandText = "select top 1 questionid from tb_tiku where questionid in( select questionid from tb_timuzhishidian where questionid not in ( select questionid from tb_timuzhishidian where kechengjiegouid not in (select id from " + temptablename + ")))"; SqlDataReader sdr = comm.ExecuteReader(); if (sdr.HasRows) { timucunzai = true; } sdr.Close(); conn.Close(); HiddenFieldnodeandchildren.Value = nodeandchildrenSB.ToString();//把选择的知识点及其下位知识点保存在hiddenfield中,以便以后使用 if (!timucunzai) { ScriptManager.RegisterClientScriptBlock(this, typeof(String), "", "<script language='javascript'>alert('没有找到您选择的知识点的题目,请选择其他知识点!');</script>", false); } if (banjicunzai && timucunzai) { Wizard1.ActiveStepIndex = 1; } }