private void ShowPaperPolicy() { string strConn = ConfigurationSettings.AppSettings["strConn"]; SqlConnection SqlConn = new SqlConnection(strConn); SqlDataAdapter SqlCmd = new SqlDataAdapter("select a.PaperPolicyID,a.SubjectID,b.SubjectName,a.LoreID,c.LoreName,a.TestTypeID,d.TestTypeName,a.TestDiff1,a.TestDiff2,a.TestDiff3,a.TestDiff4,a.TestDiff5 from PaperPolicy a,SubjectInfo b,LoreInfo c,TestTypeInfo d where a.SubjectID=b.SubjectID and a.LoreID=c.LoreID and a.TestTypeID=d.TestTypeID and a.PaperID=" + intPaperID + " order by a.PaperPolicyID asc", SqlConn); DataSet SqlDS = new DataSet(); SqlCmd.Fill(SqlDS, "PaperPolicy"); DataGridPolicy.DataSource = SqlDS.Tables["PaperPolicy"].DefaultView; DataGridPolicy.DataBind(); for (int i = 0; i < DataGridPolicy.Items.Count; i++) { TextBox strTestDiff1 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff1"); strTestDiff1.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff1"].ToString(); TextBox strTestDiff2 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff2"); strTestDiff2.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff2"].ToString(); TextBox strTestDiff3 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff3"); strTestDiff3.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff3"].ToString(); TextBox strTestDiff4 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff4"); strTestDiff4.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff4"].ToString(); TextBox strTestDiff5 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff5"); strTestDiff5.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff5"].ToString(); LinkButton LBEdit = (LinkButton)DataGridPolicy.Items[i].FindControl("LinkButEdit"); LinkButton LBDel = (LinkButton)DataGridPolicy.Items[i].FindControl("LinkButDel"); LBEdit.Attributes.Add("onclick", "javascript:var str=window.showModalDialog('EditRandPolicy.aspx?PaperID=" + intPaperID + "&SubjectID=" + DataGridPolicy.Items[i].Cells[10].Text + "&LoreID=" + DataGridPolicy.Items[i].Cells[11].Text + "&TestTypeID=" + DataGridPolicy.Items[i].Cells[12].Text + "','','dialogHeight:190px;dialogWidth:500px;edge:Raised;center:Yes;help:Yes;resizable:No;scroll:No;status:No;');"); LBDel.Attributes.Add("onclick", "javascript:{if(confirm('确定要删除选择策略吗?')==false) return false;}"); } SqlConn.Dispose(); }
private void ShowData(string strSql) { string strConn = ConfigurationSettings.AppSettings["strConn"]; SqlConnection SqlConn = new SqlConnection(strConn); SqlDataAdapter SqlCmd = new SqlDataAdapter(strSql, SqlConn); DataSet SqlDS = new DataSet(); SqlCmd.Fill(SqlDS, "PaperPolicy"); DataGridPolicy.DataSource = SqlDS.Tables["PaperPolicy"].DefaultView; DataGridPolicy.DataBind(); SqlDataAdapter SqlCmdTmp = null; DataSet SqlDSTmp = null; for (int i = 0; i < DataGridPolicy.Items.Count; i++) { TextBox strTestDiff1 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff1"); strTestDiff1.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff1"].ToString(); SqlCmdTmp = new SqlDataAdapter("select * from RubricInfo where SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and TestDiff='易'", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "RubricInfo"); Label labTestDiff1 = (Label)DataGridPolicy.Items[i].FindControl("labTestDiff1"); labTestDiff1.Text = Convert.ToString(SqlDSTmp.Tables["RubricInfo"].Rows.Count); TextBox strTestDiff2 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff2"); strTestDiff2.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff2"].ToString(); SqlCmdTmp = new SqlDataAdapter("select * from RubricInfo where SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and TestDiff='较易'", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "RubricInfo"); Label labTestDiff2 = (Label)DataGridPolicy.Items[i].FindControl("labTestDiff2"); labTestDiff2.Text = Convert.ToString(SqlDSTmp.Tables["RubricInfo"].Rows.Count); TextBox strTestDiff3 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff3"); strTestDiff3.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff3"].ToString(); SqlCmdTmp = new SqlDataAdapter("select * from RubricInfo where SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and TestDiff='中等'", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "RubricInfo"); Label labTestDiff3 = (Label)DataGridPolicy.Items[i].FindControl("labTestDiff3"); labTestDiff3.Text = Convert.ToString(SqlDSTmp.Tables["RubricInfo"].Rows.Count); TextBox strTestDiff4 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff4"); strTestDiff4.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff4"].ToString(); SqlCmdTmp = new SqlDataAdapter("select * from RubricInfo where SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and TestDiff='较难'", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "RubricInfo"); Label labTestDiff4 = (Label)DataGridPolicy.Items[i].FindControl("labTestDiff4"); labTestDiff4.Text = Convert.ToString(SqlDSTmp.Tables["RubricInfo"].Rows.Count); TextBox strTestDiff5 = (TextBox)DataGridPolicy.Items[i].FindControl("txtTestDiff5"); strTestDiff5.Text = SqlDS.Tables["PaperPolicy"].Rows[i]["TestDiff5"].ToString(); SqlCmdTmp = new SqlDataAdapter("select * from RubricInfo where SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and TestDiff='难'", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "RubricInfo"); Label labTestDiff5 = (Label)DataGridPolicy.Items[i].FindControl("labTestDiff5"); labTestDiff5.Text = Convert.ToString(SqlDSTmp.Tables["RubricInfo"].Rows.Count); } SqlConn.Dispose(); }
private void ShowPaperPolicy() { string strConn = ConfigurationSettings.AppSettings["strConn"]; SqlConnection SqlConn = new SqlConnection(strConn); SqlDataAdapter SqlCmd = new SqlDataAdapter("select a.PaperPolicyID,a.SubjectID,b.SubjectName,a.LoreID,c.LoreName,a.TestTypeID,d.TestTypeName,a.TestDiff1,a.TestDiff2,a.TestDiff3,a.TestDiff4,a.TestDiff5 from PaperPolicy a,SubjectInfo b,LoreInfo c,TestTypeInfo d where a.SubjectID=b.SubjectID and a.LoreID=c.LoreID and a.TestTypeID=d.TestTypeID and a.PaperID=" + intPaperID + " order by a.PaperPolicyID asc", SqlConn); DataSet SqlDS = new DataSet(); SqlCmd.Fill(SqlDS, "PaperPolicy"); DataGridPolicy.DataSource = SqlDS.Tables["PaperPolicy"].DefaultView; DataGridPolicy.DataBind(); SqlDataAdapter SqlCmdTmp = null; DataSet SqlDSTmp = null; for (int i = 0; i < DataGridPolicy.Items.Count; i++) { SqlCmdTmp = new SqlDataAdapter("select a.PaperTestID,a.RubricID,b.SubjectID,b.LoreID,b.TestTypeID from PaperTest a,RubricInfo b where a.RubricID=b.RubricID and b.SubjectID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["SubjectID"] + "and b.LoreID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["LoreID"] + " and b.TestTypeID=" + SqlDS.Tables["PaperPolicy"].Rows[i]["TestTypeID"] + " and a.PaperID=" + intPaperID + " order by a.PaperTestID asc", SqlConn); SqlDSTmp = new DataSet(); SqlCmdTmp.Fill(SqlDSTmp, "PaperTest"); TextBox strSelectTest = (TextBox)DataGridPolicy.Items[i].FindControl("txtSelectTest"); strSelectTest.Text = ""; for (int j = 0; j < SqlDSTmp.Tables["PaperTest"].Rows.Count; j++) { if (strSelectTest.Text == "") { strSelectTest.Text = strSelectTest.Text + SqlDSTmp.Tables["PaperTest"].Rows[j]["RubricID"].ToString(); } else { strSelectTest.Text = strSelectTest.Text + ";" + SqlDSTmp.Tables["PaperTest"].Rows[j]["RubricID"].ToString(); } } LinkButton LBEdit = (LinkButton)DataGridPolicy.Items[i].FindControl("LinkButEdit"); LinkButton LBDel = (LinkButton)DataGridPolicy.Items[i].FindControl("LinkButDel"); LBEdit.Attributes.Add("onclick", "javascript:var str=window.showModalDialog('EditCustomPolicy.aspx?PaperID=" + intPaperID + "&SubjectID=" + DataGridPolicy.Items[i].Cells[6].Text + "&LoreID=" + DataGridPolicy.Items[i].Cells[7].Text + "&TestTypeID=" + DataGridPolicy.Items[i].Cells[8].Text + "','','dialogHeight:550px;dialogWidth:788px;edge:Raised;center:Yes;help:Yes;resizable:No;scroll:No;status:No;');"); LBDel.Attributes.Add("onclick", "javascript:{if(confirm('确定要删除选择策略吗?')==false) return false;}"); } SqlConn.Dispose(); }