public TagEditor(TagConfigRecord tag) { InitializeComponent(); _mode = ManageMode.Update; _current_tag = tag; }
public TagEditor(K12.Data.TagCategory category) { InitializeComponent(); _mode = ManageMode.Insert; _current_tag = new TagConfigRecord(); _current_tag.Category = category.ToString (); }
public CourseCodeTagHelper() { // 檢查課程Tag是否存在,如果不存在加入 if (GetCourseCodeTagID() == "") { // 使用 K12 Tag 新增 TagConfigRecord rec = new TagConfigRecord(); rec.Name = "課程"; rec.Prefix = "課程計畫"; CourseCodeTagID = TagConfig.Insert(rec); } }
static void _bgLLoadUDT_DoWork(object sender, DoWorkEventArgs e) { UDTTransfer.CreateUDTTable(); #region 自訂驗證規則 FactoryProvider.FieldFactory.Add(new FieldValidatorFactory()); #endregion #region 加入自動加入班級類別 List <string> nameList = new List <string> (); nameList.Add("普通班"); nameList.Add("體育班"); nameList.Add("美術班"); nameList.Add("音樂班"); nameList.Add("舞蹈班"); nameList.Add("資優班"); nameList.Add("資源班"); nameList.Add("特教班"); nameList.Add("技藝專班"); nameList.Add("機構式非學校自學班"); // 取得班級分類 List <TagConfigRecord> TagRecList = TagConfig.SelectByCategory(TagCategory.Class); List <TagConfigRecord> AddTagRecList = new List <TagConfigRecord>(); List <string> hasNameList = new List <string>(); foreach (TagConfigRecord rec in TagRecList) { if (rec.Prefix == "班級分類") { hasNameList.Add(rec.Name); } } // 檢查是否新增 foreach (string name in nameList) { if (!hasNameList.Contains(name)) { TagConfigRecord rec = new TagConfigRecord(); rec.Name = name; rec.Prefix = "班級分類"; rec.Category = "Class"; AddTagRecList.Add(rec); } } if (AddTagRecList.Count > 0) { TagConfig.Insert(AddTagRecList); } #endregion }
public override void InitializeImport(SmartSchool.API.PlugIn.Import.ImportWizard wizard) { Dictionary<string, TeacherRecord> Teachers = new Dictionary<string, TeacherRecord>(); Dictionary<string, List<TeacherTagRecord>> TeacherTagRecDic = new Dictionary<string, List<TeacherTagRecord>>(); Dictionary<string, Dictionary<string, string>> TeachTagNameDic = DATeacherTransfer.GetTeacherTagNameDic(); // 取得可加入學生 TagName wizard.PackageLimit = 3000; wizard.ImportableFields.AddRange(ImportItemList); wizard.ValidateStart += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateStartEventArgs e) { // 取得學生資料 foreach (TeacherRecord TeacherRec in Teacher.SelectByIDs(e.List)) if (!Teachers.ContainsKey(TeacherRec.ID)) { Teachers.Add(TeacherRec.ID, TeacherRec); TeacherTagRecDic.Add(TeacherRec.ID, new List<TeacherTagRecord>()); } // 取得學生類別 foreach (TeacherTagRecord teachTag in TeacherTag.SelectByTeacherIDs(Teachers.Keys)) { //if (!StudTagRecDic.ContainsKey(studTag.RefStudentID)) //{ // List<JHStudentTagRecord> rec = new List<JHStudentTagRecord> (); // rec.Add(studTag ); // StudTagRecDic.Add(studTag.RefStudentID,rec); //} //else if (TeacherTagRecDic.ContainsKey(teachTag.RefTeacherID)) TeacherTagRecDic[teachTag.RefTeacherID].Add(teachTag); } }; wizard.ValidateRow += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateRowEventArgs e) { int i = 0; // 檢查學生是否存在 TeacherRecord teachRec = null; if (Teachers.ContainsKey(e.Data.ID)) teachRec = Teachers[e.Data.ID]; else { e.ErrorMessage = "沒有這位老師" + e.Data.ID; return; } // 驗證資料 foreach (string field in e.SelectFields) { string value = e.Data[field].Trim(); // 驗證$無法匯入 if (value.IndexOf('$') > -1) { e.ErrorFields.Add(field, "儲存格有$無法匯入."); break; } if (field == "類別名稱") { if (string.IsNullOrEmpty(value)) { e.ErrorFields.Add(field, "不允許空白"); } } } }; wizard.ImportPackage += delegate(object sender, SmartSchool.API.PlugIn.Import.ImportPackageEventArgs e) { // 目前學生類別管理,沒有新增標示類別,有的就不更動跳過。 Dictionary<string, List<RowData>> id_Rows = new Dictionary<string, List<RowData>>(); foreach (RowData data in e.Items) { if (!id_Rows.ContainsKey(data.ID)) id_Rows.Add(data.ID, new List<RowData>()); id_Rows[data.ID].Add(data); } List<TeacherTagRecord> InsertList = new List<TeacherTagRecord>(); // List<JHStudentTagRecord> UpdateList = new List<JHStudentTagRecord>(); // 放需要新增的教師類別 Dictionary<string, List<string>> NeedAddPrefixName = new Dictionary<string, List<string>>(); // 檢查用 List List<string> CheckStudTagName = new List<string>(); foreach (KeyValuePair<string, Dictionary<string, string>> data in TeachTagNameDic) { foreach (KeyValuePair<string, string> data1 in data.Value) CheckStudTagName.Add(data.Key + data1.Key); } // 檢查類別是否已經存在 foreach (string id in id_Rows.Keys) { if (!TeacherTagRecDic.ContainsKey(id)) continue; foreach (RowData data in id_Rows[id]) { string strPrefix = string.Empty, strName = string.Empty; if (data.ContainsKey("群組")) strPrefix = data["群組"]; if (data.ContainsKey("類別名稱")) strName = data["類別名稱"]; string FullName = strPrefix + strName; // 需要新增的, if (!CheckStudTagName.Contains(FullName)) { CheckStudTagName.Add(FullName); if ((NeedAddPrefixName.ContainsKey(strPrefix))) NeedAddPrefixName[strPrefix].Add(strName); else { List<string> Names = new List<string>(); Names.Add(strName); NeedAddPrefixName.Add(strPrefix, Names); } } } } // 新增至學生類別管理 List<TagConfigRecord> Recs = new List<TagConfigRecord>(); foreach (KeyValuePair<string, List<string>> data in NeedAddPrefixName) { foreach (string data1 in data.Value) { TagConfigRecord rec = new TagConfigRecord(); rec.Category = "Teacher"; rec.Prefix = data.Key; rec.Name = data1; rec.Color = System.Drawing.Color.White; Recs.Add(rec); } } TagConfig.Insert(Recs); TeachTagNameDic.Clear(); // 重新取得 TeachTagNameDic = DATeacherTransfer.GetTeacherTagNameDic(); foreach (string id in id_Rows.Keys) { if (!TeacherTagRecDic.ContainsKey(id)) continue; foreach (RowData data in id_Rows[id]) { string strPrefix = string.Empty, strName = string.Empty; if (data.ContainsKey("群組")) strPrefix = data["群組"]; if (data.ContainsKey("類別名稱")) strName = data["類別名稱"]; // 欄位有在 Tag Prefix 內 bool isInsert = true; foreach (TeacherTagRecord rec in TeacherTagRecDic[id]) { if (rec.Prefix == strPrefix && rec.Name == strName) { isInsert = false; break; } } if (isInsert) { // 學生類別管理名稱對照 if (TeachTagNameDic.ContainsKey(strPrefix)) { if (TeachTagNameDic[strPrefix].ContainsKey(strName)) { TeacherTagRecord TeachTag = new TeacherTagRecord(); TeachTag.RefEntityID = id; TeachTag.RefTagID = TeachTagNameDic[strPrefix][strName]; InsertList.Add(TeachTag); } } } } } try { if (InsertList.Count > 0) Insert(InsertList); //if (UpdateList.Count > 0) // Update(UpdateList); Tagging.PermRecLogProcess prlp = new Tagging.PermRecLogProcess(); prlp.SaveLog("教師.匯入類別", "匯入教師類別", "共新增" + InsertList.Count + "筆資料"); K12.Data.Teacher.RemoveAll(); K12.Data.Teacher.SelectAll(); } catch (Exception ex) { } }; }
public static void main() { FISCA.Presentation.RibbonBarItem item1 = FISCA.Presentation.MotherForm.RibbonBarItems["教務作業", "資料統計"]; item1["報表"].Image = Properties.Resources.Report; item1["報表"].Size = FISCA.Presentation.RibbonBarButton.MenuButtonSize.Large; item1["報表"]["新生入學方式統計表"].Enable = Permissions.新生入學方式統計表權限; item1["報表"]["新生入學方式統計表"].Click += delegate { Form2 form = new Form2(); form.ShowDialog(); }; //權限設定 Catalog permission = RoleAclSource.Instance["教務作業"]["功能按鈕"]; permission.Add(new RibbonFeature(Permissions.新生入學方式統計表, "新生入學方式統計表")); //2017/2/8 穎驊註解,原本因應公務統計報表 "新生入學方式統計報表"項目 而新增提供的預設類別項目, //為了防止 所有使用本類別模組的學校(包含 沒有使用公務統計報表模組的學校) 一併被提供到預設定類別項目 //將下面的CODE 自MOD_Tagging模組 Tagging 專案 其 Program 移轉過來 //如此一來就只有 使用公務統計報表模組的學校會被新增類別項目 #region 加入預設的入學方式、入學身分、原住民類別 List <string> EnterSchoolWays = new List <string>(); List <string> EnterSchoolIdentities = new List <string>(); List <string> aboList = new List <string>(); List <string> aboList2 = new List <string>(); //九種入學方式 EnterSchoolWays.Add("免試入學--校內直升"); EnterSchoolWays.Add("免試入學--就學區免試(含共同就學區)"); EnterSchoolWays.Add("免試入學--技優甄審"); EnterSchoolWays.Add("免試入學--免試獨招"); EnterSchoolWays.Add("免試入學--其他"); EnterSchoolWays.Add("特色招生--考試分發"); EnterSchoolWays.Add("特色招生--甄選入學"); EnterSchoolWays.Add("適性輔導安置(十二年安置)"); EnterSchoolWays.Add("其他"); //四種入學身分 EnterSchoolIdentities.Add("一般生(非外加錄取)"); EnterSchoolIdentities.Add("外加錄取--原住民生"); EnterSchoolIdentities.Add("外加錄取--身心障礙生"); EnterSchoolIdentities.Add("外加錄取--其他"); //十七種 原住民身分 aboList.Add("阿美族"); aboList.Add("泰雅族"); aboList.Add("排灣族"); aboList.Add("布農族"); aboList.Add("卑南族"); aboList.Add("鄒(曹)族"); aboList.Add("魯凱族"); aboList.Add("賽夏族"); aboList.Add("雅美族或達悟族"); aboList.Add("卲族"); aboList.Add("噶瑪蘭族"); aboList.Add("太魯閣族(含 德魯固族)"); aboList.Add("撒奇萊雅族"); aboList.Add("賽德克族"); aboList.Add("拉阿魯哇族"); aboList.Add("卡那卡那富族"); aboList.Add("其他"); aboList2.Add("阿美族"); aboList2.Add("泰雅族"); aboList2.Add("排灣族"); aboList2.Add("布農族"); aboList2.Add("卑南族"); aboList2.Add("鄒(曹)族"); aboList2.Add("魯凱族"); aboList2.Add("賽夏族"); aboList2.Add("雅美族或達悟族"); aboList2.Add("卲族"); aboList2.Add("噶瑪蘭族"); aboList2.Add("太魯閣族(含 德魯固族)"); aboList2.Add("撒奇萊雅族"); aboList2.Add("賽德克族"); aboList2.Add("拉阿魯哇族"); aboList2.Add("卡那卡那富族"); aboList2.Add("其他"); // 若學校本來自己就有"原住民" Tag ,則以加入他的原住民項目 為主,幫他補齊。 bool Tag_Prefix原校內為原住民 = false; //排除已加入的名單,避免重覆insert會爆掉 foreach (TagConfigRecord each in TagConfig.SelectAll()) { if (each.Prefix == "入學方式") { if (EnterSchoolWays.Contains(each.Name)) { EnterSchoolWays.Remove(each.Name); } } if (each.Prefix == "入學身分") { if (EnterSchoolIdentities.Contains(each.Name)) { EnterSchoolIdentities.Remove(each.Name); } } if (each.Prefix == "原住民") { if (aboList.Contains(each.Name)) { aboList.Remove(each.Name); } Tag_Prefix原校內為原住民 = true; } if (each.Prefix == "原住民族別") { if (aboList.Contains(each.Name)) { aboList2.Remove(each.Name); } } } // 加入 入學方式 Tag foreach (string aboRaceName in EnterSchoolWays) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "入學方式"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } // 加入 入學身分 Tag foreach (string aboRaceName in EnterSchoolIdentities) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "入學身分"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } //加入 原住民Tag if (Tag_Prefix原校內為原住民) { foreach (string aboRaceName in aboList) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "原住民"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } } else { foreach (string aboRaceName in aboList2) { TagConfigRecord _current_tag; _current_tag = new TagConfigRecord(); _current_tag.Category = TagCategory.Student.ToString(); _current_tag.Prefix = "原住民族別"; _current_tag.Name = aboRaceName; _current_tag.Color = System.Drawing.Color.White; TagConfig.Insert(_current_tag); } } #endregion }
static void _bkWork_DoWork(object sender, DoWorkEventArgs e) { // 載入綜合表現題目檢查 //DAO.ABCardQuestionDataManager man = new DAO.ABCardQuestionDataManager(); //// 清空綜合表現題目 (Beta 用) //if(DAO.UDTTransfer.ABUDTQuestionsDataSelectAll().Count>0) // DAO.UDTTransfer.ABUDTQuestionsDataDeleteAll(); try { // 更新綜合紀錄表題目 DAO.UDTTransfer.CreateCounselUDTTable(); Utility.UpdateABQuestions(); // 更新 UDS UDT 方式 if (!FISCA.RTContext.IsDiagMode) FISCA.ServerModule.AutoManaged("http://module.ischool.com.tw:8080/module/137/CounselSystem_dep/udm.xml"); #region 自訂驗證規則 FactoryProvider.RowFactory.Add(new ValidationRule.CounselRowValidatorFactory()); #endregion // 檢查是否有樣板 List<DAO.UDT_ABCardTemplateDefinitionDef> ABCardTemplate = DAO.UDTTransfer.GetABCardTemplate(); // 沒有樣板時 if (ABCardTemplate.Count == 0) { List<DAO.UDT_ABCardTemplateDefinitionDef> insertUDT = new List<DAO.UDT_ABCardTemplateDefinitionDef>(); XElement elmRoot = XElement.Parse(Properties.Resources.ABCardTemplate); foreach (XElement elm in elmRoot.Elements("Subject")) { bool checkInsert = true; foreach (DAO.UDT_ABCardTemplateDefinitionDef rec in ABCardTemplate) if (rec.SubjectName.Trim() == elm.Attribute("label").Value.Trim()) checkInsert = false; if (checkInsert) { DAO.UDT_ABCardTemplateDefinitionDef abRec = new DAO.UDT_ABCardTemplateDefinitionDef(); abRec.SubjectName = elm.Attribute("label").Value.Trim(); abRec.Content = elm.ToString(); int i; if (int.TryParse(abRec.SubjectName.Substring(0, 1), out i)) abRec.Priority = i; insertUDT.Add(abRec); } } if (insertUDT.Count > 0) DAO.UDTTransfer.InsertABCardTemplate(insertUDT); } // 將樣板傳入 Global._ABCardTemplateTransfer.LoadAllTemplate(ABCardTemplate); // 檢查是否有輔導相關設定標籤,沒有自動加入:輔導:認輔老師,輔導:輔導主任,輔導:輔導老師, List<TagConfigRecord> tagList = TagConfig.SelectByCategoryAndPrefix(TagCategory.Teacher, "輔導"); List<string> pNameList = new List<string>(); pNameList.Add("認輔老師"); pNameList.Add("輔導主任"); pNameList.Add("輔導老師"); foreach (string str in pNameList) { bool chkeckAdd = true; foreach (TagConfigRecord tt in tagList) if (tt.Name == str && tt.Prefix == "輔導") chkeckAdd = false; if (chkeckAdd) { TagConfigRecord TaRec = new TagConfigRecord(); TaRec.Prefix = "輔導"; TaRec.Name = str; TaRec.Category = "Teacher"; TagConfig.Insert(TaRec); } } } catch (Exception ex) { Global._ErrorMessageList.AppendLine("載入輔導系統發生錯誤:"+ex.Message); } }
// 排序用 private int JHTagConfigRecordFullNameSorter(TagConfigRecord x, TagConfigRecord y) { return x.FullName.CompareTo(y.FullName); }
private void DoDelete(TagConfigRecord record) { int use_count = TagUseCount(record.ID); string msg; if (use_count > 0) msg = string.Format("目前有「{0}」個{1}使用此類別,您確定要刪除類別嗎?", use_count, EntityTitle); else msg = "您確定要刪除此類別嗎?"; if (FISCA.Presentation.Controls.MsgBox.Show(msg, MessageBoxButtons.YesNo) == DialogResult.Yes) { //PermRecLogProcess prlp = new PermRecLogProcess(); //prlp.SaveLog("學籍.類別管理", "類別管理刪除類別", "刪除 " + record.Category + " 類別,名稱:" + record.FullName); TagConfig.Delete(record); } }
private void btnConfirm_Click(object sender, EventArgs e) { try { DialogResult = DialogResult.None; _OldTagRec = new TagConfigRecord(); _OldTagRec.Prefix = _current_tag.Prefix; _OldTagRec.Name = _current_tag.Name; _OldTagRec.ColorCode = _current_tag.ColorCode; _current_tag.Prefix = cboGroups.Text.Trim(); _current_tag.Name = txtName.Text.Trim(); _current_tag.Color = cpColor.SelectedColor; if (string.IsNullOrEmpty(_current_tag.Name)) { FISCA.Presentation.Controls.MsgBox.Show("您必須輸入類別名稱。"); return; } foreach (TagConfigRecord each in TagConfig.SelectAll()) { if (each == _current_tag) continue; if(_mode == ManageMode.Insert ) if (_current_tag.FullName == each.FullName && _current_tag.Category.ToUpper() == each.Category.ToUpper()) { FISCA.Presentation.Controls.MsgBox.Show("名稱重覆,請選擇其他名稱。"); return; } } //PermRecLogProcess prlp = new PermRecLogProcess(); if (_mode == ManageMode.Insert) { // Log //prlp.SaveLog("學籍.類別管理", "類別管理新增類別", "新增 "+_current_tag.Category+" 類別,名稱:" + _current_tag.FullName); TagConfig.Insert(_current_tag); } else { // Log //bool checkEdit = false; //string strLogName = "更新 "+_current_tag.Category + " 類別,"; //if (_OldTagRec.FullName != _current_tag.FullName) //{ // strLogName += "名稱由「" + _OldTagRec.FullName + "」改為「" + _current_tag.FullName + "」,"; // checkEdit = true; //} //if (_OldTagRec.ColorCode != _current_tag.ColorCode) //{ // strLogName += "修改" + _current_tag.FullName + "顏色。"; // checkEdit = true; //} //if(checkEdit) // prlp.SaveLog("學籍.類別管理", "類別管理更新類別", strLogName); TagConfig.Update(_current_tag); } DialogResult = DialogResult.OK; } catch (Exception ex) { FISCA.Presentation.Controls.MsgBox.Show(ex.Message); DialogResult = DialogResult.None; } }
public static DialogResult ModifyTag(TagConfigRecord tag) { TagEditor editor = new TagEditor(tag); return editor.ShowDialog(); }
static void _bkWork_DoWork(object sender, DoWorkEventArgs e) { // 載入綜合表現題目檢查 //DAO.ABCardQuestionDataManager man = new DAO.ABCardQuestionDataManager(); try { // 檢查與清空綜合表現題目 (Beta 用,修正題目用 int cot = DAO.UDTTransfer.ABUDTQuestionsDataSelectAll().Count; if (cot < 80 || cot > 120) { DAO.UDTTransfer.ABUDTQuestionsDataDeleteAll(); } // 更新綜合紀錄表題目 DAO.UDTTransfer.CreateCounselUDTTable(); Utility.UpdateABQuestions(); // 更新 UDS UDT 方式 if (!FISCA.RTContext.IsDiagMode) { FISCA.ServerModule.AutoManaged("http://module.ischool.com.tw:8080/module/137/CounselSystem_dep/udm.xml"); } #region 自訂驗證規則 FactoryProvider.RowFactory.Add(new ValidationRule.CounselRowValidatorFactory()); #endregion //// 檢查是否有樣板 //List<DAO.UDT_ABCardTemplateDefinitionDef> ABCardTemplate = DAO.UDTTransfer.GetABCardTemplate(); //// 沒有樣板時 //if (ABCardTemplate.Count == 0) //{ // List<DAO.UDT_ABCardTemplateDefinitionDef> insertUDT = new List<DAO.UDT_ABCardTemplateDefinitionDef>(); // XElement elmRoot = XElement.Parse(Properties.Resources.ABCardTemplate); // foreach (XElement elm in elmRoot.Elements("Subject")) // { // bool checkInsert = true; // foreach (DAO.UDT_ABCardTemplateDefinitionDef rec in ABCardTemplate) // if (rec.SubjectName.Trim() == elm.Attribute("label").Value.Trim()) // checkInsert = false; // if (checkInsert) // { // DAO.UDT_ABCardTemplateDefinitionDef abRec = new DAO.UDT_ABCardTemplateDefinitionDef(); // abRec.SubjectName = elm.Attribute("label").Value.Trim(); // abRec.Content = elm.ToString(); // int i; // if (int.TryParse(abRec.SubjectName.Substring(0, 1), out i)) // abRec.Priority = i; // insertUDT.Add(abRec); // } // } // if (insertUDT.Count > 0) // DAO.UDTTransfer.InsertABCardTemplate(insertUDT); //} //// 將樣板傳入 //Global._ABCardTemplateTransfer.LoadAllTemplate(ABCardTemplate); // 檢查是否有輔導相關設定標籤,沒有自動加入:輔導:認輔老師,輔導:輔導主任,輔導:輔導老師, List <TagConfigRecord> tagList = TagConfig.SelectByCategoryAndPrefix(TagCategory.Teacher, "輔導"); List <string> pNameList = new List <string>(); pNameList.Add("認輔老師"); pNameList.Add("輔導主任"); pNameList.Add("輔導老師"); foreach (string str in pNameList) { bool chkeckAdd = true; foreach (TagConfigRecord tt in tagList) { if (tt.Name == str && tt.Prefix == "輔導") { chkeckAdd = false; } } if (chkeckAdd) { TagConfigRecord TaRec = new TagConfigRecord(); TaRec.Prefix = "輔導"; TaRec.Name = str; TaRec.Category = "Teacher"; TagConfig.Insert(TaRec); } } } catch (Exception ex) { Global._ErrorMessageList.AppendLine("載入輔導系統發生錯誤:" + ex.Message); } }//