/// <summary>
        ///
        /// </summary>
        /// <param name="courseInfo">課程資訊</param>
        /// <param name="mTypecourseInfos"></param>
        public GraduationPlanInfo(CourseInfo courseInfo)
        {
            this.GraduationName     = courseInfo.GetCurriiculumMapName();
            this.EntryYear          = courseInfo.EnterYear;
            this.CourseType         = courseInfo.CourseType;
            this.GraduationPlanKey  = courseInfo.GraduationPlanCode;
            this.CourseInfos        = new Dictionary <string, CourseInfo>();
            this.GraduationPlanKeys = new List <string>();
            this.ListCourseInfos    = new List <CourseInfo>();

            // this.MTypeGrade1CourseInfo = mTypecourseInfos;
            // this.ListCourseInfos.AddRange( courseInfos);
            this.GetGraduationPlanCode(); // 取的PlanCode
            this.DicOldGraduationPlanInfos = new Dictionary <string, OldGraduationPlanInfo>();
        }
Esempio n. 2
0
        /// <summary>
        /// 裝異動資料
        /// </summary>
        /// <param name="id"></param>
        /// <param name="newCourseInfo"></param>
        public UpdateCourseInfo(string id, CourseInfo newCourseInfo)
        {
            this.GPlanSysID    = id;
            this.NewCourseInfo = newCourseInfo;
            this.UpdateTargets = new List <string>();
            this.ErrorList     = new List <string>();

            if (newCourseInfo.Action == EnumAction.修改)
            {
                this.OldSubjectCode = newCourseInfo.OrginCourseCodeFromMOE;
                this.OldSujectName  = newCourseInfo.OrginSubjectName;
                this.NewSubjectCode = newCourseInfo.新課程代碼;
                this.NewSubjectName = newCourseInfo.NewSubjectName;
                this.新_授課學期學分       = newCourseInfo.授課學期學分;

                // todo  判斷 科目代碼 及 科目皆無修改

                // 如果 科目代碼 及科目名稱皆無修改
                if (newCourseInfo.OrginCourseCodeFromMOE == newCourseInfo.新課程代碼 && (newCourseInfo.OrginSubjectName == newCourseInfo.NewSubjectName))
                {
                    newCourseInfo.Action = EnumAction.修改;
                    this.新_授課學期學分        = newCourseInfo.授課學期學分;
                    this.NewSubjectCode  = newCourseInfo.OrginCourseCodeFromMOE;
                }
                else if (newCourseInfo.OrginCourseCodeFromMOE == "" && newCourseInfo.OrginSubjectName == "")
                {
                    this.新_授課學期學分       = newCourseInfo.授課學期學分;
                    this.OldSubjectCode = newCourseInfo.新課程代碼;
                    this.OldSujectName  = newCourseInfo.NewSubjectName;
                }
            }
            else if (newCourseInfo.Action == EnumAction.新增)
            {
                this.NewSubjectCode = newCourseInfo.新課程代碼;
                this.NewSubjectName = newCourseInfo.NewSubjectName;
                this.新_授課學期學分       = newCourseInfo.授課學期學分;
            }
            else if (newCourseInfo.Action == EnumAction.刪除)
            {
                this.NewSubjectCode = newCourseInfo.新課程代碼;
                this.OldSujectName  = newCourseInfo.NewSubjectName;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 產生 更新的 targetlist
        /// </summary>
        /// <param name="oldXmlElement"></param>
        public void GenerateUpdateTarget(XmlElement oldXmlElement, CourseInfo courseInfo) // 第一筆
        {
            // 1.比較實際差異  (與級別和學分相關的不比對)

            /*
             * <Subject
             *
             * =""
             * Credit="4"  ==> 差異比對時不會更新
             * Domain="數學"
             * Entry="學業"
             * GradeYear="1"  ==> 差異比對時不會更新
             * Level="1"  ==> 差異比對時不會更新
             * FullName="數學 I"
             * NotIncludedInCalc="False"  => 不影響
             * NotIncludedInCredit="False" => 不影響
             * Required="必修"
             * RequiredBy="部訂"
             * Semester="1"
             * SubjectName="數學"
             * 課程代碼="108070406M1119601010203"
             * 課程類別="部定必修"
             * 開課方式="原班級"
             * 科目屬性="一般科目"
             * 領域名稱="數學"
             * 課程名稱="數學"  ==>  與前面藍未重複 (subjectName) 可以廢除
             * 學分="4"   ==> 與前面欄位重複(Credit) 可以廢除
             * >   差異比對時不會更新
             * 授課學期學分 ⇒ 本次增加
             * <Grouping RowIndex="3" startLevel="1" />
             * </Subject>
             */


            if (oldXmlElement == null)
            {
                ErrorList.Add($"{courseInfo.OrginCourseCodeFromMOE} 系統內找不到對應 ");
                return;
            }


            // 1. 領域
            this.CollectIfDifferent("領域", oldXmlElement.GetAttribute("Domain"), courseInfo.領域名稱);
            // todo
            // 2. 課程全名 (課成全名 因需比對 對應之level 需全部下去跑 ) 所以這邊邏輯為科目名稱有改 及代表 課程全名也會變更 但是更新時會較為複雜 還是要補寫邏輯
            this.CollectIfDifferent("課程全名", oldXmlElement.GetAttribute("SubjectName"), courseInfo.NewSubjectName);
            // 3. 必修選修
            this.CollectIfDifferent("必修選修", oldXmlElement.GetAttribute("Required"), courseInfo.Required);
            // 4. 校定部定
            this.CollectIfDifferent("校定部定", oldXmlElement.GetAttribute("RequiredBy"), courseInfo.RequiredBy);
            // 5. 科目名稱
            this.CollectIfDifferent("科目名稱", oldXmlElement.GetAttribute("SubjectName"), courseInfo.NewSubjectName);
            // 6. 課程代碼
            this.CollectIfDifferent("課程代碼(課程計畫平台)", oldXmlElement.GetAttribute("課程代碼"), courseInfo.新課程代碼);
            // 課程類別
            this.CollectIfDifferent("課程類別(課程計畫平台)", oldXmlElement.GetAttribute("課程類別"), courseInfo.課程類別說明);
            // 7. 開課方式
            this.CollectIfDifferent("開課方式(課程計畫平台)", oldXmlElement.GetAttribute("開課方式"), courseInfo.開課方式);
            // 8. 科目屬性
            this.CollectIfDifferent("科目屬性(課程計畫平台)", oldXmlElement.GetAttribute("科目屬性"), courseInfo.科目屬性說明);
            // 9.領域名稱
            this.CollectIfDifferent("領域名稱(課程計畫平台)", oldXmlElement.GetAttribute("領域名稱"), courseInfo.領域名稱);
            // 10
            //if (oldXmlElement.HasAttribute("授課學期學分"))
            //{
            //    this.CollectIfDifferent("授課學期學分代碼", oldXmlElement.GetAttribute("授課學期學分"), courseInfo.授課學期學分);
            //}
            //else
            //{
            //    this.CollectIfDifferent("授課學期學分代碼", "", courseInfo.授課學期學分);
            //}
        }
 /// <summary>
 ///  加入課程
 /// </summary>
 /// <param name="courseInfo"></param>
 public void AddCourseInfo(CourseInfo courseInfo)
 {
     this.ListCourseInfos.Add(courseInfo);
 }
Esempio n. 5
0
        /// <summary>
        /// 把資料整理加入
        /// </summary>
        /// <param name="courseInfo"></param>
        public void AddUpdateInfo(CourseInfo courseInfo)
        {
            #region 檢查授課學期學分

            if (courseInfo.Action == EnumAction.刪除)
            {
                UpdateCourseInfo oldCourseInfo = new UpdateCourseInfo(this.SysID, courseInfo);
                this.DeleteCourseInfos.Add(oldCourseInfo);
            }
            else
            {
                string     CourseCodeFromMOE = courseInfo.OrginCourseCodeFromMOE != "" ? courseInfo.OrginCourseCodeFromMOE : courseInfo.新課程代碼;
                XmlElement ele = (XmlElement)this.OldContentXml.SelectSingleNode($"/GraduationPlan/Subject[@課程代碼='{CourseCodeFromMOE}']");
                if (ele != null)
                {
                    if (((ele.SelectSingleNode("@授課學期學分")) == null ? "" : (ele.SelectSingleNode("@授課學期學分")).Value.ToString()) != courseInfo.授課學期學分)
                    {
                        try
                        {
                            courseInfo.Action = EnumAction.修改;
                            UpdateCourseInfo oldCourseInfo = new UpdateCourseInfo(this.SysID, courseInfo);
                            oldCourseInfo.CollectIfDifferent("授課學期學分代碼");
                            oldCourseInfo.GenerateUpdateTarget(this.GetOneXmlElementBySubjectCode(oldCourseInfo.OldSubjectCode), courseInfo); // 取得更新之欄位
                            this.UpdateCourseInfos.Add(oldCourseInfo);
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                #endregion
                if (courseInfo.Action == EnumAction.修改)
                {
                    try
                    {
                        UpdateCourseInfo oldCourseInfo;
                        if (this.UpdateCourseInfos.Any(x => x.OldSubjectCode == courseInfo.OrginCourseCodeFromMOE))
                        {
                            oldCourseInfo = GetUpdateCourseInfos(courseInfo.OrginCourseCodeFromMOE);
                        }
                        else
                        {
                            oldCourseInfo = new UpdateCourseInfo(this.SysID, courseInfo);
                            oldCourseInfo.GenerateUpdateTarget(this.GetOneXmlElementBySubjectCode(oldCourseInfo.OldSubjectCode), courseInfo); // 取得更新之欄位
                            this.UpdateCourseInfos.Add(oldCourseInfo);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (courseInfo.Action == EnumAction.新增)
                {
                    if (this.IsContainSubjectCode(courseInfo.新課程代碼)) // 如果舊有課程規劃表 已經有本課程 => Action 調整為 "未調整"
                    {
                        courseInfo.Action = EnumAction.未調整;
                    }
                    else // 不包含課程規劃表
                    {
                        UpdateCourseInfo oldCourseInfo = new UpdateCourseInfo(this.SysID, courseInfo);
                        this.InsertCourseInfos.Add(oldCourseInfo);
                    }
                }
            }
        }