private void btnQuery_Click(object sender, EventArgs e) { if (FISCA.Authentication.DSAServices.PassportToken == null) { FISCA.Presentation.Controls.MsgBox.Show("Greening Passport 認證失敗,請檢查登入帳號!"); } else { if (lvSchool.CheckedItems.Count > 0) { _SelectSchoolList.Clear(); foreach (ListViewItem lvi in lvSchool.CheckedItems) { _SelectSchoolList.Add(lvi.Text); } btnQuery.Enabled = false; cd["SelectSchool"] = string.Join(",", _SelectSchoolList.ToArray()); cd.Save(); _bgWorker.RunWorkerAsync(); } else { FISCA.Presentation.Controls.MsgBox.Show("請勾選學校."); } } }
private void buttonX1_Click(object sender, EventArgs e) { XmlElement config = new XmlDocument().CreateElement("TypeList"); foreach (DataGridViewRow row in dataGridViewX1.Rows) { foreach (DataGridViewCell cell in row.Cells) { if (cell.Value != null) { bool value = false; if (bool.TryParse(cell.Value.ToString(), out value)) { if (value) { XmlElement type = config.OwnerDocument.CreateElement("Type"); type.SetAttribute("Text", cell.OwningRow.Tag.ToString()); type.SetAttribute("Value", cell.OwningColumn.Tag.ToString()); config.AppendChild(type); } } } } } config.OwnerDocument.AppendChild(config); cd[name] = config.OuterXml; cd.Save(); MessageBox.Show("設定已儲存"); this.Close(); }
private void buttonX1_Click(object sender, EventArgs e) { int x = comboBoxEx1.SelectedIndex; cd["紙張設定"] = x.ToString(); cd.Save(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { //畫面檢查 if (!CheckColumnNumber()) { return; } #region 儲存 XmlElement config = new XmlDocument().CreateElement("AbsenceList"); foreach (XmlElement var in config.SelectNodes("Type")) { config.RemoveChild(var); } foreach (DataGridViewRow row in dataGridViewX1.Rows) { bool needToAppend = false; XmlElement type = config.OwnerDocument.CreateElement("Type"); type.SetAttribute("Text", "" + row.Tag); foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex == 0) { continue; } XmlElement absence = config.OwnerDocument.CreateElement("Absence"); absence.SetAttribute("Text", "" + cell.OwningColumn.Tag); bool te = false; if (bool.TryParse("" + cell.Value, out te)) { if (te) { needToAppend = true; type.AppendChild(absence); } } } if (needToAppend) { config.AppendChild(type); } } cd[name] = config.OuterXml; cd.Save(); #endregion this.Close(); }
private void btnQuery_Click(object sender, EventArgs e) { if (FISCA.Authentication.DSAServices.PassportToken == null) { FISCA.Presentation.Controls.MsgBox.Show("Greening Passport 認證失敗,請檢查登入帳號!"); } else { _ClassComment = txtClassComment.Text; _OldClassComment = txtOldClassComment.Text; _ClassName = txtClassName.Text; _OldClassName = txtOldClassName.Text; _chkOp1 = chkOp1.Checked; _chkOp2 = chkOp2.Checked; cd["ClassComment"] = _ClassComment; cd["ClassComment"] = _ClassComment; cd["OldClassComment"] = _OldClassComment; cd["ClassName"] = _ClassName; cd["OldClassName"] = _OldClassName; cd["chkOp1"] = chkOp1.Checked.ToString(); cd["chkOp2"] = chkOp2.Checked.ToString(); if (lvSchool.CheckedItems.Count > 0) { _SelectSchoolList.Clear(); foreach (ListViewItem lvi in lvSchool.CheckedItems) { _SelectSchoolList.Add(lvi.Text); } btnExport.Enabled = btnQuery.Enabled = false; dgData.Rows.Clear(); // 儲存畫面值 cd["SelectSchool"] = string.Join(",", _SelectSchoolList.ToArray()); cd.Save(); _bgWorker.RunWorkerAsync(); } else { FISCA.Presentation.Controls.MsgBox.Show("請勾選學校."); } } }
private void _bgWorker_DoWork(object sender, DoWorkEventArgs e) { //儲存查詢資料 cd["DefSchoolYear"] = defSchoolYear; cd["DefSemester"] = defSemester; cd.Save(); //選擇的學校 List <string> schoolIDList = (List <string>)e.Argument; List <School> schoolList = tool._a.Select <School>(schoolIDList); List <SchoolClubRecord> SUMRecordList = new List <SchoolClubRecord>(); int schoolCount = 0; _bgWorker.ReportProgress(schoolCount, "開始取得資料"); foreach (School school in schoolList) { SchoolClubRecord schoolClub = NowConnSchool(school); if (schoolClub != null) { schoolClub.SchoolYear = defSchoolYear; schoolClub.Semester = defSemester; SUMRecordList.Add(schoolClub); } if (schoolCount <= 100) { schoolCount++; _bgWorker.ReportProgress(schoolCount, "取得資料中"); } } _bgWorker.ReportProgress(schoolCount, "完成"); e.Result = SUMRecordList; }
/// <summary> /// 按下「儲存」時觸發。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cboExamList.Text)) { FISCA.Presentation.Controls.MsgBox.Show("沒有試別無法儲存."); return; } dgv.EndEdit(); if (!IsValid()) { MsgBox.Show("請先修正錯誤再儲存。"); return; } try { //List<SCETakeRecordEditor> editors = MakeSCETakeRecordEditors(); //if (editors.Count > 0) editors.SaveAll(); bool checkLoadSave = false; RecordIUDLists lists = GetRecords(); // 檢查超過 0~100 if (lists.DeleteList.Count > 0) { foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.DeleteList) { if (sc.AssignmentScore.HasValue) { if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100) { checkLoadSave = true; } } if (sc.Score.HasValue) { if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100) { checkLoadSave = true; } } } } if (lists.InsertList.Count > 0) { foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.InsertList) { if (sc.AssignmentScore.HasValue) { if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100) { checkLoadSave = true; } } if (sc.Score.HasValue) { if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100) { checkLoadSave = true; } } } } if (lists.UpdateList.Count > 0) { foreach (HsinChu.JHEvaluation.Data.HC.JHSCETakeRecord sc in lists.UpdateList) { if (sc.AssignmentScore.HasValue) { if ((sc.AssignmentScore < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.AssignmentScore.Value)) || sc.AssignmentScore > 100) { checkLoadSave = true; } } if (sc.Score.HasValue) { if ((sc.Score < 0 && !PluginMain.ScoreValueMap.ContainsKey(sc.Score.Value)) || sc.Score > 100) { checkLoadSave = true; } } } } if (checkLoadSave) { CheckSaveForm csf = new CheckSaveForm(); csf.ShowDialog(); if (csf.DialogResult == DialogResult.Cancel) { return; } } if (lists.InsertList.Count > 0) { JHSchool.Data.JHSCETake.Insert(lists.InsertList.AsJHSCETakeRecords()); } if (lists.UpdateList.Count > 0) { JHSchool.Data.JHSCETake.Update(lists.UpdateList.AsJHSCETakeRecords()); } if (lists.DeleteList.Count > 0) { JHSchool.Data.JHSCETake.Delete(lists.DeleteList.AsJHSCETakeRecords()); } //記憶所選的試別 Campus.Configuration.ConfigData cd = Campus.Configuration.Config.User["新竹課程成績輸入考試別"]; cd["新竹課程成績輸入考試別"] = cboExamList.Text; cd.Save(); MsgBox.Show("儲存成功。"); // 記修改後 log SetSaveDataToLog(); // 存 Log prlp.SetActionBy("課程", "課程成績輸入"); prlp.SetAction("課程成績輸入"); prlp.SetDescTitle(""); prlp.SaveLog("", "", "Course", _course.ID); // 重新記修改前 Log SetLoadDataToLog(); ExamComboBoxItem item = cboExamList.SelectedItem as ExamComboBoxItem; GetScoresAndFill(item.AEIncludeRecord); } catch (Exception ex) { MsgBox.Show("儲存失敗。\n" + ex.Message); //throw ex; } // // 載入分數顏色 LoadDvScoreColor(); }