/// <summary> /// 設定領域名稱 /// </summary> public static void SetDomainList() { DomainNameList.Clear(); // 從學生修課動態取得科目領域名稱 if (_SelStudentIDList.Count > 0 && _SelSchoolYear > 0 && _SelSemester > 0 && _SelExamID != "") { QueryHelper qh = new QueryHelper(); string strSQL = "SELECT DISTINCT " + "domain " + "FROM " + "sc_attend " + "INNER JOIN " + "course " + "ON sc_attend.ref_course_id=course.id " + "INNER JOIN te_include " + "ON course.ref_exam_template_id = te_include.ref_exam_template_id " + "WHERE sc_attend.ref_student_id IN(" + string.Join(",", _SelStudentIDList.ToArray()) + ") " + "AND course.school_year=" + _SelSchoolYear + " " + "AND course.semester=" + _SelSemester + " " + "AND te_include.ref_exam_id = " + _SelExamID + " AND domain <>'';"; DataTable dt = qh.Select(strSQL); foreach (DataRow dr in dt.Rows) { string domain = dr["domain"].ToString(); if (!DomainNameList.Contains(domain)) { DomainNameList.Add(domain); } } } else { // 預設 DomainNameList.Add("國語文"); DomainNameList.Add("英語"); DomainNameList.Add("數學"); DomainNameList.Add("社會"); DomainNameList.Add("自然與生活科技"); DomainNameList.Add("自然科學"); DomainNameList.Add("藝術"); DomainNameList.Add("健康與體育"); DomainNameList.Add("藝術與人文"); DomainNameList.Add("綜合活動"); DomainNameList.Add("彈性課程"); DomainNameList.Add("科技"); DomainNameList.Add("特殊需求"); } if (!DomainNameList.Contains("彈性課程")) { DomainNameList.Add("彈性課程"); } }
void ListDomainWebResponse(object sender, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= ListDomainWebResponse; if (result is AmazonSimpleDBException) { this.Dispatcher.BeginInvoke(() => { this.ListDomainMessage = "Error: " + ((AmazonSimpleDBException)result).Message; }); return; } ListDomainsResponse response = (ListDomainsResponse)result; this.Dispatcher.BeginInvoke(() => { DomainNameList.Clear(); response.ListDomainsResult.DomainName.ForEach(b => DomainNameList.Add(b)); this.ListDomainMessage = "No of Domains: " + response.ListDomainsResult.DomainName.Count; }); }