public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            SmartSchool.API.PlugIn.VirtualCheckBox filterRepeat = new SmartSchool.API.PlugIn.VirtualCheckBox("自動略過重讀成績", true);
            wizard.Options.Add(filterRepeat);
            wizard.ExportableFields.AddRange("學年度", "成績年級", "科目", "學年成績", "結算成績", "補考成績", "重修成績");
            AccessHelper _AccessHelper = new AccessHelper();

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                List <StudentRecord> students = _AccessHelper.StudentHelper.GetStudents(e.List);
                _AccessHelper.StudentHelper.FillSchoolYearSubjectScore(filterRepeat.Checked, students);
                foreach (StudentRecord stu in students)
                {
                    foreach (SchoolYearSubjectScoreInfo var in stu.SchoolYearSubjectScoreList)
                    {
                        RowData row = new RowData();
                        row.ID = stu.StudentID;
                        foreach (string field in e.ExportFields)
                        {
                            if (wizard.ExportableFields.Contains(field))
                            {
                                switch (field)
                                {
                                case "學年度": row.Add(field, "" + var.SchoolYear); break;

                                case "成績年級": row.Add(field, "" + var.GradeYear); break;

                                case "科目": row.Add(field, var.Subject); break;

                                case "學年成績": row.Add(field, "" + var.Score); break;

                                case "結算成績": row.Add(field, var.Detail.GetAttribute(field) == "" ? ("" + var.Score) : var.Detail.GetAttribute(field)); break;

                                case "補考成績": row.Add(field, var.Detail.GetAttribute(field)); break;

                                case "重修成績": row.Add(field, var.Detail.GetAttribute(field)); break;
                                }
                            }
                        }
                        e.Items.Add(row);
                    }
                }
            };
        }
Beispiel #2
0
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            SmartSchool.API.PlugIn.VirtualCheckBox filterRepeat = new SmartSchool.API.PlugIn.VirtualCheckBox("自動略過重讀成績", true);
            wizard.Options.Add(filterRepeat);
            // 2022-01 Cynthia 移除"體育", "國防通識", "健康與護理",
            wizard.ExportableFields.AddRange("學年度", "成績年級", "學業", "實習科目", "專業科目", "德行");
            AccessHelper _AccessHelper = new AccessHelper();

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                List <StudentRecord> students = _AccessHelper.StudentHelper.GetStudents(e.List);
                _AccessHelper.StudentHelper.FillSchoolYearEntryScore(filterRepeat.Checked, students);
                foreach (StudentRecord stu in students)
                {
                    Dictionary <int, List <SchoolYearEntryScoreInfo> > schoolYearEntryScoreList = new Dictionary <int, List <SchoolYearEntryScoreInfo> >();
                    foreach (SchoolYearEntryScoreInfo var in stu.SchoolYearEntryScoreList)
                    {
                        if (!schoolYearEntryScoreList.ContainsKey(var.SchoolYear))
                        {
                            schoolYearEntryScoreList.Add(var.SchoolYear, new List <SchoolYearEntryScoreInfo>());
                        }
                        schoolYearEntryScoreList[var.SchoolYear].Add(var);
                    }
                    foreach (int sy in schoolYearEntryScoreList.Keys)
                    {
                        RowData row = new RowData();
                        row.ID = stu.StudentID;
                        row.Add("學年度", "" + sy);
                        foreach (SchoolYearEntryScoreInfo var in schoolYearEntryScoreList[sy])
                        {
                            if (!row.ContainsKey("成績年級"))
                            {
                                row.Add("成績年級", "" + var.GradeYear);
                            }
                            if (e.ExportFields.Contains(var.Entry))
                            {
                                row.Add(var.Entry, "" + var.Score);
                            }
                        }
                        e.Items.Add(row);
                    }
                }
            };
        }
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            SmartSchool.API.PlugIn.VirtualCheckBox filterRepeat = new SmartSchool.API.PlugIn.VirtualCheckBox("自動略過重讀成績", true);
            wizard.Options.Add(filterRepeat);

            // 2018/8 穎驊註解,經過討論後, 先暫時將 ischool類別2 排名的概念拿掉,因為目前的結構 無法區隔類別1、類別2,待日後設計完整
            //wizard.ExportableFields.AddRange("學年度", "學期", "成績年級", "學業", "體育", "國防通識", "健康與護理", "實習科目", "專業科目", "學業(原始)", "體育(原始)", "國防通識(原始)", "健康與護理(原始)", "實習科目(原始)", "專業科目(原始)", "德行", "學業成績班排名", "學業成績班排名母數", "學業成績科排名", "學業成績科排名母數", "學業成績校排名", "學業成績校排名母數", "學業成績排名類別1", "學業成績類1排名", "學業成績類1排名母數", "學業成績排名類別2", "學業成績類2排名", "學業成績類2排名母數");

            wizard.ExportableFields.AddRange("學年度", "學期", "成績年級", "學業", "體育", "國防通識", "健康與護理", "實習科目", "專業科目", "學業(原始)", "體育(原始)", "國防通識(原始)", "健康與護理(原始)", "實習科目(原始)", "專業科目(原始)", "德行", "學業成績班排名", "學業成績班排名母數", "學業成績科排名", "學業成績科排名母數", "學業成績校排名", "學業成績校排名母數", "學業成績排名類別1", "學業成績類1排名", "學業成績類1排名母數");
            AccessHelper _AccessHelper = new AccessHelper();

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                List <StudentRecord> students = _AccessHelper.StudentHelper.GetStudents(e.List);



                Dictionary <string, List <StudSemsEntryRating> > StudSemsEntryRatingDict = new Dictionary <string, List <StudSemsEntryRating> >();
                StudSemsEntryRatingDict = Utility.GetStudSemsEntryRatingByStudentID(e.List);

                _AccessHelper.StudentHelper.FillSemesterEntryScore(filterRepeat.Checked, students);
                foreach (StudentRecord stu in students)
                {
                    Dictionary <int, Dictionary <int, List <SemesterEntryScoreInfo> > > semesterEntryScoreList = new Dictionary <int, Dictionary <int, List <SemesterEntryScoreInfo> > >();
                    foreach (SemesterEntryScoreInfo var in stu.SemesterEntryScoreList)
                    {
                        if (!semesterEntryScoreList.ContainsKey(var.SchoolYear))
                        {
                            semesterEntryScoreList.Add(var.SchoolYear, new Dictionary <int, List <SemesterEntryScoreInfo> >());
                        }
                        if (!semesterEntryScoreList[var.SchoolYear].ContainsKey(var.Semester))
                        {
                            semesterEntryScoreList[var.SchoolYear].Add(var.Semester, new List <SemesterEntryScoreInfo>());
                        }
                        semesterEntryScoreList[var.SchoolYear][var.Semester].Add(var);
                    }
                    foreach (int sy in semesterEntryScoreList.Keys)
                    {
                        foreach (int se in semesterEntryScoreList[sy].Keys)
                        {
                            RowData row = new RowData();
                            row.ID = stu.StudentID;
                            row.Add("學年度", "" + sy);
                            row.Add("學期", "" + se);
                            foreach (SemesterEntryScoreInfo var in semesterEntryScoreList[sy][se])
                            {
                                if (!row.ContainsKey("成績年級"))
                                {
                                    row.Add("成績年級", "" + var.GradeYear);
                                }
                                if (e.ExportFields.Contains(var.Entry))
                                {
                                    row.Add(var.Entry, "" + var.Score);
                                }
                            }

                            //處理學業成績排名資料

                            if (StudSemsEntryRatingDict.ContainsKey(stu.StudentID))
                            {
                                foreach (var record in StudSemsEntryRatingDict[stu.StudentID])
                                {
                                    if (record.SchoolYear == "" + sy && record.Semester == "" + se)
                                    {
                                        row.Add("學業成績班排名", "" + record.ClassRank);
                                        row.Add("學業成績班排名母數", "" + record.ClassCount);
                                        row.Add("學業成績科排名", "" + record.DeptRank);
                                        row.Add("學業成績科排名母數", "" + record.DeptCount);
                                        row.Add("學業成績校排名", "" + record.YearRank);
                                        row.Add("學業成績校排名母數", "" + record.YearCount);

                                        row.Add("學業成績排名類別1", "" + record.Group1);
                                        row.Add("學業成績類1排名", "" + record.Group1Rank);
                                        row.Add("學業成績類1排名母數", "" + record.Group1Count);

                                        // 2018/8 穎驊註解,經過討論後, 先暫時將 ischool類別2 排名的概念拿掉,因為目前的結構 無法區隔類別1、類別2,待日後設計完整

                                        //row.Add("學業成績排名類別2", "" + record.Group2);
                                        //row.Add("學業成績類2排名", "" + record.Group2Rank);
                                        //row.Add("學業成績類2排名母數", "" + record.Group2Count);
                                    }
                                }
                            }


                            e.Items.Add(row);
                        }
                    }
                }
            };
        }
Beispiel #4
0
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            SmartSchool.API.PlugIn.VirtualCheckBox filterRepeat = new SmartSchool.API.PlugIn.VirtualCheckBox("自動略過重讀成績", true);
            wizard.Options.Add(filterRepeat);

            //2017/6/16 穎驊新增,因應[02-02][06] 計算學期科目成績新增清空原成績模式 項目, 新增 "刪除"欄位,使使用者能匯入 刪除成績資料
            wizard.ExportableFields.AddRange("領域", "學年度", "學期", "權數", "節數", "成績", "原始成績", "補考成績", "努力程度", "文字描述", "註記", "刪除");
            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                #region ExportPackage
                List <JHStudentRecord> students = JHStudent.SelectByIDs(e.List);

                Dictionary <string, List <JHSemesterScoreRecord> > semsDict = new Dictionary <string, List <JHSemesterScoreRecord> >();
                foreach (JHSemesterScoreRecord record in JHSemesterScore.SelectByStudentIDs(e.List))
                {
                    if (!semsDict.ContainsKey(record.RefStudentID))
                    {
                        semsDict.Add(record.RefStudentID, new List <JHSemesterScoreRecord>());
                    }
                    semsDict[record.RefStudentID].Add(record);
                }

                foreach (JHStudentRecord stu in students)
                {
                    if (!semsDict.ContainsKey(stu.ID))
                    {
                        continue;
                    }

                    foreach (JHSemesterScoreRecord record in semsDict[stu.ID])
                    {
                        foreach (K12.Data.DomainScore domain in record.Domains.Values)
                        {
                            RowData row = new RowData();
                            row.ID = stu.ID;
                            foreach (string field in e.ExportFields)
                            {
                                if (wizard.ExportableFields.Contains(field))
                                {
                                    switch (field)
                                    {
                                    case "領域": row.Add(field, "" + domain.Domain); break;

                                    case "學年度": row.Add(field, "" + record.SchoolYear); break;

                                    case "學期": row.Add(field, "" + record.Semester); break;

                                    case "權數": row.Add(field, "" + domain.Credit); break;

                                    case "節數": row.Add(field, "" + domain.Period); break;

                                    case "成績": row.Add(field, "" + domain.Score); break;

                                    case "原始成績": row.Add(field, "" + domain.ScoreOrigin); break;

                                    case "補考成績": row.Add(field, "" + domain.ScoreMakeup); break;

                                    case "努力程度": row.Add(field, "" + domain.Effort); break;

                                    case "文字描述": row.Add(field, domain.Text); break;

                                    case "註記": row.Add(field, domain.Comment); break;

                                    case "刪除": row.Add(field, ""); break;
                                    }
                                }
                            }
                            e.Items.Add(row);
                        }
                    }
                }
                #endregion

                FISCA.LogAgent.ApplicationLog.Log("成績系統.匯入匯出", "匯出學期領域成績", "總共匯出" + e.Items.Count + "筆學期領域成績。");
            };
        }
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            SmartSchool.API.PlugIn.VirtualCheckBox filterRepeat = new SmartSchool.API.PlugIn.VirtualCheckBox("自動略過重讀成績", true);
            wizard.Options.Add(filterRepeat);
            wizard.ExportableFields.AddRange(
                "科目"
                , "科目級別"
                , "學年度"
                , "學期"
                , "英文名稱"
                , "學分數"
                , "分項類別"
                , "成績年級"
                , "必選修"
                , "校部訂"
                , "科目成績"
                , "原始成績"
                , "補考成績"
                , "重修成績"
                , "手動調整成績"
                , "學年調整成績"
                , "取得學分"
                , "不計學分"
                , "不需評分"
                , "註記"
                , "畢業採計-學分數"
                , "畢業採計-分項類別"
                , "畢業採計-必選修"
                , "畢業採計-校部訂"
                , "畢業採計-不計學分"
                , "畢業採計-說明"
                , "是否補修成績"
                , "補修學年度"
                , "補修學期"
                , "重修學年度"
                , "重修學期"
                , "修課及格標準"
                , "修課補考標準"
                , "修課備註"
                , "修課直接指定總成績"
                , "免修"
                , "抵免"
                );
            filterRepeat.CheckedChanged += delegate
            {
                if (filterRepeat.Checked)
                {
                    foreach (var item in new string[] { "畢業採計-學分數"
                                                        , "畢業採計-分項類別"
                                                        , "畢業採計-必選修"
                                                        , "畢業採計-校部訂"
                                                        , "畢業採計-不計學分"
                                                        , "畢業採計-說明" }
                             )
                    {
                        if (!wizard.ExportableFields.Contains(item))
                        {
                            wizard.ExportableFields.Add(item);
                        }
                    }
                }
                else
                {
                    foreach (var item in new string[] { "畢業採計-學分數"
                                                        , "畢業採計-分項類別"
                                                        , "畢業採計-必選修"
                                                        , "畢業採計-校部訂"
                                                        , "畢業採計-不計學分"
                                                        , "畢業採計-說明" }
                             )
                    {
                        if (wizard.ExportableFields.Contains(item))
                        {
                            wizard.ExportableFields.Remove(item);
                        }
                    }
                }
            };
            AccessHelper _AccessHelper = new AccessHelper();

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                List <StudentRecord> students = _AccessHelper.StudentHelper.GetStudents(e.List);
                if (filterRepeat.Checked)
                {
                    var gCheck = false;
                    foreach (var item in new string[] { "畢業採計-學分數"
                                                        , "畢業採計-分項類別"
                                                        , "畢業採計-必選修"
                                                        , "畢業採計-校部訂"
                                                        , "畢業採計-不計學分"
                                                        , "畢業採計-說明" }
                             )
                    {
                        if (e.ExportFields.Contains(item))
                        {
                            gCheck = true;
                            break;
                        }
                    }
                    if (gCheck)
                    {
                        new WearyDogComputer().FillStudentGradCheck(_AccessHelper, students);
                    }
                    //_AccessHelper.StudentHelper.FillSemesterSubjectScore(filterRepeat.Checked, students);
                    else
                    {
                        _AccessHelper.StudentHelper.FillSemesterSubjectScore(filterRepeat.Checked, students);
                    }
                }
                else
                {
                    _AccessHelper.StudentHelper.FillSemesterSubjectScore(false, students);
                }
                //if (e.ExportFields.Contains("計算規則-及格標準"))
                //    _AccessHelper.StudentHelper.FillField("及格標準", students);
                //if (e.ExportFields.Contains("計算規則-補考標準"))
                //    _AccessHelper.StudentHelper.FillField("補考標準", students);

                //// 取得學生課程代碼相關對照
                //CourseCodeTransfer cct = new CourseCodeTransfer();
                //// 取得學生課程代碼
                //Dictionary<string, StudentCourseCodeInfo> studCodeInfoDict = cct.GetStundetCourseCodeDict(e.List);

                string subjectCode = "";

                foreach (StudentRecord stu in students)
                {
                    foreach (SemesterSubjectScoreInfo var in stu.SemesterSubjectScoreList)
                    {
                        subjectCode = "";

                        //if (studCodeInfoDict.ContainsKey(stu.StudentID))
                        //{
                        //    StudentCourseCodeInfo item = studCodeInfoDict[stu.StudentID];

                        //    string req = var.Require ? "必修" : "選修";
                        //    subjectCode = item.GetCourseCode(var.Subject, var.Detail.GetAttribute("修課校部訂"), req);
                        //}
                        RowData row = new RowData();
                        row.ID = stu.StudentID;
                        foreach (string field in e.ExportFields)
                        {
                            if (wizard.ExportableFields.Contains(field))
                            {
                                switch (field)
                                {
                                case "科目": row.Add(field, var.Subject); break;

                                case "科目級別": row.Add(field, var.Level); break;

                                case "學年度": row.Add(field, "" + var.SchoolYear); break;

                                case "學期": row.Add(field, "" + var.Semester); break;

                                case "英文名稱": row.Add(field, var.Detail.GetAttribute("英文名稱")); break;

                                case "學分數": row.Add(field, "" + var.CreditDec()); break;

                                case "分項類別": row.Add(field, var.Detail.GetAttribute("開課分項類別")); break;

                                case "成績年級": row.Add(field, "" + var.GradeYear); break;

                                case "必選修": row.Add(field, var.Require ? "必修" : "選修"); break;

                                case "校部訂": row.Add(field, var.Detail.GetAttribute("修課校部訂")); break;

                                case "科目成績": row.Add(field, "" + var.Score); break;

                                case "原始成績": row.Add(field, var.Detail.GetAttribute("原始成績")); break;

                                case "補考成績": row.Add(field, var.Detail.GetAttribute("補考成績")); break;

                                case "重修成績": row.Add(field, var.Detail.GetAttribute("重修成績")); break;

                                case "手動調整成績": row.Add(field, var.Detail.GetAttribute("擇優採計成績")); break;

                                case "學年調整成績": row.Add(field, var.Detail.GetAttribute("學年調整成績")); break;

                                case "取得學分": row.Add(field, var.Pass ? "是" : "否"); break;

                                case "不計學分": row.Add(field, var.Detail.GetAttribute("不計學分") == "是" ? "是" : ""); break;

                                case "不需評分": row.Add(field, var.Detail.GetAttribute("不需評分") == "是" ? "是" : ""); break;

                                case "註記": row.Add(field, var.Detail.HasAttribute("註記") ? var.Detail.GetAttribute("註記") : ""); break;

                                //case "計算規則-及格標準":
                                //    if (stu.Fields.ContainsKey("及格標準") && stu.Fields["及格標準"] is Dictionary<int, decimal>)
                                //    {
                                //        Dictionary<int, decimal> applyLimit = (Dictionary<int, decimal>)stu.Fields["及格標準"];
                                //        if (applyLimit.ContainsKey(var.GradeYear))
                                //        {
                                //            row.Add(field, "" + applyLimit[var.GradeYear]);
                                //        }
                                //        else
                                //        {
                                //            row.Add(field, "無法判斷");
                                //        }
                                //    }
                                //    else
                                //    {
                                //        row.Add(field, "沒有成績計算規則");
                                //    }
                                //    break;

                                //case "計算規則-補考標準":
                                //    if (stu.Fields.ContainsKey("補考標準") && stu.Fields["補考標準"] is Dictionary<int, decimal>)
                                //    {
                                //        Dictionary<int, decimal> reexamLimit = (Dictionary<int, decimal>)stu.Fields["補考標準"];
                                //        if (reexamLimit.ContainsKey(var.GradeYear))
                                //        {
                                //            row.Add(field, "" + reexamLimit[var.GradeYear]);
                                //        }
                                //        else
                                //        {
                                //            row.Add(field, "無法判斷");
                                //        }
                                //    }
                                //    else
                                //    {
                                //        row.Add(field, "沒有成績計算規則");
                                //    }
                                //    break;

                                case "畢業採計-學分數":
                                case "畢業採計-分項類別":
                                case "畢業採計-必選修":
                                case "畢業採計-校部訂":
                                case "畢業採計-不計學分":
                                    if (var.Detail.GetAttribute(field) == "")
                                    {
                                        row.Add(field, "--");
                                    }
                                    else
                                    {
                                        row.Add(field, var.Detail.GetAttribute(field));
                                    }
                                    break;

                                case "畢業採計-說明":
                                    row.Add(field, var.Detail.GetAttribute(field));
                                    break;

                                case "是否補修成績": row.Add(field, var.Detail.GetAttribute("是否補修成績") == "是" ? "是" : ""); break;

                                case "重修學年度": row.Add(field, var.Detail.GetAttribute("重修學年度")); break;

                                case "重修學期": row.Add(field, var.Detail.GetAttribute("重修學期")); break;

                                case "補修學年度": row.Add(field, var.Detail.GetAttribute("補修學年度")); break;

                                case "補修學期": row.Add(field, var.Detail.GetAttribute("補修學期")); break;

                                case "修課及格標準": row.Add(field, var.Detail.GetAttribute("修課及格標準")); break;

                                case "修課補考標準": row.Add(field, var.Detail.GetAttribute("修課補考標準")); break;

                                //                                    case "修課科目代碼": row.Add(field, var.Detail.GetAttribute("修課科目代碼")); break;
                                case "修課備註": row.Add(field, var.Detail.GetAttribute("修課備註")); break;

                                case "修課直接指定總成績": row.Add(field, var.Detail.GetAttribute("修課直接指定總成績")); break;

                                //case "應修學期": row.Add(field, var.Detail.GetAttribute("應修學期")); break;
                                case "免修": row.Add(field, var.Detail.GetAttribute("免修") == "是" ? "是" : ""); break;

                                case "抵免": row.Add(field, var.Detail.GetAttribute("抵免") == "是" ? "是" : ""); break;
                                }
                            }
                        }
                        e.Items.Add(row);
                    }
                }
            };
        }