/// <summary> /// 設定使用者介面 /// </summary> public void SetupPresentation() { if (_initialize) { return; } _assessmentSetupField.GetVariable += delegate(object sender, GetVariableEventArgs e) { AssessmentSetupRecord record = Course.Instance.Items[e.Key].GetAssessmentSetup(); if (record != null) { e.Value = record.Name; } else { e.Value = ""; } }; Course.Instance.AddListPaneField(_assessmentSetupField); K12.Data.Course.AfterChange += delegate(object s, K12.Data.DataChangedEventArgs arg) { Course.Instance.SyncDataBackground(arg.PrimaryKeys); }; Course.Instance.ItemUpdated += delegate(object s, ItemUpdatedEventArgs arg) { _assessmentSetupField.Reload(); }; AddAssignAssessmentSetupButtons(); _initialize = true; }
public static void Main() { _bgLLoadUDT.DoWork += _bgLLoadUDT_DoWork; _bgLLoadUDT.RunWorkerCompleted += _bgLLoadUDT_RunWorkerCompleted; _bgLLoadUDT.RunWorkerAsync(); Dictionary <string, UDT_HighConcern> _HighConcernDict = new Dictionary <string, UDT_HighConcern>(); _HighConcernDict = UDTTransfer.GetHighConcernDictAll(); ListPaneField HighConcernField = new ListPaneField("高關懷特殊身分"); HighConcernField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_HighConcernDict.ContainsKey(e.Key)) { e.Value = "是"; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(HighConcernField); ListPaneField HighCountField = new ListPaneField("高關懷減免人數"); HighCountField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_HighConcernDict.ContainsKey(e.Key)) { e.Value = _HighConcernDict[e.Key].NumberReduce; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(HighCountField); ListPaneField HighDocNoField = new ListPaneField("高關懷文號"); HighDocNoField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_HighConcernDict.ContainsKey(e.Key)) { e.Value = _HighConcernDict[e.Key].DocNo; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(HighDocNoField); // 當高關懷特殊身分有更新 FISCA.InteractionService.SubscribeEvent("KH_HighConcern_HighConcernContent", (sender, args) => { _HighConcernDict = UDTTransfer.GetHighConcernDictAll(); HighConcernField.Reload(); HighCountField.Reload(); HighDocNoField.Reload(); }); }
/// <summary> /// 處理學生資料 /// </summary> private static void ResStudentData() { Dictionary <string, StudentRecord_Ext> StudentExtDic = GetStudentExt(); Dictionary <string, string> StudentEnName = GetStudentExName(); #region 學生 暱稱&居留證號 ListPaneField StudentEnglishNameField = new ListPaneField("英文姓名"); StudentEnglishNameField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (StudentEnName.ContainsKey(e.Key)) { e.Value = StudentEnName[e.Key]; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(StudentEnglishNameField); ListPaneField StudentNicknameField = new ListPaneField("英文別名"); StudentNicknameField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (StudentExtDic.ContainsKey(e.Key)) { e.Value = StudentExtDic[e.Key].Nickname; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(StudentNicknameField); ListPaneField PassportNumberField = new ListPaneField("居留證號"); PassportNumberField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (StudentExtDic.ContainsKey(e.Key)) { e.Value = StudentExtDic[e.Key].PassportNumber; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(PassportNumberField); FISCA.InteractionService.SubscribeEvent("Res_StudentExt", (sender, args) => { //取得更新資料 StudentExtDic = GetStudentExt(); StudentEnName = GetStudentExName(); //重讀 StudentNicknameField.Reload(); PassportNumberField.Reload(); StudentEnglishNameField.Reload(); }); #endregion }
/// <summary> /// 處理教師資料 /// </summary> private static void ResTeacherData() { Dictionary <string, TeacherRecord_Ext> TeacherExtDic = GetTeacherExt(); ListPaneField TeacherCellPhoneField = new ListPaneField("行動電話"); TeacherCellPhoneField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (TeacherExtDic.ContainsKey(e.Key)) { e.Value = TeacherExtDic[e.Key].CellPhone; } }; K12.Presentation.NLDPanels.Teacher.AddListPaneField(TeacherCellPhoneField); FISCA.InteractionService.SubscribeEvent("Res_TeacherExt", (sender, args) => { TeacherExtDic = GetTeacherExt(); TeacherCellPhoneField.Reload(); }); }
/// <summary> /// 設定使用者介面 /// </summary> public void SetupPresentation() { if (_initialize) { return; } programPlanCache = new Dictionary <string, JHProgramPlanRecord>(); _classProgramPlanField.PreloadVariableBackground += delegate { foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll()) { if (!programPlanCache.ContainsKey(record.ID)) { programPlanCache.Add(record.ID, record); } } }; _classProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e) { JHProgramPlanRecord record = GetProgramPlan(JHClass.SelectByID(e.Key)); if (record != null) { e.Value = record.Name; } else { e.Value = ""; } }; K12.Presentation.NLDPanels.Class.AddListPaneField(_classProgramPlanField); _studentProgramPlanField.PreloadVariableBackground += delegate { foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll()) { if (!programPlanCache.ContainsKey(record.ID)) { programPlanCache.Add(record.ID, record); } } }; _studentProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e) { JHStudentRecord stu = JHStudent.SelectByID(e.Key); JHProgramPlanRecord record = GetProgramPlan(stu); if (record != null) { e.Value = string.IsNullOrEmpty(stu.OverrideProgramPlanID) ? record.Name : "(指定)" + record.Name; } else { e.Value = ""; } }; K12.Presentation.NLDPanels.Student.AddListPaneField(_studentProgramPlanField); JHClass.AfterUpdate += delegate { _classProgramPlanField.Reload(); }; JHStudent.AfterUpdate += delegate { _studentProgramPlanField.Reload(); }; AddAssignProgramPlanButtons(); _initialize = true; }
public static void Main() { _bgLLoadUDT.DoWork += _bgLLoadUDT_DoWork; _bgLLoadUDT.RunWorkerCompleted += _bgLLoadUDT_RunWorkerCompleted; _bgLLoadUDT.RunWorkerAsync(); Dictionary <string, UDT_ClassLock> _UDT_ClassLockDict = UDTTransfer.GetClassLockNameIDDict(); Dictionary <string, KH_HighConcernCalc.ClassStudent> _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); Catalog catalog01 = RoleAclSource.Instance["班級"]["功能按鈕"]; catalog01.Add(new RibbonFeature("KH_HighConcern_ClassLock", "班級鎖定/解鎖")); catalog01.Add(new RibbonFeature("KH_HighConcern_AllClassUnLock", "全部班級解鎖")); catalog01.Add(new RibbonFeature("KH_HighConcern_SendClassDataView", "檢視傳送局端備查紀錄")); ListPaneField ClassLockStudentCountField = new ListPaneField("編班人數"); ClassLockStudentCountField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_ClassStudentDict.ContainsKey(e.Key)) { if (_ClassStudentDict.ContainsKey(e.Key)) { e.Value = _ClassStudentDict[e.Key].ClassStudentCountStr; } } }; K12.Presentation.NLDPanels.Class.AddListPaneField(ClassLockStudentCountField); ListPaneField ClassLockField = new ListPaneField("班級鎖定"); ClassLockField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_UDT_ClassLockDict.ContainsKey(e.Key)) { // 當有鎖定再顯示 if (_UDT_ClassLockDict[e.Key].isLock) { if (_UDT_ClassLockDict[e.Key].UnAutoUnlock) { e.Value = "鎖定(不自動解鎖)"; } else { e.Value = "鎖定"; } } } }; K12.Presentation.NLDPanels.Class.AddListPaneField(ClassLockField); ListPaneField ClassLockCommentField = new ListPaneField("鎖定備註"); ClassLockCommentField.GetVariable += delegate(object sender, GetVariableEventArgs e) { // 只要有資料就顯示 if (_UDT_ClassLockDict.ContainsKey(e.Key)) { e.Value = _UDT_ClassLockDict[e.Key].Comment; } }; K12.Presentation.NLDPanels.Class.AddListPaneField(ClassLockCommentField); ListPaneField ClassLockSStudentCountField = new ListPaneField("特殊生人數"); ClassLockSStudentCountField.GetVariable += delegate(object sender, GetVariableEventArgs e) { if (_ClassStudentDict.ContainsKey(e.Key)) { if (_ClassStudentDict.ContainsKey(e.Key)) { e.Value = _ClassStudentDict[e.Key].ClassHStudentCount; } } }; K12.Presentation.NLDPanels.Class.AddListPaneField(ClassLockSStudentCountField); K12.Presentation.NLDPanels.Class.SelectedSourceChanged += delegate { // 檢查當有權限並只選一個班才可以使用 K12.Presentation.NLDPanels.Class.ListPaneContexMenu["班級鎖定/解鎖"].Enable = UserAcl.Current["KH_HighConcern_ClassLock"].Executable && (K12.Presentation.NLDPanels.Class.SelectedSource.Count == 1); }; //RibbonBarItem rbSendClassDataView = K12.Presentation.NLDPanels.Class.RibbonBarItems["其它"]; //rbSendClassDataView["檢視傳送局端備查紀錄"].Enable = UserAcl.Current["KH_HighConcern_SendClassDataView"].Executable; //rbSendClassDataView["檢視傳送局端備查紀錄"].Click += delegate //{ // SendDataView sdv = new SendDataView(); // sdv.ShowDialog(); //}; RibbonBarItem rbiDelAll = K12.Presentation.NLDPanels.Class.RibbonBarItems["其它"]; rbiDelAll["全部班級解鎖"].Enable = UserAcl.Current["KH_HighConcern_AllClassUnLock"].Executable; rbiDelAll["全部班級解鎖"].Click += delegate { MsgForm mf2 = new MsgForm(); mf2.Text = "全部班級解鎖"; mf2.SetMsg("將全部班級解鎖,按下「是」確認後,局端會留解鎖紀錄。"); //if (FISCA.Presentation.Controls.MsgBox.Show("將全部班級解鎖,按下「是」確認後,局端會留解鎖紀錄。", "全部班級解鎖", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) if (mf2.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { // 全部解鎖 UDTTransfer.UnlockAllClass(); // 紀錄班級名稱條件:不自動解鎖false,鎖定 true List <string> ClassNameList = (from data in _UDT_ClassLockDict.Values where data.UnAutoUnlock == false && data.isLock == true select data.ClassName).ToList(); foreach (UDT_ClassLock data in _UDT_ClassLockDict.Values) { if (data.UnAutoUnlock == false && data.isLock == true) { Utility.SendData(data.ClassName, "", "", "解除鎖定班級", data.DateStr, data.Comment, data.DocNo, data.EDoc, data.ClassID, "", ""); } } FISCA.Presentation.Controls.MsgBox.Show("全部班級解鎖"); // 重新整理 _UDT_ClassLockDict = UDTTransfer.GetClassLockNameIDDict(); ClassLockField.Reload(); ClassLockCommentField.Reload(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); } }; #region 步更新 // 當高關懷特殊身分有更新 FISCA.InteractionService.SubscribeEvent("KH_HighConcern_HighConcernContent", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); // 當變更學生狀態 FISCA.InteractionService.SubscribeEvent("KH_StudentChangeStatus", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); // 當變更學生班級 FISCA.InteractionService.SubscribeEvent("KH_StudentClassItemContent", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); // 當變更學生轉入 FISCA.InteractionService.SubscribeEvent("KH_StudentTransferStudentBriefItem", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); // 當變更學生匯入 FISCA.InteractionService.SubscribeEvent("KH_StudentImportWizard", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); // 當變更學生-轉入 FISCA.InteractionService.SubscribeEvent("KH_StudentTransStudBase", (sender, args) => { _ClassStudentDict = KH_HighConcernCalc.Calc.GetClassStudentAllIDDict(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); }); #endregion K12.Presentation.NLDPanels.Class.ListPaneContexMenu["班級鎖定/解鎖"].Click += delegate { string cid = K12.Presentation.NLDPanels.Class.SelectedSource[0]; // 檢查並取得班級鎖定 UDT_ClassLock data = UDTTransfer.GetClassLockByClassID(cid); K12.Data.ClassRecord classRec = K12.Data.Class.SelectByID(cid); List <JHClassTagRecord> recList = JHClassTag.SelectByClassID(cid); bool Class_Has_Standard_Category = false; string grYear = ""; string SecondPriorityClassName = "", ThridPriorityClassName = ""; if (classRec.GradeYear.HasValue) { grYear = classRec.GradeYear.Value.ToString(); } Dictionary <string, int> classCot = new Dictionary <string, int>(); List <KH_HighConcernCalc.ClassStudent> ClassStudentList = KH_HighConcernCalc.Calc.GetClassStudentList(grYear); int idx = 1; foreach (KH_HighConcernCalc.ClassStudent cs in ClassStudentList) { classCot.Add(cs.ClassName, cs.ClassStudentCount); if (idx == 2) // 第二順位 { SecondPriorityClassName = cs.ClassName; } if (idx == 3) // 第三順位 { ThridPriorityClassName = cs.ClassName; } idx++; } //穎驊新增, 用來檢查,此班級 是否有高雄定義的標準班級分類, 其定義了十種標準子類別在 KH_HighConcern專案 Program 下面程式碼, // 定義了普通班、體育班、美術班、音樂班、舞蹈班、資優班、資源班、特教班、技藝專班、機構式非學校自學班, //2016/12 高雄局端,希望在所有班級鎖班之前,都必須要有標準"班級分類",以利作業。 foreach (var rec in recList) { if (rec.Prefix == "班級分類") { Class_Has_Standard_Category = true; } } // 當已被鎖定,問是否解鎖 if (data.isLock) { MsgForm mf1 = new MsgForm(); mf1.Text = "班級解鎖"; mf1.SetMsg("「班級解鎖」,按下「是」確認後,局端會留解鎖紀錄。"); //if (FISCA.Presentation.Controls.MsgBox.Show("「班級解鎖」,按下「是」確認後,局端會留解鎖紀錄。", "班級解鎖", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) if (mf1.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { // 已被鎖定解鎖 data.isLock = false; data.UnAutoUnlock = false; string errMsg = Utility.SendData(classRec.Name, grYear, "", "解除鎖定班級", data.DateStr, data.Comment, data.DocNo, data.EDoc, data.ClassID, "", ""); if (errMsg != "") { FISCA.Presentation.Controls.MsgBox.Show(errMsg); } else { FISCA.Presentation.Controls.MsgBox.Show("已解鎖"); } // 解鎖清除鎖定備註 data.Comment = ""; } } else { if (Class_Has_Standard_Category) { // 未鎖定,問是否要鎖定 // 編班委員會會議日期 string strDate = ""; string strComment = ""; string strDocNo = ""; string strEDoc = ""; SendDataForm sdf = new SendDataForm(); if (sdf.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { strDate = sdf.GetSendDate(); strComment = sdf.GetComment(); strDocNo = sdf.GetDocNo(); strEDoc = sdf.GetEDoc(); MsgForm mf = new MsgForm(); mf.Text = "班級鎖定"; mf.SetMsg("「班級鎖定」,按下「是」確認後,除集中式特殊班級,餘需函報教育局並由局端線上審核。"); //if (FISCA.Presentation.Controls.MsgBox.Show("「班級鎖定」,按下「是」確認後,除集中式特殊班級,餘需函報教育局並由局端線上審核。", "班級鎖定", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) if (mf.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { // 寫入相對班級學生變動 int icid = int.Parse(cid); UDTTransfer.UpdateUDTClassSepcByClassID(icid, classRec.Name, data.Comment, strComment); data.ClassID = cid; data.ClassName = classRec.Name; data.Comment = strComment; data.DocNo = strDocNo; data.DateStr = strDate; data.EDoc = strEDoc; data.UnAutoUnlock = sdf.GetNUnLock(); data.isLock = true; string errMsg = Utility.SendData(classRec.Name, grYear, "", "鎖定班級", strDate, strComment, strDocNo, strEDoc, data.ClassID, SecondPriorityClassName, ThridPriorityClassName); // 傳送檔案到局端 Utility.UploadFile(data.ClassID, sdf.GetBase64DataString(), sdf.GetFileName()); if (errMsg != "") { FISCA.Presentation.Controls.MsgBox.Show(errMsg); } else { if (data.UnAutoUnlock) { FISCA.Presentation.Controls.MsgBox.Show("已鎖定(不自動解鎖)"); } else { FISCA.Presentation.Controls.MsgBox.Show("已鎖定"); } } } } } else { FISCA.Presentation.Controls.MsgBox.Show("鎖班前,請將本班級先加入'班級分類:'中任一類別", "警告", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); return; } } // 儲存 UDT if (data != null) { data.Save(); _UDT_ClassLockDict = UDTTransfer.GetClassLockNameIDDict(); ClassLockField.Reload(); ClassLockCommentField.Reload(); ClassLockStudentCountField.Reload(); ClassLockSStudentCountField.Reload(); } }; }
private TCInstruct() { ItemLoaded += delegate { #region 重建課程及學生修課反查表 _course_teachers.Clear(); _teacher_courses.Clear(); foreach (var item in Items) { if (!_course_teachers.ContainsKey(item.RefCourseID)) { _course_teachers.Add(item.RefCourseID, new List <string>()); } if (!_teacher_courses.ContainsKey(item.RefTeacherID)) { _teacher_courses.Add(item.RefTeacherID, new List <string>()); } _teacher_courses[item.RefTeacherID].Add(item.ID); _course_teachers[item.RefCourseID].Add(item.ID); } #endregion teacherField.Reload(); }; ItemUpdated += delegate(object sender, ItemUpdatedEventArgs e) { #region 更新(課成)及(教師)修課反查表 List <string> keys = new List <string>(e.PrimaryKeys); keys.Sort(); //排序後的資料才可以進行 BinarySearch。 #region 掃描每一個(課程)的(所有授課教師)是否有在(e.PrimaryKeys)中出現。 foreach (var cid in _course_teachers.Keys) { List <string> removeItems = new List <string>(); foreach (var eachInstruct in _course_teachers[cid]) { if (keys.BinarySearch(eachInstruct) >= 0) { removeItems.Add(eachInstruct); } } foreach (var eachInstruct in removeItems) { _course_teachers[cid].Remove(eachInstruct); } } #endregion #region 掃描每一個(教師)的(所有課程)是否有在(e.PrimaryKeys)中出現。 foreach (var cid in _teacher_courses.Keys) { List <string> removeItems = new List <string>(); foreach (var eachInstruct in _teacher_courses[cid]) { if (keys.BinarySearch(eachInstruct) >= 0) { removeItems.Add(eachInstruct); } } foreach (var item in removeItems) { _teacher_courses[cid].Remove(item); } } #endregion #region 將新資料加入到原有的集合中。 foreach (var key in e.PrimaryKeys) { var item = Items[key]; if (item != null) { if (!_course_teachers.ContainsKey(item.RefCourseID)) { _course_teachers.Add(item.RefCourseID, new List <string>()); } if (!_teacher_courses.ContainsKey(item.RefTeacherID)) { _teacher_courses.Add(item.RefTeacherID, new List <string>()); } _course_teachers[item.RefCourseID].Add(item.ID); _teacher_courses[item.RefTeacherID].Add(item.ID); } } #endregion teacherField.Reload(); #endregion }; }