public bool Insert_ClientInfo(Class_ClientInfo class_clientInfo) { if (class_clientInfo == null) return false; else { class_clientInfo.ClientInfo_Name = CommonFunction.FilterString(class_clientInfo.ClientInfo_Name); class_clientInfo.ClientInfo_Province = CommonFunction.FilterString(class_clientInfo.ClientInfo_Province); class_clientInfo.ClientInfo_City = CommonFunction.FilterString(class_clientInfo.ClientInfo_City); class_clientInfo.ClientInfo_Address = CommonFunction.FilterString(class_clientInfo.ClientInfo_Address); class_clientInfo.ClientInfo_Tel = CommonFunction.FilterString(class_clientInfo.ClientInfo_Tel); class_clientInfo.ClientInfo_Email = CommonFunction.FilterString(class_clientInfo.ClientInfo_Email); class_clientInfo.ClientInfo_Zip = CommonFunction.FilterString(class_clientInfo.ClientInfo_Zip); String Sql = ""; Sql += "Insert Into ClientInfo(ClientInfo_Name,ClientInfo_Age,ClientInfo_Sex,ClientInfo_Weight,ClientInfo_Height,ClientInfo_Province,ClientInfo_City,ClientInfo_Address,ClientInfo_Tel,ClientInfo_Email,ClientInfo_Zip,AddTime) "; Sql += "Values('" + class_clientInfo.ClientInfo_Name + "'," + class_clientInfo.ClientInfo_Age.ToString() + ",'" + class_clientInfo.ClientInfo_Sex + "'," + class_clientInfo.ClientInfo_Weight.ToString() + "," + class_clientInfo.ClientInfo_Height.ToString(); Sql += ",'" + class_clientInfo.ClientInfo_Province + "','" + class_clientInfo.ClientInfo_City + "','" + class_clientInfo.ClientInfo_Address + "','" + class_clientInfo.ClientInfo_Tel + "','" + class_clientInfo.ClientInfo_Email + "','" + class_clientInfo.ClientInfo_Zip + "','" + DateTime.Now.ToString() + "')"; OleDbDataAdapter oleDb = new OleDbDataAdapter(Sql, DBConnection.AccessConnection); DataTable dt = new DataTable(); oleDb.Fill(dt); return true; } }
public Form_Result(int Q_ID, int C_ID, Hashtable A_List_Score, Hashtable A_List_Text) { InitializeComponent(); Question_ID = Q_ID; ClientInfo_ID = C_ID; list_answerInfo_Score = A_List_Score; list_answerInfo_Text = A_List_Text; DataTable dt = null; Function_Question function_question = new Function_Question(); dt = function_question.Query_AnswerInfo(Question_ID); if (dt != null && dt.Rows.Count > 0) { label2.Text = dt.Rows[0]["Question_Title"].ToString(); } Function_ClientInfo function_clientInfo = new Function_ClientInfo(); dt = function_clientInfo.Query_ClientInfo(ClientInfo_ID); if (dt != null && dt.Rows.Count > 0) { class_clientInfo = new Class_ClientInfo(); class_clientInfo.ClientInfo_ID = Convert.ToInt32(dt.Rows[0]["ClientInfo_ID"].ToString()); class_clientInfo.ClientInfo_Name = dt.Rows[0]["ClientInfo_Name"].ToString(); class_clientInfo.ClientInfo_Age = Convert.ToUInt32(dt.Rows[0]["ClientInfo_Age"].ToString()); class_clientInfo.ClientInfo_Sex = dt.Rows[0]["ClientInfo_Sex"].ToString(); if (dt.Rows[0]["ClientInfo_Weight"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Weight"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Weight"].ToString(), 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(dt.Rows[0]["ClientInfo_Weight"].ToString()); if (dt.Rows[0]["ClientInfo_Height"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Height"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Height"].ToString(), 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(dt.Rows[0]["ClientInfo_Height"].ToString()); if (dt.Rows[0]["ClientInfo_Province"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Province"].ToString())) class_clientInfo.ClientInfo_Province = dt.Rows[0]["ClientInfo_Province"].ToString(); if (dt.Rows[0]["ClientInfo_City"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_City"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_City"].ToString(); if (dt.Rows[0]["ClientInfo_Address"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Address"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Address"].ToString(); if (dt.Rows[0]["ClientInfo_Tel"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Tel"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Tel"].ToString(); if (dt.Rows[0]["ClientInfo_Email"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Email"].ToString())) class_clientInfo.ClientInfo_Email = dt.Rows[0]["ClientInfo_Email"].ToString(); if (dt.Rows[0]["ClientInfo_Zip"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Zip"].ToString())) class_clientInfo.ClientInfo_Zip = dt.Rows[0]["ClientInfo_Zip"].ToString(); if (dt.Rows[0]["AddTime"] != null && !String.IsNullOrEmpty(dt.Rows[0]["AddTime"].ToString())) class_clientInfo.AddTime = Convert.ToDateTime(dt.Rows[0]["AddTime"].ToString()); label5.Text += class_clientInfo.ClientInfo_ID.ToString(); label6.Text += class_clientInfo.ClientInfo_Name.ToString(); } }
public Control_QuestionList(Class_Question C_Question_Obj, Class_ClientInfo C_ClientInfo_Obj) { InitializeComponent(); if (C_Question_Obj != null) class_question = C_Question_Obj; class_clientInfo = C_ClientInfo_Obj; }
private void choiButton1_Click(object sender, EventArgs e) { Class_ClientInfo class_clientInfo = new Class_ClientInfo(); if (!String.IsNullOrEmpty(choiTextBox1.Text) && CommonFunction.IsNumber(choiTextBox1.Text, 1)) class_clientInfo.ClientInfo_ID = Convert.ToInt32(choiTextBox1.Text); if (!String.IsNullOrEmpty(choiTextBox2.Text)) class_clientInfo.ClientInfo_Name = choiTextBox2.Text; if (!String.IsNullOrEmpty(choiTextBox3.Text) && CommonFunction.IsNumber(choiTextBox3.Text, 1)) class_clientInfo.ClientInfo_Age = Convert.ToUInt32(choiTextBox3.Text); if (choiRadioButton1.Checked) class_clientInfo.ClientInfo_Sex = "1"; if (choiRadioButton2.Checked) class_clientInfo.ClientInfo_Sex = "0"; if (!String.IsNullOrEmpty(choiTextBox4.Text) && CommonFunction.IsNumber(choiTextBox4.Text, 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(choiTextBox4.Text); if (!String.IsNullOrEmpty(choiTextBox5.Text) && CommonFunction.IsNumber(choiTextBox5.Text, 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(choiTextBox5.Text); if (!String.IsNullOrEmpty(choiTextBox6.Text)) class_clientInfo.ClientInfo_Province = choiTextBox6.Text; if (!String.IsNullOrEmpty(choiTextBox7.Text)) class_clientInfo.ClientInfo_City = choiTextBox7.Text; if (!String.IsNullOrEmpty(choiTextBox8.Text)) class_clientInfo.ClientInfo_Address = choiTextBox8.Text; if (!String.IsNullOrEmpty(choiTextBox9.Text)) class_clientInfo.ClientInfo_Tel = choiTextBox9.Text; if (!String.IsNullOrEmpty(choiTextBox10.Text)) class_clientInfo.ClientInfo_Email = choiTextBox10.Text; if (!String.IsNullOrEmpty(choiTextBox11.Text)) class_clientInfo.ClientInfo_Zip = choiTextBox11.Text; Function_ClientInfo fc = new Function_ClientInfo(); ClientInfo_Table = fc.Query_ClientInfo(class_clientInfo); Close(); }
public DataTable Query_ClientInfo(Class_ClientInfo class_clientInfo) { if (class_clientInfo == null) return null; String SqlWhere = "Where 1 and 1"; if (class_clientInfo.ClientInfo_ID > 0) { SqlWhere += " and ClientInfo_ID = " + class_clientInfo.ClientInfo_ID.ToString(); } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Name)) { SqlWhere += " and ClientInfo_Name Like '%" + class_clientInfo.ClientInfo_Name + "%'"; } if (class_clientInfo.ClientInfo_Age > 0) { SqlWhere += " and ClientInfo_Age = " + class_clientInfo.ClientInfo_Age.ToString(); } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Sex)) { SqlWhere += " and ClientInfo_Sex = '" + class_clientInfo.ClientInfo_Sex.ToString() + "'"; } if (class_clientInfo.ClientInfo_Weight > 0) { SqlWhere += " and ClientInfo_Weight = " + class_clientInfo.ClientInfo_Weight.ToString(); } if (class_clientInfo.ClientInfo_Height > 0) { SqlWhere += " and ClientInfo_Height = " + class_clientInfo.ClientInfo_Height.ToString(); } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Province)) { SqlWhere += " and ClientInfo_Province Like '%" + class_clientInfo.ClientInfo_Province + "%'"; } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_City)) { SqlWhere += " and ClientInfo_City Like '%" + class_clientInfo.ClientInfo_City + "%'"; } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Address)) { SqlWhere += " and ClientInfo_Address Like '%" + class_clientInfo.ClientInfo_Address + "%'"; } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Tel)) { SqlWhere += " and ClientInfo_Tel Like '%" + class_clientInfo.ClientInfo_Tel + "%'"; } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Email)) { SqlWhere += " and ClientInfo_Email Like '%" + class_clientInfo.ClientInfo_Email + "%'"; } if (!String.IsNullOrEmpty(class_clientInfo.ClientInfo_Zip)) { SqlWhere += " and ClientInfo_Zip Like '%" + class_clientInfo.ClientInfo_Zip + "%'"; } String Sql = "Select * From ClientInfo " + SqlWhere + " Order By ClientInfo_ID"; OleDbDataAdapter oleDb = new OleDbDataAdapter(Sql, DBConnection.AccessConnection); DataTable dt = new DataTable(); oleDb.Fill(dt); return dt; }
public bool Update_ClientInfo(Class_ClientInfo class_clientInfo) { if (class_clientInfo == null) return false; else { class_clientInfo.ClientInfo_Name = CommonFunction.FilterString(class_clientInfo.ClientInfo_Name); class_clientInfo.ClientInfo_Province = CommonFunction.FilterString(class_clientInfo.ClientInfo_Province); class_clientInfo.ClientInfo_City = CommonFunction.FilterString(class_clientInfo.ClientInfo_City); class_clientInfo.ClientInfo_Address = CommonFunction.FilterString(class_clientInfo.ClientInfo_Address); class_clientInfo.ClientInfo_Tel = CommonFunction.FilterString(class_clientInfo.ClientInfo_Tel); class_clientInfo.ClientInfo_Email = CommonFunction.FilterString(class_clientInfo.ClientInfo_Email); class_clientInfo.ClientInfo_Zip = CommonFunction.FilterString(class_clientInfo.ClientInfo_Zip); String Sql = ""; Sql += "Update ClientInfo Set ClientInfo_Name = '" + class_clientInfo.ClientInfo_Name + "',"; Sql += "ClientInfo_Age = " + class_clientInfo.ClientInfo_Age.ToString() + ","; Sql += "ClientInfo_Sex = '" + class_clientInfo.ClientInfo_Sex + "',"; Sql += "ClientInfo_Weight = " + class_clientInfo.ClientInfo_Weight + ","; Sql += "ClientInfo_Height = " + class_clientInfo.ClientInfo_Height + ","; Sql += "ClientInfo_Province = '" + class_clientInfo.ClientInfo_Province + "',"; Sql += "ClientInfo_City = '" + class_clientInfo.ClientInfo_City + "',"; Sql += "ClientInfo_Address = '" + class_clientInfo.ClientInfo_Address + "',"; Sql += "ClientInfo_Tel = '" + class_clientInfo.ClientInfo_Tel + "',"; Sql += "ClientInfo_Email = '" + class_clientInfo.ClientInfo_Email + "',"; Sql += "ClientInfo_Zip = '" + class_clientInfo.ClientInfo_Zip + "' "; Sql += "Where ClientInfo_ID = " + class_clientInfo.ClientInfo_ID; OleDbDataAdapter oleDb = new OleDbDataAdapter(Sql, DBConnection.AccessConnection); DataTable dt = new DataTable(); oleDb.Fill(dt); return true; } }
private Class_ClientInfo CheckInput() { Class_ClientInfo class_clientInfo = new Class_ClientInfo(); //姓名 if (String.IsNullOrEmpty(choiTextBox1.Text)) { choiTextBox1.Focus(); MessageBox.Show("请输入姓名", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } class_clientInfo.ClientInfo_Name = choiTextBox1.Text; //年龄 if (String.IsNullOrEmpty(choiTextBox2.Text)) { choiTextBox2.Focus(); MessageBox.Show("请输入年龄", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } if (!CommonFunction.IsNumber(choiTextBox2.Text, 1)) { choiTextBox2.Focus(); MessageBox.Show("请输入正确的年龄格式", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } class_clientInfo.ClientInfo_Age = Convert.ToUInt32(choiTextBox2.Text); //性别 if (!choiRadioButton1.Checked && !choiRadioButton2.Checked) { MessageBox.Show("请选择性别", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } if (choiRadioButton1.Checked) class_clientInfo.ClientInfo_Sex = "1"; if (choiRadioButton2.Checked) class_clientInfo.ClientInfo_Sex = "0"; //体重 if (!String.IsNullOrEmpty(choiTextBox3.Text)) { if (CommonFunction.IsNumber(choiTextBox3.Text, 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(choiTextBox3.Text); else { MessageBox.Show("请输入正确的体重格式", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } } //身高 if (!String.IsNullOrEmpty(choiTextBox4.Text)) { if (CommonFunction.IsNumber(choiTextBox4.Text, 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(choiTextBox4.Text); else { MessageBox.Show("请输入正确的身高格式", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } } //省份 if (!String.IsNullOrEmpty(choiTextBox5.Text)) class_clientInfo.ClientInfo_Province = choiTextBox5.Text; //城市 if (!String.IsNullOrEmpty(choiTextBox6.Text)) class_clientInfo.ClientInfo_City = choiTextBox6.Text; //地址 if (!String.IsNullOrEmpty(choiTextBox7.Text)) class_clientInfo.ClientInfo_Address = choiTextBox7.Text; //电话 if (!String.IsNullOrEmpty(choiTextBox8.Text)) class_clientInfo.ClientInfo_Tel = choiTextBox8.Text; //电子邮件 if (!String.IsNullOrEmpty(choiTextBox9.Text)) { if (!CommonFunction.IsEmail(choiTextBox9.Text)) { MessageBox.Show("请输入正确的电子邮件格式", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } class_clientInfo.ClientInfo_Email = choiTextBox9.Text; } //邮政编码 if (!String.IsNullOrEmpty(choiTextBox10.Text)) class_clientInfo.ClientInfo_Tel = choiTextBox10.Text; return class_clientInfo; }
public void Show_QuestionList() { //显示客户姓名和编号 Function_ClientInfo function_clientInfo = new Function_ClientInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(ClientInfo_ID); if (dt != null && dt.Rows.Count > 0) { class_clientInfo = new Class_ClientInfo(); class_clientInfo.ClientInfo_ID = Convert.ToInt32(dt.Rows[0]["ClientInfo_ID"].ToString()); class_clientInfo.ClientInfo_Name = dt.Rows[0]["ClientInfo_Name"].ToString(); class_clientInfo.ClientInfo_Age = Convert.ToUInt32(dt.Rows[0]["ClientInfo_Age"].ToString()); class_clientInfo.ClientInfo_Sex = dt.Rows[0]["ClientInfo_Sex"].ToString(); if (dt.Rows[0]["ClientInfo_Weight"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Weight"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Weight"].ToString(), 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(dt.Rows[0]["ClientInfo_Weight"].ToString()); if (dt.Rows[0]["ClientInfo_Height"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Height"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Height"].ToString(), 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(dt.Rows[0]["ClientInfo_Height"].ToString()); if (dt.Rows[0]["ClientInfo_Province"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Province"].ToString())) class_clientInfo.ClientInfo_Province = dt.Rows[0]["ClientInfo_Province"].ToString(); if (dt.Rows[0]["ClientInfo_City"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_City"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_City"].ToString(); if (dt.Rows[0]["ClientInfo_Address"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Address"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Address"].ToString(); if (dt.Rows[0]["ClientInfo_Tel"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Tel"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Tel"].ToString(); if (dt.Rows[0]["ClientInfo_Email"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Email"].ToString())) class_clientInfo.ClientInfo_Email = dt.Rows[0]["ClientInfo_Email"].ToString(); if (dt.Rows[0]["ClientInfo_Zip"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Zip"].ToString())) class_clientInfo.ClientInfo_Zip = dt.Rows[0]["ClientInfo_Zip"].ToString(); if (dt.Rows[0]["AddTime"] != null && !String.IsNullOrEmpty(dt.Rows[0]["AddTime"].ToString())) class_clientInfo.AddTime = Convert.ToDateTime(dt.Rows[0]["AddTime"].ToString()); label5.Text += class_clientInfo.ClientInfo_ID.ToString(); label6.Text += class_clientInfo.ClientInfo_Name.ToString(); } if (Question_ID > 0) { //显示题目名称和题目头 Function_Question function_question = new Function_Question(); dt = function_question.Query_AnswerInfo(Question_ID); if (dt != null && dt.Rows.Count > 0) { label2.Text = dt.Rows[0]["Question_Title"].ToString(); label4.Text = dt.Rows[0]["Question_Top"].ToString(); //flowLayoutPanel1.BorderStyle = BorderStyle.Fixed3D; flowLayoutPanel1.Controls.Add(label3); flowLayoutPanel1.Controls.Add(label4); flowLayoutPanel1.Height = label3.Height + label4.Height + 5; label5.Location = new Point(label5.Location.X, flowLayoutPanel1.Location.Y + flowLayoutPanel1.Height + 10); label6.Location = new Point(label6.Location.X, flowLayoutPanel1.Location.Y + flowLayoutPanel1.Height + 10); Panel_Height = label5.Location.Y + label5.Height + 10; } Function_AnswerInfo function_anwerInfo = new Function_AnswerInfo(); dt = function_anwerInfo.Query_AnswerInfo(ClientInfo_ID, Question_ID); if (dt != null && dt.Rows.Count > 0) { if (CommonFunction.IsNumber(dt.Rows[0]["AnswerInfo_ID"].ToString(), 0)) { AnswerInfo_ID = Convert.ToInt32(dt.Rows[0]["AnswerInfo_ID"].ToString()); Text_Question_Tail.Text = dt.Rows[0]["Question_Tail"].ToString(); } } Hashtable hash_answerList = new Hashtable(); if (AnswerInfo_ID > 0) { //读出每条答过的题目 Function_AnswerList function_answerList = new Function_AnswerList(); dt = function_answerList.Query_AnswerList(AnswerInfo_ID); if (dt != null && dt.Rows.Count > 0) { int QuestionList_ID = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (QuestionList_ID != Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString())) { QuestionList_ID = Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString()); ArrayList list_questionSelect = new ArrayList(); list_questionSelect.Add(Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString())); hash_answerList.Add(QuestionList_ID, list_questionSelect); } else { ArrayList list_questionSelect = (ArrayList)hash_answerList[QuestionList_ID]; list_questionSelect.Add(Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString())); hash_answerList[QuestionList_ID] = list_questionSelect; } } } } //读出每条题目 Function_QuestionList function_questionList = new Function_QuestionList(); dt = function_questionList.Query_QuestionList(Question_ID); if (dt != null && dt.Rows.Count > 0) { ArrayList list_QuestionList = new ArrayList(); int j = -1; int QuestionList_Sequence = 0; for (int i = 0; i < dt.Rows.Count; i++) { int QuestionList_ID = Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString()); if (QuestionList_ID != QuestionList_Sequence) { Class_Question class_question = new Class_Question(); class_question.QuestionList_ListID = Convert.ToInt32(dt.Rows[i]["QuestionList_ListID"].ToString()); ; class_question.QuestionList_ID = QuestionList_ID; class_question.Question_Title = dt.Rows[i]["QuestionList_Title"].ToString(); class_question.Question_Option = Convert.ToInt32(dt.Rows[i]["QuestionList_Option"].ToString()); class_question.Question_TurnRow = Convert.ToInt32(dt.Rows[i]["QuestionList_TurnRow"].ToString()); Class_QuestionSelect class_questionSelect = new Class_QuestionSelect(); class_questionSelect.QuestionSelect_ID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString()); class_questionSelect.QuestionSelect_MainID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_MainID"].ToString()); class_questionSelect.QuestionSelect_ListID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ListID"].ToString()); class_questionSelect.QuestionSelect_Text = dt.Rows[i]["QuestionSelect_Text"].ToString(); class_questionSelect.QuestionSelect_Score = Convert.ToInt32(dt.Rows[i]["QuestionSelect_Score"].ToString()); ArrayList list_questionSelect = new ArrayList(); list_questionSelect.Add(class_questionSelect); list_QuestionList.Add(class_question); class_question.Class_QuestionSelect = list_questionSelect; QuestionList_Sequence = QuestionList_ID; j++; } else { Class_Question class_question = (Class_Question)list_QuestionList[j]; ArrayList list_question = class_question.Class_QuestionSelect; Class_QuestionSelect class_questionSelect = new Class_QuestionSelect(); class_questionSelect.QuestionSelect_ID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString()); class_questionSelect.QuestionSelect_MainID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_MainID"].ToString()); class_questionSelect.QuestionSelect_ListID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ListID"].ToString()); class_questionSelect.QuestionSelect_Text = dt.Rows[i]["QuestionSelect_Text"].ToString(); class_questionSelect.QuestionSelect_Score = Convert.ToInt32(dt.Rows[i]["QuestionSelect_Score"].ToString()); list_question.Add(class_questionSelect); } } //显示每条题目 if (list_QuestionList.Count > 0) { QuestionList_Total = list_QuestionList.Count; QuestionList_TotalPage = (list_QuestionList.Count - 1) / 10 + 1; Panel panel = null; int p = QuestionList_CurrentPage; int i = 0; for (i = 0; i < list_QuestionList.Count; i++) { if (i % 10 == 0) { panel = new Panel(); panel.AutoSize = true; //panel.BorderStyle = BorderStyle.Fixed3D; panel.Location = new System.Drawing.Point(pictureBox1.Location.X, Panel_Height); panel.Name = "Panel_QuestionList" + p.ToString(); panel.Visible = false; panel.ControlAdded += new ControlEventHandler(Panel_Control_Added); Controls.Add(panel); if (p == QuestionList_CurrentPage) panel.Visible = true; p++; Controls_Height = 0; } Class_Question class_question = (Class_Question)list_QuestionList[i]; Control_QuestionList control_questionList = new Control_QuestionList(class_question, class_clientInfo); if (hash_answerList != null && hash_answerList.Count > 0) { ArrayList list_questionSelect = (ArrayList)hash_answerList[class_question.QuestionList_ID]; control_questionList.QuestionSelect_List = list_questionSelect; } control_questionList.Show_QuestionList(); panel.Controls.Add(control_questionList); } String Question_Tail = function_question.Query_Question_Tail(Question_ID); if (!String.IsNullOrEmpty(Question_Tail)) label7.Text = Question_Tail; else { label7.Visible = false; Text_Question_Tail.Visible = false; } if (panel != null) { panel.Controls.Add(label7); panel.Controls.Add(Text_Question_Tail); } Control[] panel_controls = Controls.Find("Panel_QuestionList" + QuestionList_CurrentPage, false); if (panel_controls == null || panel_controls.Length == 0) return; if (panel_controls[0] is Panel) { panel = (Panel)panel_controls[0]; choiButton1.Location = new Point(choiButton1.Location.X, panel.Location.Y + panel.Size.Height + 10); choiButton2.Location = new Point(choiButton2.Location.X, panel.Location.Y + panel.Size.Height + 10); choiButton3.Location = new Point(choiButton3.Location.X, panel.Location.Y + panel.Size.Height + 10); } } } } }