public static void Reset(TeacherInfoStruct currentTeacherInfo) { CurrentTeacherInfo = currentTeacherInfo; CurrentQuestionMod = 0; QuestionMod_0 = 0; QuestionMod_1 = 0; QuestionMod_2 = 0; LoadMod_0StudentInfoStructs(); LoadMod_1StudentInfoStructs(); LoadMod_2StudentInfoStructs(); }
private void LoadOptionButton() { Size ctlSize = new Size(110, 100); int _left = 4; int _top = 4; int _padding = 6; PanelOption._BGColorStyle = true; PanelOption.BackColor = Color_SecondColor; PanelOption.DrawLine(true, 119, Color_PrimaryColor); foreach (var l in TeacherInfoList) { MoUI_OptionBUtton op = new MoUI_OptionBUtton(); op.Size = ctlSize; op._Text = l.Major; op._TextB = l.Name; op._BGColorStyle = true; op._BackColor = Color_SecondColor; PanelOption.Controls.Add(op); op.Left = _left; op.Top = _top; _top = _top + ctlSize.Height + _padding; op.teacherInfoStruct = l; op.MouseClick += delegate { if (op._IsSelected == true) { return; } foreach (var ctl in op.Parent.Controls) { if (ctl is MoUI_OptionBUtton) { MoUI_OptionBUtton c = (MoUI_OptionBUtton)ctl; c._IsSelected = false; } } moUI_Label3.IsSelected = false; moUI_Label1.IsSelected = true; moUI_Label2.IsSelected = false; op._IsSelected = true; CurrentSelectTeacherInfo = op.teacherInfoStruct; ScoreListView.Visible = false; Thread t = new Thread(new ThreadStart(LoadTeacherAnswerMod)); t.Start(); }; } }
/// <summary> /// 获取教师信息表 /// </summary> /// <returns></returns> public List <TeacherInfoStruct> GetTeacherInfoList() { string TeacherMajor = string.Empty; string IncludeClass = string.Empty; string TeacherName = string.Empty; try { List <TeacherInfoStruct> resList = new List <TeacherInfoStruct>(); CONN.Open(); string SQL_GetAllTeacherInfoList = @"SELECT * FROM TeacherInfo"; SQLiteCommand cmd = new SQLiteCommand(SQL_GetAllTeacherInfoList, CONN); var sdr = cmd.ExecuteReader(); while (sdr.Read()) { TeacherInfoStruct TeacherTemp = new TeacherInfoStruct(); //读取一个老师的信息 TeacherTemp.Name = sdr["Name"].ToString(); TeacherName = TeacherTemp.Name; TeacherTemp.Major = sdr["Major"].ToString(); TeacherMajor = TeacherTemp.Major; TeacherTemp.IncludeClass = sdr["IncludeClass"].ToString(); IncludeClass = TeacherTemp.IncludeClass; //if (string.IsNullOrEmpty(TeacherTemp.IncludeClass)) // continue; #region { string Major = string.Empty; string ClassName = string.Empty; List <StudentInfoStruct> resStudentList = new List <StudentInfoStruct>(); var StringArray_Class = TeacherTemp.IncludeClass.Split(','); if (StringArray_Class.Length == 0) { return(null); } foreach (var ClassString in StringArray_Class) { var temp = ClassString.Split('.'); Major = temp[0].Trim(); ClassName = temp[1].Trim(); string SQL_SELECT_STUDENTS = string.Format(@"SELECT * FROM StudentInfo WHERE [Major] = '{0}' AND [Class] = '{1}'", Major, ClassName); SQLiteCommand cmdStudent = new SQLiteCommand(SQL_SELECT_STUDENTS, CONN); SQLiteDataReader sdrStudent = cmdStudent.ExecuteReader();// while (sdrStudent.Read()) { StudentInfoStruct si = new StudentInfoStruct(); si.Name = sdrStudent["Name"].ToString(); si.Gender = sdrStudent["Gender"].ToString(); si.Class = sdrStudent["Class"].ToString(); si.Major = sdrStudent["Major"].ToString(); si.PoliticalStatus = sdrStudent["PoliticalStatus"].ToString(); si.Nation = sdrStudent["Nation"].ToString(); si.Post = sdrStudent["Post"].ToString(); si.Address = sdrStudent["Address"].ToString(); si.Dorm = sdrStudent["Dorm"].ToString(); si.DormMember = sdrStudent["DormMember"].ToString(); si.Economic = sdrStudent["Economic"].ToString(); si.BonusAndPenalty = sdrStudent["BonusAndPenalty"].ToString(); si.Study = sdrStudent["Study"].ToString(); si.Habby = sdrStudent["Habby"].ToString(); si.PhotoPath = sdrStudent["PhotoPath"].ToString(); si.ID = sdrStudent["ID"].ToString(); si.Job = sdrStudent["Job"].ToString(); si.Number = sdrStudent["Number"].ToString(); if (File.Exists(si.PhotoPath) || File.Exists(si.PhotoPath + ".jpg") || File.Exists(si.PhotoPath + ".png") || File.Exists(si.PhotoPath + ".jpg.jpg")) { resStudentList.Add(si); } } sdrStudent.Close(); } TeacherTemp.StudentList = resStudentList; resList.Add(TeacherTemp); } #endregion } sdr.Close(); CONN.Close(); return(resList); } catch (Exception e) { //throw e; throw new Exception(TeacherMajor + " - " + TeacherName + "\n\n" + IncludeClass + "\n\n信息格式错误"); } }