Пример #1
0
        public ClassData(K12.Data.ClassRecord classRecord, bool exclude_abnormal)
        {
            ClassRecord = classRecord;
            Students    = new List <StudentData>();

            foreach (K12.Data.StudentRecord sr in classRecord.Students)
            {
                StudentData sd = new StudentData();
                if (exclude_abnormal)
                {
                    if (sr.Status == K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        sd.Student = sr;
                        sd.Score   = 0;
                        Students.Add(sd);
                    }
                }
                else
                {
                    sd.Student = sr;
                    sd.Score   = 0;
                    Students.Add(sd);
                }
            }
        }
Пример #2
0
        static private int SortK12Data_ClassRecord(K12.Data.ClassRecord class1, K12.Data.ClassRecord class2)
        {
            string ClassYear1 = class1.GradeYear.HasValue ? class1.GradeYear.Value.ToString().PadLeft(10, '0') : string.Empty.PadLeft(10, '9');
            string ClassYear2 = class2.GradeYear.HasValue ? class2.GradeYear.Value.ToString().PadLeft(10, '0') : string.Empty.PadLeft(10, '9');

            string DisplayOrder1 = "";

            if (string.IsNullOrEmpty(class1.DisplayOrder))
            {
                DisplayOrder1 = class1.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                DisplayOrder1 = class1.DisplayOrder.PadLeft(10, '0');
            }
            string DisplayOrder2 = "";

            if (string.IsNullOrEmpty(class2.DisplayOrder))
            {
                DisplayOrder2 = class2.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                DisplayOrder2 = class2.DisplayOrder.PadLeft(10, '0');
            }

            string ClassName1 = class1.Name.PadLeft(10, '0');
            string ClassName2 = class2.Name.PadLeft(10, '0');

            string Compareto1 = ClassYear1 + DisplayOrder1 + ClassName1;
            string Compareto2 = ClassYear2 + DisplayOrder2 + ClassName2;

            return(Compareto1.CompareTo(Compareto2));
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool chkHasClassName = false;
            if (txtName.Text.Trim() == "")
                return;

            List<K12.Data.ClassRecord> AllClassRecs = K12.Data.Class.SelectAll();
            foreach (K12.Data.ClassRecord cr in AllClassRecs)
                if (cr.Name == txtName.Text)
                {
                    MessageBox.Show("班級名稱重複");
                    return;
                }

            PermRecLogProcess prlp = new PermRecLogProcess();
            K12.Data.ClassRecord classRec = new K12.Data.ClassRecord();
            classRec.Name = txtName.Text;
            string ClassID = K12.Data.Class.Insert(classRec);

            Class.Instance.SyncDataBackground(ClassID);

            if (chkInputData.Checked == true)
            {
                Class.Instance.PopupDetailPane(ClassID);
                Class.Instance.SyncDataBackground(ClassID);
            }

            prlp.SaveLog("學籍.班級", "新增班級", "新增班級,名稱:" + txtName.Text);
            this.Close();
        }
Пример #4
0
        public StudentSortObj_K12Data(K12.Data.ClassRecord classRecord, K12.Data.StudentRecord student)
        {
            string ClassYear     = ""; //年級
            string ClassIndex    = ""; //班級序號
            string ClassName     = ""; //班級名稱
            string StudentSeatNo = ""; //學生座號
            string StudentName   = ""; //學生姓名

            _StudentRecord = student;

            #region ClassIndex & ClassName
            if (classRecord != null) //如果有班級
            {
                _ClassRecord = classRecord;
                ClassYear    = Year(_ClassRecord);
                ClassIndex   = Index(_ClassRecord);
                ClassName    = _ClassRecord.Name.PadLeft(10, '0');
            }
            else //如果沒有班級
            {
                ClassYear  = ClassYear.PadLeft(10, '9');
                ClassIndex = ClassIndex.PadLeft(10, '9');
                ClassName  = ClassName.PadLeft(10, '9');
            }
            #endregion

            StudentName = _StudentRecord.Name.PadLeft(10, '0');

            StudentSeatNo = _StudentRecord.SeatNo.HasValue ?
                            _StudentRecord.SeatNo.Value.ToString().PadLeft(10, '0') :
                            StudentSeatNo.PadLeft(10, '9');

            _SortString = ClassYear + ClassIndex + ClassName + StudentSeatNo + StudentName;
        }
Пример #5
0
    private void btnSave_Click(object sender, EventArgs e)
    {
        string classname = txtName.Text.Trim();

            if (classname == String.Empty)
                return;

            QueryHelper queryHelper = new QueryHelper();
            string strQuery = String.Format(@"select class_name from class where class_name='{0}'", classname);

            DataTable dataTable = queryHelper.Select(strQuery);

            if (dataTable == null || dataTable.Rows.Count == 0)
            {
                K12.Data.ClassRecord addRecord = new K12.Data.ClassRecord();

                addRecord.Name = classname;

                string addRecord_ID = K12.Data.Class.Insert(addRecord);
                //Class.Instance.SyncDataBackground(ClassID);   同步處理
                //  log 待處理
                //PermRecLogProcess prlp = new PermRecLogProcess();
                //prlp.SaveLog("學籍.班級", "新增班級", "新增班級,名稱:" + txtName.Text);
                if (chkInputData.Checked)
                    K12.Presentation.NLDPanels.Class.PopupDetailPane(addRecord_ID);
                //Class.Instance.SyncDataBackground(ClassID);   同步處理
            }
            else
            {
                MessageBox.Show("班級名稱重複");
                return;
            }
            this.Close();
    }
Пример #6
0
        static public string Index(K12.Data.ClassRecord _class)
        {
            string classIndex = "";

            if (string.IsNullOrEmpty(_class.DisplayOrder))
            {
                classIndex = _class.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                classIndex = _class.DisplayOrder.PadLeft(10, '0');
            }

            return(classIndex);
        }
Пример #7
0
        static public string Year(K12.Data.ClassRecord _class)
        {
            string classYear = "";

            if (_class.GradeYear.HasValue)
            {
                classYear = _class.GradeYear.Value.ToString().PadLeft(10, '0');
            }
            else
            {
                classYear = classYear.PadLeft(10, '9');
            }

            return(classYear);
        }
Пример #8
0
        public RStudentRecord(K12.Data.StudentRecord record)
        {
            ID            = record.ID;
            Name          = record.Name;
            SeatNo        = record.SeatNo.HasValue ? record.SeatNo.Value.ToString() : "";
            StudentNumber = record.StudentNumber;
            ClassName     = string.Empty;
            GradeYear     = string.Empty;

            K12.Data.ClassRecord cr = record.Class;
            if (cr != null)
            {
                ClassName = record.Class.Name;
                GradeYear = record.Class.GradeYear.HasValue ? record.Class.GradeYear.Value.ToString() : "";
            }
        }
        void _BGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            _ClassRecord = K12.Data.Class.SelectByID(PrimaryKey);
            _AllClassRecList = K12.Data.Class.SelectAll();

            // 教师名称索引
            _TeacherNameDic.Clear();
            foreach (K12.Data.TeacherRecord TRec in K12.Data.Teacher.SelectAll())
            {
                if (TRec.Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                    continue;

                if (string.IsNullOrEmpty(TRec.Nickname))
                    _TeacherNameDic.Add(TRec.ID, TRec.Name);
                else
                    _TeacherNameDic.Add(TRec.ID, TRec.Name + "(" + TRec.Nickname + ")");
            }
        }
Пример #10
0
        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();
                }
            };
        }
        public static Aspose.Cells.Range Execute(int classIndex, string schoolYear, string semester, K12.Data.ClassRecord Class, Dictionary <string, string> studDomainScores, Dictionary <string, decimal?> DomainScores)
        {
            Workbook book = new Workbook();

            book.Worksheets.Clear();
            book.Open(new MemoryStream(JHSchool.Permrec.Properties.Resources.班級學期領域成績一覽表));

            int RowIndex = 5;

            book.Worksheets[0].Cells[0, 0].PutValue(schoolYear + " 學年度第 " + semester + " 學期 " + Class.GradeYear.ToString() + " 年 " + Class.Name + " 班");

            book.Worksheets[0].Cells[47, 0].PutValue(" 列印日期:" + DateTime.Today.ToShortDateString());

            foreach (K12.Data.StudentRecord student in Class.Students)
            {
                book.Worksheets[0].Cells[RowIndex, 0].PutValue(student.SeatNo);
                book.Worksheets[0].Cells[RowIndex, 1].PutValue(student.Name);



                //語文 數學 自然與生活 科技 社會 藝術與人文 健康與體育 綜合活動 彈性課程
                if (studDomainScores.ContainsKey(student.ID + "語文"))
                {
                    book.Worksheets[0].Cells[RowIndex, 2].PutValue(SafeParseDouble(studDomainScores[student.ID + "語文"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "數學"))
                {
                    book.Worksheets[0].Cells[RowIndex, 3].PutValue(SafeParseDouble(studDomainScores[student.ID + "數學"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "自然與生活科技"))
                {
                    book.Worksheets[0].Cells[RowIndex, 4].PutValue(SafeParseDouble(studDomainScores[student.ID + "自然與生活科技"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "社會"))
                {
                    book.Worksheets[0].Cells[RowIndex, 5].PutValue(SafeParseDouble(studDomainScores[student.ID + "社會"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "藝術與人文"))
                {
                    book.Worksheets[0].Cells[RowIndex, 6].PutValue(SafeParseDouble(studDomainScores[student.ID + "藝術與人文"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "健康與體育"))
                {
                    book.Worksheets[0].Cells[RowIndex, 7].PutValue(SafeParseDouble(studDomainScores[student.ID + "健康與體育"]));
                }

                if (studDomainScores.ContainsKey(student.ID + "綜合活動"))
                {
                    book.Worksheets[0].Cells[RowIndex, 8].PutValue(SafeParseDouble(studDomainScores[student.ID + "綜合活動"]));
                }

                double i = 0;

                if (studDomainScores.ContainsKey(student.ID + "學習領域"))
                {
                    if (studDomainScores[student.ID + "學習領域"].Equals(string.Empty))
                    {
                        book.Worksheets[0].Cells[RowIndex, 9].PutValue("");
                    }
                    else
                    {
                        book.Worksheets[0].Cells[RowIndex, 9].PutValue(Convert.ToDouble(studDomainScores[student.ID + "學習領域"]));
                    }
                }

                if (studDomainScores.ContainsKey(student.ID + "課程學習"))
                {
                    if (studDomainScores[student.ID + "課程學習"].Equals(string.Empty))
                    {
                        book.Worksheets[0].Cells[RowIndex, 11].PutValue("");
                    }
                    else
                    {
                        book.Worksheets[0].Cells[RowIndex, 11].PutValue(Convert.ToDouble(studDomainScores[student.ID + "課程學習"]));
                    }
                }

                int FormulaIndex = (1 + RowIndex + (classIndex * 50));

                book.Worksheets[0].Cells[RowIndex, 10].Formula = "=IF(ISERROR(RANK(J$" + FormulaIndex.ToString() + ",J$" + (6 + classIndex * 50) + ":J$" + (40 + classIndex * 50) + ")),\"\",RANK(J$" + FormulaIndex.ToString() + ",J$" + (6 + classIndex * 50) + ":J$" + (40 + classIndex * 50) + "))";

                book.Worksheets[0].Cells[RowIndex, 12].Formula = "=IF(ISERROR(RANK(L$" + FormulaIndex.ToString() + ",L$" + (6 + classIndex * 50) + ":L$" + (40 + classIndex * 50) + ")),\"\",RANK(L$" + FormulaIndex.ToString() + ",L$" + (6 + classIndex * 50) + ":L$" + (40 + classIndex * 50) + "))";
                //if (studDomainScores.ContainsKey(student.ID + "學習領域"))
                //    book.Worksheets[0].Cells[RowIndex, 10].PutValue(studDomainScores[student.ID + "學習領域"]);

                //if (studDomainScores.ContainsKey(student.ID + "課程學習(含彈性課程)"))
                //    book.Worksheets[0].Cells[RowIndex, 12].PutValue(studDomainScores[student.ID + "課程學習(含彈性課程)"]);


                RowIndex++;
            }

            //平均成績
            //語文 數學 自然與生活 科技 社會 藝術與人文 健康與體育 綜合活動 彈性課程
            if (DomainScores.ContainsKey("語文"))
            {
                book.Worksheets[0].Cells[40, 2].PutValue(string.Format("{0:F2}", DomainScores["語文"]));
            }

            if (DomainScores.ContainsKey("數學"))
            {
                book.Worksheets[0].Cells[40, 3].PutValue(string.Format("{0:F2}", DomainScores["數學"]));
            }

            if (DomainScores.ContainsKey("自然與生活科技"))
            {
                book.Worksheets[0].Cells[40, 4].PutValue(string.Format("{0:F2}", DomainScores["自然與生活科技"]));
            }

            if (DomainScores.ContainsKey("社會"))
            {
                book.Worksheets[0].Cells[40, 5].PutValue(string.Format("{0:F2}", DomainScores["社會"]));
            }

            if (DomainScores.ContainsKey("藝術與人文"))
            {
                book.Worksheets[0].Cells[40, 6].PutValue(string.Format("{0:F2}", DomainScores["藝術與人文"]));
            }

            if (DomainScores.ContainsKey("健康與體育"))
            {
                book.Worksheets[0].Cells[40, 7].PutValue(string.Format("{0:F2}", DomainScores["健康與體育"]));
            }

            if (DomainScores.ContainsKey("綜合活動"))
            {
                book.Worksheets[0].Cells[40, 8].PutValue(string.Format("{0:F2}", DomainScores["綜合活動"]));
            }


            //RowIndex = 5;

            //foreach (JHSchool.Data.JHStudentRecord student in Class.Students)
            //{
            //    object value = book.Worksheets[0].Cells[RowIndex, 10].Value;

            //    book.Worksheets[0].Cells[RowIndex, 10].PutValue(value);
            //    book.Worksheets[0].Cells[RowIndex, 10].R1C1Formula = "";

            //    RowIndex++;
            //}

            return(book.Worksheets[0].Cells.CreateRange(0, 50, false));
        }