示例#1
0
        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);
            }
        }
示例#2
0
        private void initUI()
        {
            this.pnlQArea.Controls.Clear();

            UDT_ABCardTemplateDefinitionDef subject_template = (UDT_ABCardTemplateDefinitionDef)this.comboBoxEx1.SelectedItem;

            this.currentTemplate = subject_template;

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(subject_template.Content);
            this.subjUim = new Counsel_System.UI.SubjectUIMaker(xmlDoc.DocumentElement, this.pnlQArea);
            this.subjUim.OnContentChange += new SubjectUIMaker.ContentChange(subjUim_OnContentChange);
            this.subjUim.ResetContent();
            this.panel1.Height = this.pnlQArea.Height;
            this.Height = this.panel1.Height + 50;
        }