protected void Button11_Click(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["conStr"].ToString(); SqlConnection con = new SqlConnection(connectionString); try { con.Open(); } catch (Exception) { con.Close(); return; throw; } DataSet ds = new DataSet(); string sqlstr = "select * From Medicine m"; SqlDataAdapter da = new SqlDataAdapter(sqlstr, con); da.Fill(ds); GridView11.DataSource = ds; GridView11.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (TextBox8.Text.Length == 0) { TextBox8.Text = DateTime.Today.ToString("dd/MM/yyyy"); TextBox124.Text = DateTime.Today.ToString("dd/MM/yyyy"); } TextBox126.Text = User.Identity.Name; TextBox8.Attributes.Add("readonly", "readonly"); TextBox128.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia().ToString(); txbRole.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Role(User.Identity.Name).ToString(); TextBox150.Text = (string)Session["Passport_Person_Kiosk_PTE"]; TextBox173.Text = (string)Session["Apoleies_ID_For_Update"]; calEx1.StartDate = FINANCIAL_MANAGEMENT.App_Code.xrisi.ABE_StartDate(); TextBox12.Text = DateTime.Parse(TextBox8.Text).Year.ToString(); xrisi(); if (TextBox13.Text.Length == 0) { Pass_kinisi_for_Grid.DataBind(); GridView11.DataBind(); } if (TextBox150.Text == "0" && TextBox13.Text.Length == 0) { New_Pers(); } if ((string)Session["Edit_YN_Pass_PTE"] == "0" || (string)Session["Edit_YN_Pass_PTE"] == "1" || (string)Session["Edit_YN_Pass_PTE"] == "2" || (string)Session["Edit_YN_Pass_PTE"] == "6") { Button11.Enabled = true; Button4.Enabled = true; } else { Button11.Enabled = false; Button4.Enabled = false; } if ((string)Session["Edit_YN_Pass_PTE"] == "0" || (string)Session["Edit_YN_Pass_PTE"] == "1" || (string)Session["Edit_YN_Pass_PTE"] == "2" || (string)Session["Edit_YN_Pass_PTE"] == "3") { Button1.Visible = true; Button13.Visible = false; Button14.Enabled = false; Panel1.Enabled = true; } else { Panel1.Enabled = false; Button1.Visible = false; Button13.Visible = true; Button14.Enabled = true; } TextBox167_CalendarExtender.StartDate = DateTime.Today; TextBox168_CalendarExtender.StartDate = DateTime.Today; ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1); ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button13); DropDownList4.SelectedValue = RoundUp(DateTime.Parse(DateTime.Now.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm"))), TimeSpan.FromMinutes(15)).ToString("HH:mm"); }
//根据设置自动生成试卷 protected void GVbind() { int course = int.Parse(ddlCourse.SelectedValue); DataBase db = new DataBase(); //创建DataBase类对象 string GridView1Str = "select * from SingleProblem where courseId=" + course + " "; //根据参数设置查询单选题Sql语句 DataSet ds1 = db.GetDataSetSql(GridView1Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView11.DataSource = ds1.Tables[0].DefaultView; //为单选题GridView控件指名数据源 GridView11.DataBind(); //绑定数据 string GridView2Str = "select * from MultiProblem where courseId=" + course + ""; //根据参数设置查询多选题Sql语句 DataSet ds2 = db.GetDataSetSql(GridView2Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView2.DataSource = ds2.Tables[0].DefaultView; //为多选题GridView控件指名数据源 GridView2.DataBind(); //绑定数据 string GridView3Str = "select * from JudgeProblem where courseId=" + course + ""; //根据参数设置查询判断题Sql语句 DataSet ds3 = db.GetDataSetSql(GridView3Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView3.DataSource = ds3.Tables[0].DefaultView; //为判断题GridView控件指名数据源 GridView3.DataBind(); //绑定数据 string GridView4Str = "select * from FillBlankProblem where courseId=" + course + ""; //根据参数设置查询填空题Sql语句 DataSet ds4 = db.GetDataSetSql(GridView4Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView4.DataSource = ds4.Tables[0].DefaultView; //为填空题GridView控件指名数据源 GridView4.DataBind(); //绑定数据 string GridView5Str = "select * from QuestionProblem where courseId=" + course + ""; //根据参数设置查询问答题Sql语句 DataSet ds5 = db.GetDataSetSql(GridView5Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView5.DataSource = ds5.Tables[0].DefaultView; //为问答题GridView控件指名数据源 GridView5.DataBind(); //绑定数据 }
private void ExportDataGrid(string FileType, string FileName) //从DataGrid导出 { Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); Response.ContentType = FileType; this.EnableViewState = false; StringWriter tw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); GridView11.RenderControl(hw); GridView2.RenderControl(hw); GridView3.RenderControl(hw); GridView4.RenderControl(hw); GridView5.RenderControl(hw); Response.Write(tw.ToString()); Response.End(); }
protected void DropDownList7_SelectedIndexChanged(object sender, EventArgs e) { Apporipsi.DataBind(); GridView11.DataBind(); TextBox13.Text = GridView11.Rows[0].Cells[12].Text.Replace(" ", ""); TextBox138.Text = GridView11.Rows[0].Cells[13].Text.Replace(" ", ""); TextBox139.Text = GridView11.Rows[0].Cells[23].Text.Replace(" ", ""); TextBox154.Text = GridView11.Rows[0].Cells[24].Text.Replace(" ", ""); TextBox155.Text = GridView11.Rows[0].Cells[25].Text.Replace(" ", ""); if (GridView11.Rows[0].Cells[18].Text == " " || GridView11.Rows[0].Cells[18].Text == "01/01/1900") { TextBox140.Text = ""; } else { TextBox140.Text = GridView11.Rows[0].Cells[18].Text; } TextBox141.Text = GridView11.Rows[0].Cells[17].Text.Replace(" ", ""); TextBox142.Text = GridView11.Rows[0].Cells[15].Text.Replace(" ", ""); TextBox143.Text = GridView11.Rows[0].Cells[16].Text.Replace(" ", ""); TextBox152.Text = GridView11.Rows[0].Cells[1].Text.Replace(" ", ""); TextBox156.Text = GridView11.Rows[0].Cells[26].Text.Replace(" ", ""); TextBox157.Text = GridView11.Rows[0].Cells[27].Text.Replace(" ", ""); TextBox9.Text = GridView11.Rows[0].Cells[12].Text.Replace(" ", "") + " " + GridView11.Rows[0].Cells[13].Text.Replace(" ", ""); TextBox144.Text = GridView11.Rows[0].Cells[28].Text.Replace(" ", ""); TextBox145.Text = GridView11.Rows[0].Cells[29].Text.Replace("01/01/1900", ""); TextBox147.Text = GridView11.Rows[0].Cells[30].Text.Replace(" ", ""); TextBox3.Text = GridView11.Rows[0].Cells[31].Text.Replace(" ", ""); }
private void BindGrid() { string constr = ConfigurationManager.ConnectionStrings["ChemAnalystContext"].ConnectionString; string query = "SELECT * FROM SalesPackageSubscriptions"; using (SqlConnection con = new SqlConnection(constr)) { using (SqlDataAdapter sda = new SqlDataAdapter(query, con)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); } } } string constr1 = ConfigurationManager.ConnectionStrings["ChemAnalystContext"].ConnectionString; string query1 = "SELECT * FROM SA_User"; using (SqlConnection con = new SqlConnection(constr1)) { using (SqlDataAdapter sda = new SqlDataAdapter(query1, con)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); GridView11.DataSource = dt; GridView11.DataBind(); } } } }
//根据设置自动生成试卷 protected void imgBtnConfirm_Click(object sender, ImageClickEventArgs e) { int res = 0; if (txtSingleFen != null && txtSingleFen.Text != "" && txtSingleNum != null && txtSingleFen.Text != "") { res = res + int.Parse(txtSingleNum.Text) * int.Parse(txtSingleFen.Text); } if (txtMultiNum != null && txtMultiFen.Text != "" && txtMultiNum != null && txtMultiFen.Text != "") { res = res + int.Parse(txtMultiNum.Text) * int.Parse(txtMultiFen.Text); } if (txtJudgeFen != null && txtJudgeFen.Text != "" && txtJudgeNum != null && txtJudgeFen.Text != "") { res = res + int.Parse(txtJudgeNum.Text) * int.Parse(txtJudgeFen.Text); } if (txtFillFen != null && txtFillFen.Text != "" && txtFillNum != null && txtFillFen.Text != "") { res = res + int.Parse(txtFillNum.Text) * int.Parse(txtFillFen.Text); } if (txtQuestionFen != null && txtQuestionFen.Text != "" && txtSingleNum != null && txtQuestionFen.Text != "") { res = res + int.Parse(txtQuestionNum.Text) * int.Parse(txtQuestionFen.Text); } lblres.Text = "总分为:" + res.ToString() + "分"; Panel1.Visible = true; int course = int.Parse(ddlCourse.SelectedValue); //选择科目 int diff = int.Parse(ddlDiff.SelectedValue); //选择的难度 DataBase db = new DataBase(); //创建DataBase类对象 string GridView1Str = "select top " + int.Parse(txtSingleNum.Text.Trim()) + " * from SingleProblem where courseId=" + course + " and diffid >= " + (diff - 2) + " and diffid <= " + (diff + 2) + " order by newid()"; //根据参数设置查询单选题Sql语句 DataSet ds1 = db.GetDataSetSql(GridView1Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView11.DataSource = ds1.Tables[0].DefaultView; //为单选题GridView控件指名数据源 GridView11.DataBind(); //绑定数据 string GridView2Str = "select top " + int.Parse(txtMultiNum.Text.Trim()) + " * from MultiProblem where courseId=" + course + " and diffid >= " + (diff - 2) + " and diffid <= " + (diff + 2) + " order by newid()"; //根据参数设置查询多选题Sql语句 DataSet ds2 = db.GetDataSetSql(GridView2Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView2.DataSource = ds2.Tables[0].DefaultView; //为多选题GridView控件指名数据源 GridView2.DataBind(); //绑定数据 string GridView3Str = "select top " + int.Parse(txtJudgeNum.Text.Trim()) + " * from JudgeProblem where courseId=" + course + " and diffid >= " + (diff - 2) + " and diffid <= " + (diff + 2) + " order by newid()"; //根据参数设置查询判断题Sql语句 DataSet ds3 = db.GetDataSetSql(GridView3Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView3.DataSource = ds3.Tables[0].DefaultView; //为判断题GridView控件指名数据源 GridView3.DataBind(); //绑定数据 string GridView4Str = "select top " + int.Parse(txtFillNum.Text.Trim()) + " * from FillBlankProblem where courseId=" + course + " and diffid >= " + (diff - 2) + " and diffid <= " + (diff + 2) + " order by newid()"; //根据参数设置查询填空题Sql语句 DataSet ds4 = db.GetDataSetSql(GridView4Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView4.DataSource = ds4.Tables[0].DefaultView; //为填空题GridView控件指名数据源 GridView4.DataBind(); //绑定数据 string GridView5Str = "select top " + int.Parse(txtQuestionNum.Text.Trim()) + " * from QuestionProblem where courseId=" + course + " and diffid >= " + (diff - 2) + " and diffid <= " + (diff + 2) + " order by newid()"; //根据参数设置查询填空题Sql语句 DataSet ds5 = db.GetDataSetSql(GridView5Str); //调用DataBase类方法GetDataSetSql方法查询数据 GridView5.DataSource = ds5.Tables[0].DefaultView; //为填空题GridView控件指名数据源 GridView5.DataBind(); //绑定数据 }
protected void new_pers() { EuroVote.DataBind(); GridView11.DataBind(); if (GridView11.Rows.Count > 0) { TextBox1.Text = GridView11.Rows[0].Cells[4].Text.Replace(" ", ""); TextBox2.Text = GridView11.Rows[0].Cells[5].Text.Replace(" ", ""); TextBox3.Text = GridView11.Rows[0].Cells[6].Text.Replace(" ", ""); TextBox13.Text = GridView11.Rows[0].Cells[17].Text.Replace(" ", ""); TextBox4.Text = GridView11.Rows[0].Cells[7].Text.Replace(" ", ""); if (GridView11.Rows[0].Cells[13].Text == " " || GridView11.Rows[0].Cells[13].Text == "01/01/1900") { TextBox5.Text = ""; } else { TextBox5.Text = GridView11.Rows[0].Cells[13].Text; } TextBox6.Text = GridView11.Rows[0].Cells[8].Text.Replace(" ", ""); TextBox7.Text = GridView11.Rows[0].Cells[9].Text.Replace(" ", ""); TextBox8.Text = GridView11.Rows[0].Cells[10].Text.Replace(" ", ""); TextBox9.Text = GridView11.Rows[0].Cells[11].Text.Replace(" ", ""); TextBox10.Text = GridView11.Rows[0].Cells[12].Text.Replace(" ", ""); TextBox11.Text = GridView11.Rows[0].Cells[14].Text.Replace(" ", ""); TextBox12.Text = GridView11.Rows[0].Cells[15].Text.Replace(" ", ""); TextBox152.Text = GridView11.Rows[0].Cells[21].Text.Replace("01/01/1900", ""); } }
//Copy gridview panel to another gridview. protected void btnGenerate_Click(object sender, EventArgs e) { DataTable dt1 = new DataTable(); dt1.Columns.Add("Memory Block Size [kB]", typeof(string)); foreach (GridViewRow gvr in GridView6.Rows) { string var1 = gvr.Cells[0].Text; DataRow dr = dt1.NewRow(); dr["Memory Block Size [kB]"] = var1; dt1.Rows.Add(dr); } GridView3.DataSource = dt1; GridView3.DataBind(); GridView11.DataSource = null; GridView6.DataSource = null; GridView6.DataBind(); GridView11.DataBind(); DropDownList3.Items.Clear(); txtMemSize.Text = ""; TextBox3.Text = ""; }
protected void btnTariInsert_Click(object sender, EventArgs e) { if (txtTariTitle.Text != "") { Value.InsertValues(lblTariID.Text, lblTariValue.Text, txtTariTitle.Text); } txtTariTitle.Text = ""; GridView11.DataBind(); }
//Panel block Close button protected void LinkButton1_Click(object sender, EventArgs e) { GridView11.DataSource = null; GridView6.DataSource = null; GridView6.DataBind(); GridView11.DataBind(); DropDownList3.Items.Clear(); txtMemSize.Text = ""; TextBox3.Text = ""; }
protected void Button11_Click(object sender, EventArgs e) { String query = "SELECT a.Product_name , b.Product_cost , b.Product_item_no , a.Product_id from Product a , Size_cost b WHERE (a.Product_id = b.Product_id AND Product_size='S' AND b.Product_item_no IN(Select Product_item_no from Order_table GROUP BY Product_item_no HAVING COUNT(*)>0 ))"; SqlDataAdapter dataadapter = new SqlDataAdapter(query, conx); DataSet ds = new DataSet(); dataadapter.Fill(ds); GridView11.DataSource = ds; GridView11.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { GridView11.DataSource = BrowserDatabase.Browsers; GridView11.DataBind(); GridView22.DataSource = BrowserDatabase.Browsers; GridView22.DataBind(); GridView33.DataSource = BrowserDatabase.Browsers; GridView33.DataBind(); }
private void View7_DataBind() { GridView10.DataBind(); GridView11.DataBind(); Chart7.DataBind(); if (Chart7.Series[0].Points.Count > 0 || Chart7.Series[1].Points.Count > 0) { Chart7.Visible = true; } else { Chart7.Visible = false; } }
public void showList() { string query = @"SELECT [donorId] ,[name] ,[age] ,[bloodGroup] ,[lastBloodDate] ,[phone] ,[email] ,[city] ,[address] FROM [dbo].[Donor]"; GridView11.DataSource = database.showData(query); GridView11.DataBind(); }
protected void DropDownList7_SelectedIndexChanged(object sender, EventArgs e) { Apporipsi.DataBind(); GridView11.DataBind(); if (DropDownList7.SelectedValue != "0") { GridView11.DataSourceID = "Apporipsi"; GridView11.DataBind(); CheckBox1.Checked = true; } else { GridView11.DataSourceID = "Pass_kinisi_for_Grid"; GridView11.DataBind(); CheckBox1.Checked = false; } }
protected void cmdDelete2_Click(object sender, EventArgs e) { clsManufacturer DB = new clsManufacturer(); try { if (txtManufacturerId1 == null) //cboitem, lblUnitcost,txtquantity,txtregno,dtdate,txtAmount { lblResults1.Text = "Enter the manufacturer"; } if (txtManufacturerId1.GetType() != typeof(String)) { lblResults1.Text = "Enter the manufacturer"; } if (txtManufacturerName0 == null) { lblResults1.Text = "The Manufacturer cannot be empty"; } if (txtManufacturerName0.GetType() != typeof(string)) { lblResults1.Text = "Enter the Manufacturer"; } string varResponse = DB.Delete_rec(txtManufacturerId1.Text, txtManufacturerName0.Text); // Fill the DataSet. DataSet ds = new DataSet(); ds = DB.FindTable(); //adapter.Fill(ds, "tb_Customer"); // Perform the binding. GridView11.DataSource = ds; GridView11.DataBind(); lblResults1.Text = "Operation successful"; return; } catch (FormatException err) { EventLog log = new EventLog(); log.Source = "Milorry Frontend"; log.WriteEntry(err.Message, EventLogEntryType.Error); } }
protected void btn10_Click(object sender, EventArgs e) { // Clear all content output from the buffer stream Response.ClearContent(); // Specify the default file name using "content-disposition" RESPONSE header Response.AppendHeader("content-disposition", "attachment; filename=school-info.xls"); // Set excel as the HTTP MIME type Response.ContentType = "application/excel"; // Create an instance of stringWriter for writing information to a string System.IO.StringWriter stringWriter10 = new System.IO.StringWriter(); // Create an instance of HtmlTextWriter class for writing markup // characters and text to an ASP.NET server control output stream HtmlTextWriter htw10 = new HtmlTextWriter(stringWriter10); GridView11.RenderControl(htw10); Response.Write(stringWriter10.ToString()); Response.End(); }
protected void AddTicket(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('NewTicket')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.Tickets t1 = new Entities.Tickets() { generatedBy = Session["School"].ToString(), generatedFor = IcreatedFor.Text, issueDate = DateTime.Now.ToShortDateString(), issue = TextBox1.Text, }; db.AddTicket(t1); GridView11.DataBind(); UpdatePanel1.Update(); Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('NewTicket')", true); Label6.Text = "Issue Added Successfully"; TextBox1.Text = " "; } }
protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { if (CheckBox1.Checked) { TextBox162.Text = "2"; GridView11.DataSourceID = "Apporipsi"; GridView11.DataBind(); } else { TextBox162.Text = "0"; GridView11.DataSourceID = "Pass_kinisi_for_Grid"; GridView11.DataBind(); } Pass_Update_M_Back.DataBind(); DropDownList7.Items.Clear(); DropDownList7.Items.Add(new ListItem("Αίτηση", "0")); DropDownList7.DataBind(); }
protected void Bind(string keyWord) { DataBase DB = new DataBase(); Hashtable ht1 = new Hashtable(); ht1.Add("Title", keyWord); ht1.Add("AnswerA", keyWord); ht1.Add("AnswerB", keyWord); ht1.Add("AnswerC", keyWord); ht1.Add("AnswerD", keyWord); DataSet ds1 = DB.AdvancedSearch("SingleProblem", ht1); if (ds1.Tables[0].Rows.Count > 0)//判断下是否有单选题 { GridView11.DataSource = ds1; GridView11.DataBind(); } DataSet ds2 = DB.AdvancedSearch("MultiProblem", ht1); if (ds2.Tables[0].Rows.Count > 0) { GridView2.DataSource = ds2; GridView2.DataBind(); } Hashtable ht2 = new Hashtable(); ht2.Add("Title", keyWord); DataSet ds3 = DB.AdvancedSearch("JudgeProblem", ht2); if (ds3.Tables[0].Rows.Count > 0) { GridView3.DataSource = ds3; GridView3.DataBind(); } }
protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { Session["Pass_Persone_Data"] = "7"; Pass_Update_M_Back.DataBind(); DropDownList7.Items.Clear(); DropDownList7.Items.Add(new ListItem("Αίτηση", "0")); DropDownList7.DataBind(); if (CheckBox1.Checked) { DropDownList7.Enabled = true; TextBox158.Text = "2"; GridView11.DataSourceID = "Apporipsi"; GridView11.DataBind(); } else { DropDownList7.Enabled = false; TextBox158.Text = "0"; GridView11.DataSourceID = "Reservations"; GridView11.DataBind(); } }
//Memory Block Creation protected void BtnAdd0_Click1(object sender, EventArgs e) { int i = 0; DropDownList3.Items.Clear(); DataTable dt = new DataTable(); dt.Columns.Add("Memory Block Size [kB]"); for (i = 0; i < Convert.ToInt32(TextBox3.Text); i++) { dt.Rows.Add(0); DropDownList3.Items.Add(new ListItem("Block " + Convert.ToString(i + 1), Convert.ToString(i + 1))); } numberOfBlocks = Convert.ToInt32(TextBox3.Text); GridView6.DataSource = dt; GridView6.DataBind(); GridView11.DataSource = dt; GridView11.DataBind(); }
//初始化试卷,从数据库中将试题取出 protected void PaperData() { string userid = Request.QueryString["UserID"].ToString(); paperid = int.Parse(Request.QueryString["PaperID"].ToString()); DataBase DB = new DataBase(); DataSet ds = DB.GetDataSetSql("select PaperName,ExamTime from [UserAnswertb],[Paper] where[UserAnswertb].PaperID=[Paper].PaperID and UserID='" + userid + "' and [UserAnswertb].PaperID='" + paperid + "'"); DataRow[] row = ds.Tables[0].Select(); //获取试卷基本信息 lblExamtime.Text = row[0]["ExamTime"].ToString(); lblExamname.Text = row[0]["PaperName"].ToString(); //获取总分 ds = DB.GetDataSetSql("select Score from Scoretb where UserID='" + userid + "' and PaperID='" + paperid + "'"); DataRow[] rowSum = ds.Tables[0].Select(); sumScore.Text = rowSum[0]["Score"].ToString(); SqlParameter[] Params1 = new SqlParameter[3]; Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题"); Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds1 = DB.GetDataSet("Proc_UserAnswertb", Params1); if (ds1.Tables[0].Rows.Count > 0) { GridView11.DataSource = ds1; GridView11.DataBind(); ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text; } SqlParameter[] Params2 = new SqlParameter[3]; Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题"); Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds2 = DB.GetDataSet("Proc_UserAnswertb", Params2); if (ds2.Tables[0].Rows.Count > 0) { GridView2.DataSource = ds2; GridView2.DataBind(); ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text; } SqlParameter[] Params3 = new SqlParameter[3]; Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题"); Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds3 = DB.GetDataSet("Proc_UserAnswertb", Params3); if (ds3.Tables[0].Rows.Count > 0) { GridView3.DataSource = ds3; GridView3.DataBind(); ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text; } SqlParameter[] Params4 = new SqlParameter[3]; Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题"); Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds4 = DB.GetDataSet("Proc_UserAnswertb", Params4); if (ds4.Tables[0].Rows.Count > 0) { GridView4.DataSource = ds4; GridView4.DataBind(); ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text; } SqlParameter[] Params5 = new SqlParameter[3]; Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题"); Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds5 = DB.GetDataSet("Proc_UserAnswertb", Params5); if (ds5.Tables[0].Rows.Count > 0) { GridView5.DataSource = ds5; GridView5.DataBind(); ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text; } if (GridView11.Rows.Count > 0) { int score1 = 0; int singlemark = int.Parse(((Label)GridView11.Rows[0].FindControl("Label4")).Text);//取出单选题的每题分值 foreach (GridViewRow dr in GridView11.Rows) { if (((Label)dr.FindControl("Label3")).Text.Trim() == "A") { ((RadioButton)dr.FindControl("RadioButton1")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B") { ((RadioButton)dr.FindControl("RadioButton2")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C") { ((RadioButton)dr.FindControl("RadioButton3")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D") { ((RadioButton)dr.FindControl("RadioButton4")).Checked = true; } if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("Label23")).Text.Trim()) { score1 = score1 + singlemark; sinScore.Text = Convert.ToString(score1); //dr.Visible = false;//单选题 } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } if (GridView2.Rows.Count > 0) { int score2 = 0; int multimark = int.Parse(((Label)GridView2.Rows[0].FindControl("Label8")).Text);//取出多选题每题分值 foreach (GridViewRow dr in GridView2.Rows) { if (((Label)dr.FindControl("Label7")).Text.Trim() == "A") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "B") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "C") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "D") { ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AB") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BC") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BD") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "CD") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ACD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABCD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == ((Label)dr.FindControl("Label27")).Text.Trim()) { score2 = score2 + multimark; mulScore.Text = Convert.ToString(score2); } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } if (GridView3.Rows.Count > 0) { int score3 = 0; int judgemark = int.Parse(((Label)GridView3.Rows[0].FindControl("Label12")).Text); //取出判断题每题分值 foreach (GridViewRow dr in GridView3.Rows) //对判断题每题进行判断用户选择答案 { try { if (bool.Parse(((Label)dr.FindControl("Label11")).Text.Trim())) { ((CheckBox)dr.FindControl("CheckBox5")).Checked = true; } else { ((CheckBox)dr.FindControl("CheckBox6")).Checked = true; } } catch { ((CheckBox)dr.FindControl("CheckBox5")).Checked = false; ((CheckBox)dr.FindControl("CheckBox6")).Checked = false; } if (((Label)dr.FindControl("Label11")).Text.Trim() == ((Label)dr.FindControl("Label41")).Text.Trim()) { score3 = score3 + judgemark; judScore.Text = Convert.ToString(score3); } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } //计算总分 }
//初始化试卷,从数据库中将试题取出 protected void InitData() { DataBase DB = new DataBase(); int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString()); SqlParameter[] Params1 = new SqlParameter[2]; Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题"); //题目类型 DataSet ds1 = DB.GetDataSet("Proc_PaperDetail", Params1); GridView11.DataSource = ds1; GridView11.DataBind(); if (ds1.Tables[0].Rows.Count > 0) { ((Label)GridView11.HeaderRow.FindControl("Labelt2")).Text = ((Label)GridView11.Rows[0].FindControl("Labelm1")).Text; } SqlParameter[] Params2 = new SqlParameter[2]; Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题"); //题目类型 DataSet ds2 = DB.GetDataSet("Proc_PaperDetail", Params2); GridView2.DataSource = ds2; GridView2.DataBind(); if (ds2.Tables[0].Rows.Count > 0) { ((Label)GridView2.HeaderRow.FindControl("Labelt5")).Text = ((Label)GridView2.Rows[0].FindControl("Labelm2")).Text; } SqlParameter[] Params3 = new SqlParameter[2]; Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题"); //题目类型 DataSet ds3 = DB.GetDataSet("Proc_PaperDetail", Params3); GridView3.DataSource = ds3; GridView3.DataBind(); if (ds3.Tables[0].Rows.Count > 0) { ((Label)GridView3.HeaderRow.FindControl("Labelt8")).Text = ((Label)GridView3.Rows[0].FindControl("Labelm3")).Text; } SqlParameter[] Params4 = new SqlParameter[2]; Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题"); //题目类型 DataSet ds4 = DB.GetDataSet("Proc_PaperDetail", Params4); GridView4.DataSource = ds4; GridView4.DataBind(); if (ds4.Tables[0].Rows.Count > 0) { ((Label)GridView4.HeaderRow.FindControl("Labelt11")).Text = ((Label)GridView4.Rows[0].FindControl("Labelm4")).Text; } SqlParameter[] Params5 = new SqlParameter[2]; Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题"); //题目类型 DataSet ds5 = DB.GetDataSet("Proc_PaperDetail", Params5); GridView5.DataSource = ds5; GridView5.DataBind(); if (ds5.Tables[0].Rows.Count > 0) { ((Label)GridView5.HeaderRow.FindControl("Labelt14")).Text = ((Label)GridView5.Rows[0].FindControl("Labelm5")).Text; } }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(CS); con.Open(); Label1.Text = "All info about the employee with ID 8"; SqlCommand cmd1 = new SqlCommand("select * from employees where EmployeeID=8", con); GridView1.DataSource = cmd1.ExecuteReader(); GridView1.DataBind(); con.Close(); con.Open(); Label2.Text = "The list of first and last names of the employees from London"; SqlCommand cmd2 = new SqlCommand("select FirstName,LastName from employees where City='London'", con); GridView2.DataSource = cmd2.ExecuteReader(); GridView2.DataBind(); con.Close(); con.Open(); Label3.Text = "The list of first and last names of the employees whose first name begins with letter A"; SqlCommand cmd3 = new SqlCommand("select FirstName,LastName from employees where FirstName like 'A%' ", con); GridView3.DataSource = cmd3.ExecuteReader(); GridView3.DataBind(); con.Close(); con.Open(); Label4.Text = "The list of first, last names and ages of the employees whose age is greater than 55. The result should be sorted by last name"; SqlCommand cmd4 = new SqlCommand("select FirstName,LastName ,(CURRENT_TIMESTAMP-BirthDate)as ages from employees where (CURRENT_TIMESTAMP-BirthDate) > 55 order by LastName", con); GridView4.DataSource = cmd4.ExecuteReader(); GridView4.DataBind(); con.Close(); con.Open(); Label5.Text = "The count of employees from London"; SqlCommand cmd5 = new SqlCommand("select count(*) from employees where city='London'", con); GridView5.DataSource = cmd5.ExecuteReader(); GridView5.DataBind(); con.Close(); con.Open(); Label6.Text = "The greatest, the smallest and the average age among the employees from London"; SqlCommand cmd6 = new SqlCommand(" SELECT city,CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees where city='London' group by city", con); GridView6.DataSource = cmd6.ExecuteReader(); GridView6.DataBind(); con.Close(); con.Open(); Label7.Text = "The greatest, the smallest and the average age of the employees for each city"; SqlCommand cmd7 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con); GridView7.DataSource = cmd7.ExecuteReader(); GridView7.DataBind(); con.Close(); con.Open(); Label8.Text = "The greatest, the smallest and the average age of the employees for each city"; SqlCommand cmd8 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con); GridView8.DataSource = cmd8.ExecuteReader(); GridView8.DataBind(); con.Close(); con.Open(); Label9.Text = "First, last names and dates of birth of the employees who celebrate their birthdays this month"; SqlCommand cmd9 = new SqlCommand("select FirstName,LastName,BirthDate from employees where MONTH(BirthDate)=MONTH(GETDATE())", con); GridView9.DataSource = cmd9.ExecuteReader(); GridView9.DataBind(); con.Close(); con.Open(); Label10.Text = "First and last names of the employees who used to serve orders shipped to Madrid"; SqlCommand cmd10 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con); GridView10.DataSource = cmd10.ExecuteReader(); GridView10.DataBind(); con.Close(); con.Open(); Label11.Text = "First and last names of the employees who used to serve orders shipped to Madrid"; SqlCommand cmd11 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con); GridView11.DataSource = cmd11.ExecuteReader(); GridView11.DataBind(); con.Close(); con.Open(); Label12.Text = "The count of orders made by each customer from France"; SqlCommand cmd12 = new SqlCommand("select count(*) from orders inner join customers on orders.shipcountry = customers.country where customers.country='France'", con); GridView12.DataSource = cmd12.ExecuteReader(); GridView12.DataBind(); con.Close(); con.Open(); Label13.Text = "The list of french customers’ names who used to order non-french products"; SqlCommand cmd13 = new SqlCommand("select distinct ContactName from Customers left join Orders on Customers.country <> Orders.ShipCountry where country='France'", con); GridView13.DataSource = cmd13.ExecuteReader(); GridView13.DataBind(); con.Close(); con.Open(); Label14.Text = "The total ordering sum calculated for each country of customer"; SqlCommand cmd14 = new SqlCommand("select count(orders.shipcountry),customers.country from orders inner join customers on orders.shipcountry=customers.country group by customers.country", con); GridView14.DataSource = cmd14.ExecuteReader(); GridView14.DataBind(); con.Close(); con.Open(); Label15.Text = "The list of cities where employees and customers are from and where orders have been made to. Duplicates should be eliminated."; SqlCommand cmd15 = new SqlCommand("SELECT distinct Orders.shipcity FROM((Orders INNER JOIN Customers ON Orders.shipcity = Customers.city) INNER JOIN employees ON Orders.shipcity = employees.city)", con); GridView15.DataSource = cmd15.ExecuteReader(); GridView15.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { GridView11.DataSource = dal.getData(); GridView11.DataBind(); }
protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e) { strSelectedId = grdvw_List.Rows[e.NewEditIndex].Cells[1].Text; txt_ItemName.Text = grdvw_List.Rows[e.NewEditIndex].Cells[2].Text; if (grdvw_List.Rows[e.NewEditIndex].Cells[2].Text.Trim() != " ") { txt_AccessTime.Text = grdvw_List.Rows[e.NewEditIndex].Cells[4].Text; } else { txt_AccessTime.Text = ""; } txt_person0.Text = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text; txt_ItemName.ReadOnly = true; txt_person0.ReadOnly = true; //备注绑定 //项目接收备注显示 string remarkstr = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='1' order by t_Y_Detail.id"; DataSet ds_Remark1 = new MyDataOp(remarkstr).CreateDataSet(); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds_Remark1.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView1.DataSource = ds_Remark1; GridView1.DataBind(); string remarkstr2 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='2' order by t_Y_Detail.id"; DataSet ds_Remark2 = new MyDataOp(remarkstr2).CreateDataSet(); foreach (DataRow dr in ds_Remark2.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView2.DataSource = ds_Remark2; GridView2.DataBind(); string remarkstr3 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='3' order by t_Y_Detail.id"; DataSet ds_Remark3 = new MyDataOp(remarkstr3).CreateDataSet(); foreach (DataRow dr in ds_Remark3.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView3.DataSource = ds_Remark3; GridView3.DataBind(); string remarkstr4 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='4' order by t_Y_Detail.id"; DataSet ds_Remark4 = new MyDataOp(remarkstr4).CreateDataSet(); foreach (DataRow dr in ds_Remark4.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView4.DataSource = ds_Remark4; GridView4.DataBind(); string remarkstr5 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='5' order by t_Y_Detail.id"; DataSet ds_Remark5 = new MyDataOp(remarkstr5).CreateDataSet(); foreach (DataRow dr in ds_Remark5.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView5.DataSource = ds_Remark5; GridView5.DataBind(); string remarkstr6 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='6' order by t_Y_Detail.id"; DataSet ds_Remark6 = new MyDataOp(remarkstr6).CreateDataSet(); foreach (DataRow dr in ds_Remark6.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView6.DataSource = ds_Remark6; GridView6.DataBind(); string remarkstr7 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='7' order by t_Y_Detail.id"; DataSet ds_Remark7 = new MyDataOp(remarkstr7).CreateDataSet(); foreach (DataRow dr in ds_Remark7.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView7.DataSource = ds_Remark7; GridView7.DataBind(); string remarkstr8 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='8' order by t_Y_Detail.id"; DataSet ds_Remark8 = new MyDataOp(remarkstr8).CreateDataSet(); foreach (DataRow dr in ds_Remark8.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView8.DataSource = ds_Remark8; GridView8.DataBind(); string remarkstr9 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='9' order by t_Y_Detail.id"; DataSet ds_Remark9 = new MyDataOp(remarkstr9).CreateDataSet(); foreach (DataRow dr in ds_Remark9.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView9.DataSource = ds_Remark9; GridView9.DataBind(); string remarkstr10 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='10' order by t_Y_Detail.id"; DataSet ds_Remark10 = new MyDataOp(remarkstr10).CreateDataSet(); foreach (DataRow dr in ds_Remark10.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView10.DataSource = ds_Remark10; GridView10.DataBind(); string remarkstr11 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='11' order by t_Y_Detail.id"; DataSet ds_Remark11 = new MyDataOp(remarkstr11).CreateDataSet(); foreach (DataRow dr in ds_Remark11.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView11.DataSource = ds_Remark11; GridView11.DataBind(); string remarkstr12 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='12' order by t_Y_Detail.id"; DataSet ds_Remark12 = new MyDataOp(remarkstr12).CreateDataSet(); foreach (DataRow dr in ds_Remark12.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView12.DataSource = ds_Remark12; GridView12.DataBind(); //备注绑定 //有回退的,则显示回退备注,非回退,不显示 string backremarkstr = "select createdate 备注时间,t_Y_BackInfo.remark 备注及意见,userid 用户名 from t_Y_BackInfo inner join t_Y_FlowInfo on t_Y_BackInfo.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_BackInfo.functionid where t_Y_BackInfo.itemid='" + strSelectedId + "' and t_Y_BackInfo.functionid='14' order by t_Y_BackInfo.id"; // string backremarkstr = "select * from t_Y_BackInfo where itemid='" + strSelectedId + "' and functionid='2'"; DataSet ds_Remark_back = new MyDataOp(backremarkstr).CreateDataSet(); foreach (DataRow dr in ds_Remark_back.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_back.DataSource = ds_Remark_back; GridView_back.DataBind(); //回退的数据编辑,显示前面的备注信息,只读 string remarkstr_now = "select ItemName 项目类型, name 阶段,CreateDate 备注时间,bz 备注及意见,userid 用户名,flag,t_Y_Detail.id from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='13' order by t_Y_Detail.id"; DataSet ds_Remark_now = new MyDataOp(remarkstr_now).CreateDataSet(); foreach (DataRow dr in ds_Remark_now.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_now.DataSource = ds_Remark_now; GridView_now.DataBind(); DataRow[] dr_remark = ds_Remark_now.Tables[0].Select("flag=0"); if (dr_remark.Length > 0) { txt_Remark_now.Text = dr_remark[0][3].ToString(); SelectedId = dr_remark[0][6].ToString(); } if (ds_Remark_back.Tables[0].Rows.Count > 0) { Panel_back.Visible = true; } else { Panel_back.Visible = false; } ds_Remark1.Dispose(); ds_Remark2.Dispose(); ds_Remark3.Dispose(); ds_Remark4.Dispose(); ds_Remark5.Dispose(); ds_Remark6.Dispose(); ds_Remark7.Dispose(); ds_Remark8.Dispose(); ds_Remark9.Dispose(); ds_Remark10.Dispose(); ds_Remark11.Dispose(); ds_Remark12.Dispose(); //ds_Remark13.Dispose(); ds_Remark_back.Dispose(); ds_Remark_now.Dispose(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true); }
//初始化试卷,从数据库中将试题取出 protected void PaperData() { string userid = Request.QueryString["UserID"].ToString(); paperid = int.Parse(Request.QueryString["PaperID"].ToString()); DataBase DB = new DataBase(); DataSet ds = DB.GetDataSetSql("select * from [UserAnswertb] where UserID='" + userid + "'"); DataRow[] row = ds.Tables[0].Select(); foreach (DataRow rs in row) { lblExamtime.Text = rs["ExamTime"].ToString(); } SqlParameter[] Params1 = new SqlParameter[3]; Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题"); Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds1 = DB.GetDataSet("Proc_UserAnswertb", Params1); if (ds1.Tables[0].Rows.Count > 0) { GridView11.DataSource = ds1; GridView11.DataBind(); ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text; } SqlParameter[] Params2 = new SqlParameter[3]; Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题"); Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds2 = DB.GetDataSet("Proc_UserAnswertb", Params2); if (ds2.Tables[0].Rows.Count > 0) { GridView2.DataSource = ds2; GridView2.DataBind(); ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text; } SqlParameter[] Params3 = new SqlParameter[3]; Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题"); Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds3 = DB.GetDataSet("Proc_UserAnswertb", Params3); if (ds3.Tables[0].Rows.Count > 0) { GridView3.DataSource = ds3; GridView3.DataBind(); ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text; } SqlParameter[] Params4 = new SqlParameter[3]; Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题"); Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds4 = DB.GetDataSet("Proc_UserAnswertb", Params4); if (ds4.Tables[0].Rows.Count > 0) { GridView4.DataSource = ds4; GridView4.DataBind(); ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text; } SqlParameter[] Params5 = new SqlParameter[3]; Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题"); Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds5 = DB.GetDataSet("Proc_UserAnswertb", Params5); if (ds5.Tables[0].Rows.Count > 0) { GridView5.DataSource = ds5; GridView5.DataBind(); ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text; } if (GridView11.Rows.Count > 0) { int score1 = 0; int singlemark = int.Parse(((Label)GridView11.Rows[0].FindControl("Label4")).Text);//取出单选题的每题分值 foreach (GridViewRow dr in GridView11.Rows) { if (((Label)dr.FindControl("Label3")).Text.Trim() == "A") { ((RadioButton)dr.FindControl("RadioButton1")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B") { ((RadioButton)dr.FindControl("RadioButton2")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C") { ((RadioButton)dr.FindControl("RadioButton3")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D") { ((RadioButton)dr.FindControl("RadioButton4")).Checked = true; } if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("Label23")).Text.Trim()) { score1 = score1 + singlemark; sinScore.Text = Convert.ToString(score1); } } } if (GridView2.Rows.Count > 0) { int score2 = 0; int multimark = int.Parse(((Label)GridView2.Rows[0].FindControl("Label8")).Text);//取出多选题每题分值 foreach (GridViewRow dr in GridView2.Rows) { if (((Label)dr.FindControl("Label7")).Text.Trim() == "A") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "B") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "C") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "D") { ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AB") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BC") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BD") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "CD") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ACD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABCD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == ((Label)dr.FindControl("Label27")).Text.Trim()) { score2 = score2 + multimark; mulScore.Text = Convert.ToString(score2); } } } if (GridView3.Rows.Count > 0) { int score3 = 0; int judgemark = int.Parse(((Label)GridView3.Rows[0].FindControl("Label12")).Text); //取出判断题每题分值 foreach (GridViewRow dr in GridView3.Rows) //对判断题每题进行判断用户选择答案 { try { if (bool.Parse(((Label)dr.FindControl("Label11")).Text.Trim())) { ((CheckBox)dr.FindControl("CheckBox5")).Checked = true; } else { ((CheckBox)dr.FindControl("CheckBox6")).Checked = true; } } catch { ((CheckBox)dr.FindControl("CheckBox5")).Checked = false; ((CheckBox)dr.FindControl("CheckBox6")).Checked = false; } if (((Label)dr.FindControl("Label11")).Text.Trim() == ((Label)dr.FindControl("Label41")).Text.Trim()) { score3 = score3 + judgemark; judScore.Text = Convert.ToString(score3); } } } //取出填空题每题分值 if (GridView4.Rows.Count > 0) { int score4 = 0; int fillmark = int.Parse(((Label)GridView4.Rows[0].FindControl("Label17")).Text); foreach (GridViewRow dr in GridView4.Rows)//对填空题每题进行判断用户选择答案 { string str = ""; str = ((TextBox)dr.FindControl("TextBox1")).Text.Trim(); if (str == ((Label)dr.FindControl("Label26")).Text.Trim()) { score4 = score4 + fillmark; filScore.Text = Convert.ToString(score4); } } } }
protected void btnEmail_Click(object sender, EventArgs e) { strEmail = txtEmail.Text; DataSourceSelectArguments srUserID_IDStr = new DataSourceSelectArguments(); DataView dvUserID_IDStr = (DataView)SqlDataSource5.Select(srUserID_IDStr); if (dvUserID_IDStr.Count != 0) { strUserID_ID = dvUserID_IDStr[0][0].ToString(); } DataSourceSelectArguments srUserID_SSOStr = new DataSourceSelectArguments(); DataView dvUserID_SSOStr = (DataView)SqlDataSource14.Select(srUserID_SSOStr); if (dvUserID_SSOStr.Count != 0) { strUserID_SSO = dvUserID_SSOStr[0][0].ToString(); } DataSourceSelectArguments srTokenUser = new DataSourceSelectArguments(); DataView dvTokenUser = (DataView)SqlDataSource4.Select(srTokenUser); if (dvTokenUser.Count != 0) { strTokenUser = dvTokenUser[0][0].ToString(); } DataSourceSelectArguments srTokenPassStr = new DataSourceSelectArguments(); DataView dvTokenPassStr = (DataView)SqlDataSource12.Select(srTokenPassStr); if (dvTokenPassStr.Count != 0) { strTokenPass = dvTokenPassStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempStr = new DataSourceSelectArguments(); DataView dvOrgTempStr = (DataView)SqlDataSource110.Select(srOrgTempStr); if (dvOrgTempStr.Count != 0) { strOrgTemp = dvOrgTempStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempIDStr = new DataSourceSelectArguments(); DataView dvOrgTempIDStr = (DataView)SqlDataSource118.Select(srOrgTempIDStr); if (dvOrgTempIDStr.Count != 0) { strOrgTempID = dvOrgTempIDStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempNameStr = new DataSourceSelectArguments(); DataView dvOrgTempNameStr = (DataView)SqlDataSource124.Select(srOrgTempNameStr); if (dvOrgTempNameStr.Count != 0) { strOrgTempName = dvOrgTempNameStr[0][0].ToString(); } DataSourceSelectArguments srOrgIDStr = new DataSourceSelectArguments(); DataView dvOrgIDStr = (DataView)SqlDataSource111.Select(srOrgIDStr); if (dvOrgIDStr.Count != 0) { strOrgID = dvOrgIDStr[0][0].ToString(); } DataSourceSelectArguments srOrgAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgAccessRequestedStr = (DataView)SqlDataSource112.Select(srOrgAccessRequestedStr); if (dvOrgAccessRequestedStr.Count != 0) { strOrgAccessRequested = dvOrgAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgModAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgModAccessRequestedStr = (DataView)SqlDataSource113.Select(srOrgModAccessRequestedStr); if (dvOrgModAccessRequestedStr.Count != 0) { strOrgModAccessRequested = dvOrgModAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgLicAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgLicAccessRequestedStr = (DataView)SqlDataSource114.Select(srOrgLicAccessRequestedStr); if (dvOrgLicAccessRequestedStr.Count != 0) { strOrgLicAccessRequested = dvOrgLicAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgMembershipUserIDStr = new DataSourceSelectArguments(); DataView dvOrgMembershipUserIDStr = (DataView)SqlDataSource115.Select(srOrgMembershipUserIDStr); if (dvOrgMembershipUserIDStr.Count != 0) { strOrgMembershipUserID = dvOrgMembershipUserIDStr[0][0].ToString(); } DataSourceSelectArguments srUserPasswordExpiryDt = new DataSourceSelectArguments(); DataView dvUserPasswordExpiryDt = (DataView)SqlDataSource116.Select(srUserPasswordExpiryDt); if (dvUserPasswordExpiryDt.Count != 0) { strDateUserPasswordExpiry = dvUserPasswordExpiryDt[0][0].ToString(); } DataSourceSelectArguments srUserPasswordChangedDt = new DataSourceSelectArguments(); DataView dvUserPasswordChangedDt = (DataView)SqlDataSource126.Select(srUserPasswordChangedDt); if (dvUserPasswordChangedDt.Count != 0) { strDateUserPasswordChanged = dvUserPasswordChangedDt[0][0].ToString(); } DataSourceSelectArguments srUserPasswordResetTokenDt = new DataSourceSelectArguments(); DataView dvUserPasswordResetTokenDt = (DataView)SqlDataSource122.Select(srUserPasswordResetTokenDt); if (dvUserPasswordResetTokenDt.Count != 0) { strDatePasswordResetToken = dvUserPasswordResetTokenDt[0][0].ToString(); } DataSourceSelectArguments srDateRegisteredDt = new DataSourceSelectArguments(); DataView dvDateRegisteredDt = (DataView)SqlDataSource121.Select(srDateRegisteredDt); if (dvDateRegisteredDt.Count != 0) { strDateRegistered = dvDateRegisteredDt[0][0].ToString(); } DataSourceSelectArguments srUserTempDetailsStr = new DataSourceSelectArguments(); DataView dvUserTempDetailsStr = (DataView)SqlDataSource117.Select(srUserTempDetailsStr); if (dvUserTempDetailsStr.Count != 0) { strUserID_TempID = dvUserTempDetailsStr[0][0].ToString(); } DataSourceSelectArguments srOrganisationRequestStr = new DataSourceSelectArguments(); DataView dvOrganisationRequestStr = (DataView)SqlDataSource119.Select(srOrganisationRequestStr); if (dvOrganisationRequestStr.Count != 0) { strOrganisationRequest = dvOrganisationRequestStr[0][0].ToString(); } DataSourceSelectArguments srUserID_UPMStr = new DataSourceSelectArguments(); DataView dvUserID_UPMStr = (DataView)SqlDataSource120.Select(srUserID_UPMStr); if (dvUserID_UPMStr.Count != 0) { strUserID_UPM = dvUserID_UPMStr[0][0].ToString(); } DataSourceSelectArguments srEventTypeRejectedStr = new DataSourceSelectArguments(); DataView dvEventTypeRejectedStr = (DataView)SqlDataSource123.Select(srEventTypeRejectedStr); if (dvEventTypeRejectedStr.Count != 0) { strEventTypeRejected = dvEventTypeRejectedStr[0][0].ToString(); } dtDateToday = DateTime.Now; /* * Password expiry notification and countdown * */ dtDateUserPasswordExpiry = null; if (!string.IsNullOrEmpty(strDateUserPasswordExpiry)) { dtDateUserPasswordExpiry = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); dtDateUserPasswordExpiryForSubtraction = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } if (dtDateUserPasswordExpiry != null && dtDateToday > dtDateUserPasswordExpiry && strOrgID != "7c310be0-c20f-de11-b526-0022642a33b2") { divPasswordExpiry.Visible = true; lblPasswordExpiry.Text = "EDEN password has expired"; lblPasswordExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divPasswordExpiry.Visible = false; } /* * Registration expiry * */ if (!string.IsNullOrEmpty(strDateRegistered)) { dtDateRegistered = DateTime.ParseExact(strDateRegistered, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); tsDateRegistrationValidTimeRemaining = dtDateRegistered.AddHours(+24).Subtract(DateTime.Now); } if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered < DateTime.Now.AddHours(-24)) { divRegistrationExpiry.Visible = true; lblRegistrationExpiry.Text = "<i>Registration token has expired.</i> <br />- User's registration must be deleted to allow re-registration"; lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divRegistrationExpiry.Visible = false; } if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered > DateTime.Now.AddHours(-24)) { divRegistrationExpiry.Visible = true; lblRegistrationExpiry.Text = "Registration token is valid.<br />- The account verification link can be copied and emailed to the user if the notification has been blocked or re-routed. <br/>- This link is valid until " + dtDateRegistered.AddHours(+24) + ". Remaining time: <b>" + tsDateRegistrationValidTimeRemaining.ToString(@"hh\:mm") + "</b> hours"; lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divRegistrationExpiry.Visible = false; } if (dtDateRegistered == null) { divRegistrationExpiry.Visible = false; } if (strUserID_SSO != null) { divRegistrationExpiry.Visible = false; } /* * Password reset token expiry * */ //dtDatePasswordResetToken=''; if (!string.IsNullOrEmpty(strDatePasswordResetToken)) { dtDatePasswordResetToken = DateTime.ParseExact(strDatePasswordResetToken, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); tsDatePasswordResetTokenTimeRemaining = dtDatePasswordResetToken.AddHours(+24).Subtract(DateTime.Now); } if (strUserID_SSO != null && dtDatePasswordResetToken != null && strDatePasswordResetToken != null && dtDatePasswordResetToken < DateTime.Now.AddHours(-24)) { divPasswordResetTokenExpiry.Visible = true; lblPasswordResetTokenExpiry.Text = "<br /><i>Password reset token has expired.</i> <br />- The user will need to be begin the password reset process again and generate a new token."; lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divPasswordResetTokenExpiry.Visible = false; } if (strUserID_SSO != null && dtDatePasswordResetToken != null && dtDatePasswordResetToken > DateTime.Now.AddHours(-24)) { divPasswordResetTokenExpiry.Visible = true; lblPasswordResetTokenExpiry.Text = "<br />Password reset token is valid.<br />- The password reset token can be copied and emailed to the user.<br/>- This token is valid until " + dtDatePasswordResetToken.AddHours(+24) + ". Remaining time: <b>" + tsDatePasswordResetTokenTimeRemaining.ToString(@"hh\:mm") + "</b> hours (after which the user will need to be begin the password reset process again and generate a new token)."; lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } if (dtDatePasswordResetToken == null) { divPasswordResetTokenExpiry.Visible = false; } if (strUserID_ID == null && strUserID_SSO == null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divEmailNotFound.Visible = true; lblEmailNotFound.Text = "Email address not found"; lblEmailNotFound.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divEmailNotFound.Visible = false; } if (strUserID_ID != null && strUserID_SSO == null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserNoConfirmationClicked.Visible = true; lblUserNoConfirmationClicked.Text = "Status: User has not clicked confirmation email and signed in"; lblUserNoConfirmationClicked.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserNoConfirmationClicked.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserConfirmSignedNoStep1.Visible = true; lblUserConfirmSignedNoStep1.Text = "Status: EDEN Portal Access Request - Step 1: User has clicked confirmation email, but has not selected an organisation"; lblUserConfirmSignedNoStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedNoStep1.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserConfirmSignedStep2.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedStep2.Text = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details"; lblUserConfirmSignedStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedStep2.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp != null && strTokenUser != null ) { divUserConfirmSignedLAStep2.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedLAStep2.Text = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details"; lblUserConfirmSignedLAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedLAStep2.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strEventTypeRejected != "Organisation Membership Request Rejected" ) { divUserConfirmSignedStep3.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedStep3.Text = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request"; lblUserConfirmSignedStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedStep3.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested == null) if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == null ) { divUserConfirmSignedLAStep3.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedLAStep3.Text = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request"; lblUserConfirmSignedLAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedLAStep3.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strOrganisationRequest != null ) { divUserNewOrgCreate.Visible = true; lblUserNewOrgCreate.Text = "Status: User has selected a module and requested to register a <i>new</i> organisation on EDEN. The request is now with the EPA for approval"; lblUserNewOrgCreate.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserNewOrgCreate.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strOrgAccessRequested != null && strTokenUser != null && strOrgMembershipUserID == null ) { divUserRegCompleteNoApproval.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserRegCompleteNoApproval.Text = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request"; lblUserRegCompleteNoApproval.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApproval.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested != null) if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested != null && strTokenUser != null && strOrgMembershipUserID == null ) { divUserRegCompleteNoApprovalLA.Visible = true; lblUserRegCompleteNoApprovalLA.Text = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request"; lblUserRegCompleteNoApprovalLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApprovalLA.Visible = false; } if (strOrgModAccessRequested != null && strOrgID != null) { divModuleAccessPending.Visible = true; lblModuleAccessPending.Text = "Status: One or more module access requests by this user currently Pending Approval"; lblModuleAccessPending.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divModuleAccessPending.Visible = false; } if (strOrgID != null) { divUserConfirmSignedNoStep1.Visible = false; } if (strUserID_TempID != null) { divPasswordExpiry.Visible = false; } if (strOrgModAccessRequested != null && strOrgLicAccessRequested != null) { GridView16.Visible = true; GridView17.Visible = false; } if (strOrgModAccessRequested == strOrgLicAccessRequested) { GridView16.Visible = true; GridView17.Visible = true; } if (strOrgMembershipUserID == null) { GridView23.Visible = true; } else { GridView23.Visible = false; } if (strOrgMembershipUserID == null) { GridView22.Visible = true; } else { GridView22.Visible = false; } if (strUserID_SSO == null & strTokenUser != null) { divVerificationLink.Visible = true; } else { divVerificationLink.Visible = false; } if (strUserID_SSO != null) { divVerificationLink.Visible = false; } if (strUserID_SSO != null) { divUserExternalLinks.Visible = true; } else { divUserExternalLinks.Visible = false; } if (strTokenPass == null) { divPasswordReset.Visible = false; } else { divPasswordReset.Visible = true; } /* * EPA Users */ if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strTokenPass == null && strOrgAccessRequested == null && strOrgModAccessRequested == null && strOrgLicAccessRequested == null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == null ) { divUserEPAStep1.Visible = true; lblUserEPAStep1.Text = "Status: EDEN Portal Access Request - Step 1: EPA user has signed up, but has not selected an organisation"; lblUserEPAStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep1.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserEPAStep2.Visible = true; lblUserEPAStep2.Text = "Status: EDEN Portal Access Request - Step 2: EPA user has selected organisation, but has not yet added their personal and contact details"; lblUserEPAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep2.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID != null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserEPAStep3.Visible = true; lblUserEPAStep3.Text = "Status: EDEN Portal Access Request - Step 3: EPA user has added their personal and contact details, but has not yet selected a module"; lblUserEPAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep3.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID != null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested != null ) { divUserRegCompleteNoApprovalEPA.Visible = true; lblUserRegCompleteNoApprovalEPA.Text = "EPA user has selected an organisation, selected a module and submitted the access request. The EPA org admin(s) can now process this request"; lblUserRegCompleteNoApprovalEPA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApprovalEPA.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strTokenPass == null && strOrgAccessRequested == null && strOrgModAccessRequested == null && strOrgLicAccessRequested == null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == "Organisation Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User has signed up, but the organisation has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strEventTypeRejected == "Organisation Rejected" ) { divOrgRejected.Visible = true; lblOrgRejected.Text = "Status: User has signed up, but the <b>organisation creation request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblOrgRejected.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divOrgRejected.Visible = false; } if ( strEventTypeRejected == "Organisation Membership Request Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User has signed up, but the <b>organisation membership request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } if ( strEventTypeRejected == "Module Authorisation Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User's organisation access has been approved, but a module authorisation request has been rejected. (This may have been rectified - please check the notifications below).<br />"; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } tsDatePasswordExpiryLessDatePasswordReset = dtDateUserPasswordExpiryForSubtraction - dtDatePasswordResetToken; int passwordReset_Expiry_DifferenceInDays = tsDatePasswordExpiryLessDatePasswordReset.Days; if (tsDatePasswordExpiryLessDatePasswordReset.Days == 90) { divPasswordResetTokenExpiry.Visible = false; } divTokens.Visible = true; divSeperatorCurrent.Visible = true; divSeperatorPending.Visible = true; divSeperatorLicences.Visible = true; divSeperatorTokens.Visible = true; txtCopyVerificationLink.Text = "https://account.edenireland.ie/signup/confirmemail?userId=" + strUserID_ID + "&token=" + strTokenUser; txtCopyPasswordResetLink.Text = "https://account.edenireland.ie/passwordreset/resetpassword?userId=" + strUserID_SSO + "&token=" + strTokenPass; GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); GridView4.DataBind(); GridView5.DataBind(); GridView6.DataBind(); GridView7.DataBind(); GridView8.DataBind(); GridView9.DataBind(); GridView10.DataBind(); GridView11.DataBind(); GridView12.DataBind(); GridView13.DataBind(); GridView14.DataBind(); GridView15.DataBind(); GridView16.DataBind(); GridView17.DataBind(); GridView18.DataBind(); GridView19.DataBind(); GridView20.DataBind(); GridView21.DataBind(); GridView22.DataBind(); GridView23.DataBind(); GridView24.DataBind(); }