/// <summary> /// 取得使用者自訂範本 /// </summary> public void GetUserDefineTemplateFromSystem() { School.Configuration.Sync("畢業證書_無成績"); ConfigData cd = School.Configuration["畢業證書_無成績"]; cd["Default"] = _isDefaultTemplate.ToLower(); if (cd.Contains("CustomizeTemplate")) { string templateBase64 = cd["CustomizeTemplate"]; _buffer = Convert.FromBase64String(templateBase64); } else { #region 產生空白設定檔 cd["Default"] = "true"; cd["CustomizeTemplate"] = ""; cd.Save(); #endregion } if (cd.Contains("CustomizeTemplate2")) { string templateBase64 = cd["CustomizeTemplate2"]; _bufferStudyCertificate = Convert.FromBase64String(templateBase64); } else { #region 產生空白設定檔 //cd["Default"] = "true"; cd["CustomizeTemplate2"] = ""; cd.Save(); #endregion } }
public PrintConfigForm(string name) { InitializeComponent(); _name = name; ConfigData cd = K12.Data.School.Configuration[_name]; if (cd.Contains("節權設定") && !string.IsNullOrEmpty(cd["節權設定"])) { XmlElement xml = K12.Data.XmlHelper.LoadXml(cd["節權設定"]); chkPeriod.Checked = bool.Parse(xml.SelectSingleNode("Period").InnerText); chkCredit.Checked = bool.Parse(xml.SelectSingleNode("Credit").InnerText); } if (cd.Contains("領域科目設定") && !string.IsNullOrEmpty(cd["領域科目設定"])) { XmlElement xml = K12.Data.XmlHelper.LoadXml(cd["領域科目設定"]); XmlElement staticNode = (XmlElement)xml.SelectSingleNode("Static"); if (staticNode != null) { if (staticNode.InnerText == "Domain") { rbDomain.Checked = true; } else { rbSubject.Checked = true; } } } }
public SubjectCEForm(string configName, string defaultCH, string defaultEN) { InitializeComponent(); DefaultCH = defaultCH; DefaultEN = defaultEN; InitializeDataGridView(); ConfigName = configName; ConfigData cd = K12.Data.School.Configuration[ConfigName]; if (cd.Contains("Chinese") && !string.IsNullOrEmpty(cd["Chinese"])) { CellCH.Value = cd["Chinese"]; } else { CellCH.Value = DefaultCH; } if (cd.Contains("English") && !string.IsNullOrEmpty(cd["English"])) { CellEN.Value = cd["English"]; } else { CellEN.Value = DefaultEN; } }
internal void Load() { ConfigData cd = K12.Data.School.Configuration[Global.ReportName]; #region 讀取使用者的節權設定 if (cd.Contains("節權設定") && !string.IsNullOrEmpty(cd["節權設定"])) { XmlElement config = K12.Data.XmlHelper.LoadXml(cd["節權設定"]); PrintPeriod = bool.Parse(config.SelectSingleNode("Period").InnerText); PrintCredit = bool.Parse(config.SelectSingleNode("Credit").InnerText); } else { PrintPeriod = false; PrintCredit = false; } #endregion #region 讀取使用者的假別設定 if (cd.Contains("假別設定") && !string.IsNullOrEmpty(cd["假別設定"])) { XmlElement config = K12.Data.XmlHelper.LoadXml(cd["假別設定"]); foreach (XmlElement type in config.SelectNodes("Type")) { string typeName = type.GetAttribute("Text"); if (!PrintTypes.ContainsKey(typeName)) { PrintTypes.Add(typeName, new List <string>()); } foreach (XmlElement absence in type.SelectNodes("Absence")) { string absenceName = absence.GetAttribute("Text"); if (!PrintTypes[typeName].Contains(absenceName)) { PrintTypes[typeName].Add(absenceName); } } } } #endregion #region 讀取使用者的領域科目設定 if (cd.Contains("領域科目設定") && !string.IsNullOrEmpty(cd["領域科目設定"])) { XmlElement xml = K12.Data.XmlHelper.LoadXml(cd["領域科目設定"]); XmlElement staticNode = (XmlElement)xml.SelectSingleNode("Static"); if (staticNode != null) { try { DomainSubjectSetup = (DomainSubjectSetup)Enum.Parse(DomainSubjectSetup.GetType(), staticNode.InnerText, true); } catch (Exception) { } } } #endregion }
private static List <string> Select(string type) { List <string> domains = new List <string>(); ConfigData cd = K12.Data.School.Configuration[ConfigName]; XmlElement element = null; if (cd.Contains("DomainList")) { element = cd.GetXml("DomainList", XmlHelper.LoadXml("<DomainList/>")); } else { element = XmlHelper.LoadXml(Properties.Resources.DefaultDomainList); } foreach (XmlElement domainElement in element.SelectNodes("Domain[@Type='" + type + "']")) { if (string.IsNullOrEmpty(domainElement.InnerText)) { continue; } domains.Add(domainElement.InnerText); } return(domains); }
private void ReDomainForTeacherForm_Load(object sender, EventArgs e) { // 預設學年度、學期 iptSchoolYear.Value = int.Parse(K12.Data.School.DefaultSchoolYear); iptSemester.Value = int.Parse(K12.Data.School.DefaultSemester); #region BackGroundWorker Init { _bgWorker.DoWork += _bgWorker_DoWork; _bgWorker.RunWorkerCompleted += _bgWorker_RunWorkerCompleted; _bgWorker.ProgressChanged += _bgWorker_ProgressChanged; _bgWorker.WorkerReportsProgress = true; } #endregion #region 取得領域對照表 { ConfigData cd = School.Configuration["JHEvaluation_Subject_Ordinal"]; { if (cd.Contains("DomainOrdinal")) { XmlElement element = cd.GetXml("DomainOrdinal", XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string name = domainElement.GetAttribute("Name"); listDomainFromConfig.Add(name); } } } } #endregion // 載入樣板 wbTemplate = new Workbook(new MemoryStream(Properties.Resources.ReTestDomainReport_ForTeacher)); }
public void Load() { ConfigData cd = School.Configuration[_name]; if (cd.Contains("xml") && !string.IsNullOrEmpty(cd["xml"])) { HasValue = true; XmlElement element = XmlHelper.LoadXml(cd["xml"]); RankMethod = element.SelectSingleNode("RankMethod").InnerText; PrintItems.Clear(); foreach (XmlElement item in element.SelectNodes("PrintItems/Item")) { PrintItems.Add(item.InnerText); } //<Config> // <RankMethod></RankMethod> // <PrintItems> // <Item/> // <Item/> // </PrintItems> //</Config> } else { HasValue = false; } }
private void ApplyPreference() { ConfigData cd = User.Configuration["異動資料檢視"]; if (cd.Contains("異動代碼")) { XmlElement pref = XmlHelper.LoadXml(cd["異動代碼"]); foreach (DataGridViewRow row in dgvUpdateCode.Rows) { if (pref.SelectSingleNode(string.Format("Code[.='{0}']", "" + row.Cells[colCode.Index].Value)) != null) { row.Cells[colCheck.Index].Value = true; _codeList.Add("" + row.Cells[colCode.Index].Value); } } } //舊的寫法 //XmlElement pref = SmartSchool.Customization.Data.SystemInformation.Preference["異動資料檢視_異動代碼"]; //if (pref != null) //{ // foreach (DataGridViewRow row in dgvUpdateCode.Rows) // { // if (pref.SelectSingleNode(string.Format("Code[.='{0}']", "" + row.Cells[colCode.Index].Value)) != null) // { // row.Cells[colCheck.Index].Value = true; // _codeList.Add("" + row.Cells[colCode.Index].Value); // } // } //} }
private void LoadDomain() { bool containsLifeCoursedomain = false; // 是否有生活課程 ConfigData cd = K12.Data.School.Configuration[ConfigName]; if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string group = domainElement.GetAttribute("Group"); string name = domainElement.GetAttribute("Name"); string englishName = domainElement.GetAttribute("EnglishName"); if (name == "生活課程") { containsLifeCoursedomain = true; } DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, group, name, englishName); dgv.Rows.Add(row); } if (!containsLifeCoursedomain) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "", "生活課程", ""); dgv.Rows.Add(row); } } }
public void Load() { ConfigData cd = K12.Data.School.Configuration[_name]; #region 假別設定 if (cd.Contains("假別設定") && !string.IsNullOrEmpty(cd["假別設定"])) { XmlElement config = K12.Data.XmlHelper.LoadXml(cd["假別設定"]); foreach (XmlElement type in config.SelectNodes("Type")) { string typeName = type.GetAttribute("Text"); if (!PrintTypes.ContainsKey(typeName)) { PrintTypes.Add(typeName, new List <string>()); } foreach (XmlElement absence in type.SelectNodes("Absence")) { string absenceName = absence.GetAttribute("Text"); if (!PrintTypes[typeName].Contains(absenceName)) { PrintTypes[typeName].Add(absenceName); } } } } #endregion _asWithExam.Clear(); foreach (JHAEIncludeRecord ae in JHAEInclude.SelectAll()) { if (ae.RefExamID == Exam.ID) { if (!_asWithExam.Contains(ae.RefAssessmentSetupID)) { _asWithExam.Add(ae.RefAssessmentSetupID); } } } // 評分樣板對照 aeExamName.Clear(); foreach (JHAEIncludeRecord ae in JHAEInclude.SelectAll()) { if (aeExamName.ContainsKey(ae.RefAssessmentSetupID)) { if (!aeExamName[ae.RefAssessmentSetupID].Contains(ae.ExamName)) { aeExamName[ae.RefAssessmentSetupID].Add(ae.ExamName); } } else { List <string> exList = new List <string>(); exList.Add(ae.ExamName); aeExamName.Add(ae.RefAssessmentSetupID, exList); } } }
private string transferInConfigKey = "TransferInReason"; //紀錄轉入原因清單的組態值的Key public UpdateRecordInfo03(DAL.StudUpdateRecordEntity sure) { InitializeComponent(); Errors = new EnhancedErrorProvider(); // 設定男、女值與設定只能選不能修改 cboGender.Items.Add("男"); cboGender.Items.Add("女"); cd = JHSchool.School.Configuration[updateConfigKey]; if (!cd.Contains(transferInConfigKey)) { cd[transferInConfigKey] = "遷居;安置;其他"; cd.Save(); } string[] reasons = cd[transferInConfigKey].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <string> reasonList = new List <string>(reasons); foreach (string reason in reasons) { this.cboUpdateDescription.Items.Add(reason); } foreach (string defaultReason in new string[] { "遷居", "安置", "其他" }) { if (!reasonList.Contains(defaultReason)) { this.cboUpdateDescription.Items.Add(defaultReason); } } _StudUpdateRecordEntity = sure; SetUpdateRecordInfoToForm(); }
private void LoadDomain() { bool containsIEPDomin = false; bool containsTechnologydomin = false; ConfigData cd = K12.Data.School.Configuration[ConfigName]; if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string group = domainElement.GetAttribute("Group"); string name = domainElement.GetAttribute("Name"); string englishName = domainElement.GetAttribute("EnglishName"); if (name == "特殊需求") { containsIEPDomin = true; } if (name == "科技") { containsTechnologydomin = true; } DataGridViewRow row = new DataGridViewRow(); bool chkC = false; bool chkG = false; // 判斷領域是白名單內 check true if (Global.DomainMap108List.Contains(name)) { chkC = true; chkG = true; } row.CreateCells(dgv, group, name, englishName, chkC, chkG); dgv.Rows.Add(row); } } if (!containsIEPDomin) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "", "特殊需求", "", false, false); dgv.Rows.Add(row); } if (!containsTechnologydomin) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, "", "科技", "", false, false); dgv.Rows.Add(row); } }
/// <summary> /// 取得 Xml 資料。如果資料不存在會回傳「defaultValue」,如果資料存在會轉型成 XmlElement。轉型失敗會產生 Exception。 /// </summary> public static XmlElement GetXml(this ConfigData config, string name, XmlElement defaultValue) { if (config.Contains(name)) { return(XmlHelper.LoadXml(config[name])); } else { return(defaultValue); } }
private string transferOutConfigKey = "TransferOutReason"; //紀錄轉入原因清單的組態值的Key public UpdateRecordInfo04(DAL.StudUpdateRecordEntity sure) { InitializeComponent(); if (JHSchool.Permrec.Program.ModuleType == JHSchool.Permrec.Program.ModuleFlag.KaoHsiung) { labelX6.Text = "遷出地址"; } Errors = new EnhancedErrorProvider(); // 設定男、女值與設定只能選不能修改 cboGender.Items.Add("男"); cboGender.Items.Add("女"); cboGender.DropDownStyle = ComboBoxStyle.DropDownList; //將轉入紀錄清單的key輸入至list cd中 cd = JHSchool.School.Configuration[updateConfigKey]; if (!cd.Contains(transferOutConfigKey)) { cd[transferOutConfigKey] = "遷居;出國;其他"; cd.Save(); } string[] reasons = cd[transferOutConfigKey].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <string> reasonList = new List <string>(reasons); foreach (string reason in reasons) { this.cboUpdateDescription.Items.Add(reason); } foreach (string defaultreason in new string[] { "遷居", "出國", "其他" }) { if (!reasonList.Contains(defaultreason)) { this.cboUpdateDescription.Items.Add(defaultreason); } } //將cdlist拆成由char所組成的,最後加入畫面之中 //string[] reasons = cd[transferOutConfigKey].Split(new char[] { ';' }); //foreach (string reason in reasons) // { // this.cboUpdateDescription.Items.Add(reason); //} _StudUpdateRecordEntity = sure; SetUpdateRecordInfoToForm(); }
private void LoadSubject() { ConfigData cd = K12.Data.School.Configuration[ConfigName]; if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Subjects/>")); foreach (XmlElement domainElement in element.SelectNodes("Subject")) { string name = domainElement.GetAttribute("Name"); string englishName = domainElement.GetAttribute("EnglishName"); DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, name, englishName); dgv.Rows.Add(row); } } }
private string SuspensionConfigKey = "SuspensionReason"; //紀錄休學原因清單的組態值的Key public UpdateRecordInfo05(DAL.StudUpdateRecordEntity sure) { InitializeComponent(); Errors = new EnhancedErrorProvider(); // 設定男、女值與設定只能選不能修改 cboGender.Items.Add("男"); cboGender.Items.Add("女"); cboGender.DropDownStyle = ComboBoxStyle.DropDownList; //將休學紀錄清單的key輸入至list cd中 cd = JHSchool.School.Configuration[updateConfigKey]; if (!cd.Contains(SuspensionConfigKey)) { cd[SuspensionConfigKey] = "因病;出國"; cd.Save(); } string[] reasons = cd[SuspensionConfigKey].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <string> reasonList = new List <string>(reasons); if (reasonList.Contains("其他")) { reasonList.Remove("其他"); } if (reasonList.Contains("死亡")) { reasonList.Remove("死亡"); } foreach (string defaultreason in new string[] { "因病", "出國" }) { if (!reasonList.Contains(defaultreason)) { reasonList.Add(defaultreason); } } foreach (string name in reasonList) { this.cboUpdateDescription.Items.Add(name); } _StudUpdateRecordEntity = sure; SetUpdateRecordInfoToForm(); }
/// <summary> /// 取得 Integer 資料。如果資料不存在會回傳「defaultValue」,如果資料存在會轉型成 Integer。轉型失敗會產生 Exception。 /// </summary> public static int GetInteger(this ConfigData config, string name, int defaultValue) { if (config.Contains(name)) { int result; if (int.TryParse(config[name], out result)) { return(result); } else { throw new ArgumentException(string.Format("「{0}」資料無法轉型成 Int 型別。", name)); } } else { return(defaultValue); } }
/// <summary> /// 取得 Boolean 資料。如果資料不存在會回傳「defaultValue」,如果資料存在會轉型成 Boolean。轉型失敗會產生 Exception。 /// </summary> public static bool GetBoolean(this ConfigData config, string name, bool defaultValue) { if (config.Contains(name)) { bool result; if (bool.TryParse(config[name], out result)) { return(result); } else { throw new ArgumentException(string.Format("「{0}」資料無法轉型成 Boolean 型別。", name)); } } else { return(defaultValue); } }
/// <summary> /// 取得使用者自訂範本 /// </summary> public void GetUserDefineTemplateFromSystem() { School.Configuration.Sync("在學證明書_無成績"); ConfigData cd = School.Configuration["在學證明書_無成績"]; bool.TryParse(cd["Default"], out _isDefaultTemplate); if (cd.Contains("CustomizeTemplate")) { string templateBase64 = cd["CustomizeTemplate"]; _buffer = Convert.FromBase64String(templateBase64); } else { #region 產生空白設定檔 cd["Default"] = "true"; cd["CustomizeTemplate"] = ""; cd.Save(); #endregion } }
private void frmExportClassDomainScore_Load(object sender, EventArgs e) { // 讀取樣板 Stream stream = new MemoryStream(Properties.Resources.ClassDomainScore_template); docTemplate = new Document(stream); // 取得領域對照表 ConfigData cd = School.Configuration[ConfigName]; { if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string name = domainElement.GetAttribute("Name"); listDomainName.Add(name); } } } }
/// <summary> /// 取得假別設定 /// </summary> /// <returns></returns> public static Dictionary <string, List <string> > GetTypes() { Dictionary <string, List <string> > retVal = new Dictionary <string, List <string> >(); ConfigData cd = K12.Data.School.Configuration[Global.ReportName]; if (cd.Contains("假別設定")) { XElement config = XElement.Parse(cd["假別設定"]); foreach (XElement type in config.Elements("Type")) { if (type.Attribute("Text") == null) { continue; } string typeName = type.Attribute("Text").Value; if (!retVal.ContainsKey(typeName)) { retVal.Add(typeName, new List <string>()); } foreach (XElement absence in type.Elements("Absence")) { if (absence.Attribute("Text") == null) { continue; } string absenceName = absence.Attribute("Text").Value; if (!retVal[typeName].Contains(absenceName)) { retVal[typeName].Add(absenceName); } } } } return(retVal); }
public StudentAttendanceProcessor(DocumentBuilder builder, SemesterMap map) { builder.MoveToMergeField("缺曠"); _cell = builder.CurrentParagraph.ParentNode as Cell; _map = map; _run = new Run(_cell.Document); _run.Font.Name = builder.Font.Name; _run.Font.Size = builder.Font.Size; _run.Text = string.Empty; _types = new Dictionary <string, List <string> >(); #region 取得假別設定 ConfigData cd = K12.Data.School.Configuration["轉學成績證明書"]; if (cd.Contains("假別設定")) { XmlElement config = Framework.XmlHelper.LoadXml(cd["假別設定"]); foreach (XmlElement type in config.SelectNodes("Type")) { string typeName = type.GetAttribute("Text"); if (!_types.ContainsKey(typeName)) { _types.Add(typeName, new List <string>()); } foreach (XmlElement absence in type.SelectNodes("Absence")) { string absenceName = absence.GetAttribute("Text"); if (!_types[typeName].Contains(absenceName)) { _types[typeName].Add(absenceName); } } } } #endregion }
private void frmExportSchoolDomainScore_Load(object sender, EventArgs e) { // Init SchoolYear Semester { int schoolYear = int.Parse(School.DefaultSchoolYear); cbxSchoolYear.Items.Add(schoolYear - 1); cbxSchoolYear.Items.Add(schoolYear); cbxSchoolYear.Items.Add(schoolYear + 1); cbxSchoolYear.SelectedIndex = 1; int semester = int.Parse(School.DefaultSemester); cbxSemester.Items.Add(1); cbxSemester.Items.Add(2); cbxSemester.SelectedIndex = semester - 1; } cbxRange.Items.Add("補考前"); cbxRange.Items.Add("補考後"); cbxRange.SelectedIndex = 0; // 載入樣板 { Stream wbStream = new MemoryStream(Properties.Resources.SchoolDomainScore_template); wbTemplate = new Workbook(wbStream); } // 取得領域對照表 ConfigData cd = School.Configuration[ConfigName]; { if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string name = domainElement.GetAttribute("Name"); listDomain.Add(name); } } } }
public ExportStudentDomainScore(List <string> listIDs) { listStudentIDs = listIDs; ConfigData cd = School.Configuration[ConfigName]; { if (cd.Contains(ColumnKey)) { XmlElement element = cd.GetXml(ColumnKey, XmlHelper.LoadXml("<Domains/>")); foreach (XmlElement domainElement in element.SelectNodes("Domain")) { string name = domainElement.GetAttribute("Name"); listDomainName.Add(name); } } } // 讀取樣板 Stream stream = new MemoryStream(Properties.Resources.StudentDomainScore_template); docTemplat = new Document(stream); InitailizeBackGroundWorker(); }
/// <summary> /// /// </summary> /// <returns></returns> public static XmlDocument GetDataFormSystem() { School.Configuration.Sync("國中學生基本學力資料對照_HsinChu101"); ConfigData cd = School.Configuration["國中學生基本學力資料對照_HsinChu101"]; XmlDocument doc = new XmlDocument(); if (cd.Contains("XMLData")) { if (string.IsNullOrEmpty(cd["XMLData"])) { doc.LoadXml(Properties.Resources.StudentJSBT_conf); } else { doc.LoadXml(cd["XMLData"]); } } else { doc.LoadXml(Properties.Resources.StudentJSBT_conf); } return(doc); }
private string ExtendingConfigKey = "ExtendingReason10"; //紀錄中輟原因清單的組態值的Key //將中輟紀錄清單的key輸入至list cd中 public UpdateRecordInfo10(DAL.StudUpdateRecordEntity sure) { InitializeComponent(); Errors = new EnhancedErrorProvider(); // 設定男、女值與設定只能選不能修改 cboGender.Items.Add("男"); cboGender.Items.Add("女"); cboGender.DropDownStyle = ComboBoxStyle.DropDownList; cd = JHSchool.School.Configuration[updateConfigKey]; if (!cd.Contains(ExtendingConfigKey)) { cd[ExtendingConfigKey] = "因病;出國;其它"; cd.Save(); } string[] reasons = cd[ExtendingConfigKey].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); List <string> reasonList = new List <string>(reasons); foreach (string reason in reasons) { if (reason == "死亡") { continue; } this.cboUpdateDescription.Items.Add(reason); } foreach (string defaultreason in new string[] { "因病", "出國", "其它" }) { if (!reasonList.Contains(defaultreason)) { this.cboUpdateDescription.Items.Add(defaultreason); } } _StudUpdateRecordEntity = sure; SetUpdateRecordInfoToForm(); }
private void _BGWAbsenceAndPeriodList_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { pictureBox.Visible = false; DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn(); colName.HeaderText = "節次分類"; colName.MinimumWidth = 70; colName.Name = "colName"; colName.ReadOnly = true; colName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; colName.Width = 70; this.dgv.Columns.Add(colName); foreach (string absence in absenceList) { System.Windows.Forms.DataGridViewCheckBoxColumn newCol = new DataGridViewCheckBoxColumn(); newCol.HeaderText = absence; newCol.Width = 55; newCol.ReadOnly = false; newCol.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; newCol.Tag = absence; newCol.ValueType = typeof(bool); this.dgv.Columns.Add(newCol); } foreach (string type in typeList) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgv, type); row.Tag = type; dgv.Rows.Add(row); } #region 讀取列印設定 Preference ConfigData cd = K12.Data.School.Configuration[_preferenceElementName]; if (cd.Contains("假別設定")) { XmlElement config = Framework.XmlHelper.LoadXml(cd["假別設定"]); #region 已有設定檔則將設定檔內容填回畫面上 foreach (XmlElement type in config.SelectNodes("Type")) { string typeName = type.GetAttribute("Text"); foreach (DataGridViewRow row in dgv.Rows) { if (typeName == ("" + row.Tag)) { foreach (XmlElement absence in type.SelectNodes("Absence")) { string absenceName = absence.GetAttribute("Text"); foreach (DataGridViewCell cell in row.Cells) { if (cell.OwningColumn is DataGridViewCheckBoxColumn && ("" + cell.OwningColumn.Tag) == absenceName) { cell.Value = true; } } } break; } } } #endregion } #endregion }
public StudentMoralProcessor(DocumentBuilder builder, SemesterMap map) { _builder = builder; _map = map; _types = new Dictionary <string, List <string> >(); _run = WordHelper.CreateRun(_builder); #region 取得假別設定 ConfigData cd = K12.Data.School.Configuration["學籍表"]; if (cd.Contains("假別設定")) { XmlElement config = Framework.XmlHelper.LoadXml(cd["假別設定"]); foreach (XmlElement type in config.SelectNodes("Type")) { string typeName = type.GetAttribute("Text"); if (!_types.ContainsKey(typeName)) { _types.Add(typeName, new List <string>()); } foreach (XmlElement absence in type.SelectNodes("Absence")) { string absenceName = absence.GetAttribute("Text"); if (!_types[typeName].Contains(absenceName)) { _types[typeName].Add(absenceName); } } } } #endregion #region 取得社團成績 _assnScoreCache = new Dictionary <string, List <AssnScore> >(); FISCA.UDT.AccessHelper ah = new FISCA.UDT.AccessHelper(); // string condition = string.Format("SchoolYear='{0}' and Semester='{1}'", options.SchoolYear, options.Semester); // List<AssnCode> list = ah.Select<AssnCode>(condition); if (AssociationUDTCache == null) { AssociationUDTCache = ah.Select <AssnCode>(); } List <AssnCode> list = AssociationUDTCache; foreach (AssnCode record in list) { //if (!_assnScoreCache.ContainsKey(record.StudentID)) //{ XmlElement scores = K12.Data.XmlHelper.LoadXml(record.Scores); XmlElement itemElement = (XmlElement)scores.SelectSingleNode("Item"); if (itemElement != null) { AssnScore assnScore = new AssnScore() { Score = itemElement.GetAttribute("Score"), Effort = itemElement.GetAttribute("Effort"), Text = itemElement.GetAttribute("Text"), SchoolYear = record.SchoolYear, Semester = record.Semester }; if (_assnScoreCache.ContainsKey(record.StudentID)) { _assnScoreCache[record.StudentID].Add(assnScore); } else { List <AssnScore> lis = new List <AssnScore>(); lis.Add(assnScore); _assnScoreCache.Add(record.StudentID, lis); } } //} } //<Content> //<Item AssociationName="籃球社" Score="" Effort="" Text=""></Item> //</Content> #endregion }