Ejemplo n.º 1
0
 void _BGWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     // 取得學生資料、學生電話、父母電話
     _StudRec      = JHStudent.SelectByID(PrimaryKey);
     _PhoneRec     = JHPhone.SelectByStudentID(PrimaryKey);
     _ParentRecord = JHParent.SelectByStudentID(PrimaryKey);
 }
Ejemplo n.º 2
0
        public static void Main()
        {
            Global.Params = ModuleLoader.GetDeployParametsers(typeof(Program), "Mode=KaoHsiung");

            //學生學期成績
            string key = "JHSchool.Student.Detail0050";

            if (FISCA.Permission.UserAcl.Current[key].Editable || FISCA.Permission.UserAcl.Current[key].Viewable)
            {
                K12.Presentation.NLDPanels.Student.AddDetailBulider(new DetailBulider <SemesterScoreItem>());
            }

            JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId)
            {
                SemesterScoreEditor form;
                form = new SemesterScoreEditor(JHStudent.SelectByID(studentId));
                return(form.ShowDialog());
            });
            JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId, int schoolYear, int semester)
            {
                SemesterScoreEditor form;
                form = new SemesterScoreEditor(JHStudent.SelectByID(studentId), JHSemesterScore.SelectBySchoolYearAndSemester(studentId, schoolYear, semester));
                return(form.ShowDialog());
            });
        }
Ejemplo n.º 3
0
        void _BGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Get Photo
            _FreshmanPhotoStr = _GraduatePhotoStr = string.Empty;
            _FreshmanPhotoStr = K12.Data.Photo.SelectFreshmanPhoto(PrimaryKey);
            _GraduatePhotoStr = K12.Data.Photo.SelectGraduatePhoto(PrimaryKey);

            // studentRec
            _StudRec = JHStudent.SelectByID(PrimaryKey);
        }
Ejemplo n.º 4
0
        //一般新增
        private void btnNornalAdd_Click(object sender, EventArgs e)
        {
            SemesterScoreEditor form = new SemesterScoreEditor(JHStudent.SelectByID(PrimaryKey));

            if (form.ShowDialog() == DialogResult.OK)
            {
                LoadSemesterScores();
            }

            listView.Focus();
        }
Ejemplo n.º 5
0
        private void btnView_Click(object sender, EventArgs e)
        {
            //btnModify_Click(sender, e);
            if (listView.SelectedItems.Count <= 0)
            {
                return;
            }

            SemesterScoreEditor form = new SemesterScoreEditor(JHStudent.SelectByID(PrimaryKey), listView.SelectedItems[0].Tag as JHSemesterScoreRecord, false);

            form.ShowDialog();
        }
Ejemplo n.º 6
0
            public List <JHStudentRecord> GetAttendStudents(JHCourseRecord course)
            {
                List <JHStudentRecord> list = new List <JHStudentRecord>();

                if (ContainsKey(course.ID))
                {
                    foreach (JHSCAttendRecord sca in this[course.ID])
                    {
                        list.Add(JHStudent.SelectByID(sca.RefStudentID));
                    }
                }
                return(list);
            }
Ejemplo n.º 7
0
        private void OpenScoreInputForm()
        {
            if (listView.SelectedItems.Count <= 0)
            {
                return;
            }

            ListViewItem   item   = listView.SelectedItems[0];
            JHCourseRecord course = item.Tag as JHCourseRecord;
            ScoreInputForm form   = new ScoreInputForm(JHStudent.SelectByID(PrimaryKey), course);

            form.ShowDialog();
        }
Ejemplo n.º 8
0
        public Form1()
        {
            InitializeComponent();

            FISCA.Authentication.DSAServices.SetLicense("SmartSchoolLicense.key");
            FISCA.Authentication.DSAServices.Login("adrnin", "1234");

            Student = JHStudent.SelectByID("147285");
            listBox1.DisplayMember = "SchoolYear";
            foreach (var record in JHSemesterScore.SelectByStudentID(Student.ID))
            {
                listBox1.Items.Add(record);
            }
        }
Ejemplo n.º 9
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            LeaveInfoRec.ClassName     = txtClass.Text;
            LeaveInfoRec.DiplomaNumber = txtGDNumber.Text;
            LeaveInfoRec.Memo          = txtMemo.Text;
            LeaveInfoRec.Reason        = cboReason.Text;
            int SchoolYear = 0;

            if (string.IsNullOrEmpty(txtSchoolYear.Text))
            {
                LeaveInfoRec.SchoolYear = null;
            }
            else
            {
                if (int.TryParse(txtSchoolYear.Text, out SchoolYear))
                {
                    LeaveInfoRec.SchoolYear = SchoolYear;
                }
                else
                {
                    epSchoolYear.SetError(txtSchoolYear, "請輸入整數");
                    return;
                }
            }
            JHSchool.Data.JHLeaveIfno.Update(LeaveInfoRec);

            SaveButtonVisible   = false;
            CancelButtonVisible = false;
            //Student.Instance.SyncDataBackground(PrimaryKey);
            //            this._DefaultClass = txtClass.Text;
            this._DefaultGDNumber   = txtGDNumber.Text;
            this._DefaultMemo       = txtMemo.Text;
            this._DefaultSchoolYear = txtSchoolYear.Text;
            this._DefaultReason     = cboReason.Text;

            prlp.SetAfterSaveText("畢業學年度", txtSchoolYear.Text);
            prlp.SetAfterSaveText("畢業資格", cboReason.Text);
            prlp.SetAfterSaveText("畢業證書字號", txtGDNumber.Text);
            prlp.SetAfterSaveText("畢業相關訊息", txtMemo.Text);
            prlp.SetActionBy("學籍", "學生畢業資訊");
            prlp.SetAction("修改學生畢業資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");

            prlp.SaveLog("", "", "student", PrimaryKey);
            // BindDataToForm();
        }
Ejemplo n.º 10
0
        //修改
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count <= 0)
            {
                return;
            }

            SemesterScoreEditor form = new SemesterScoreEditor(JHStudent.SelectByID(PrimaryKey), listView.SelectedItems[0].Tag as JHSemesterScoreRecord);

            if (form.ShowDialog() == DialogResult.OK)
            {
                LoadSemesterScores();
            }

            listView.Focus();
        }
Ejemplo n.º 11
0
        public SemesterScoreItem()
        {
            InitializeComponent();
            InitializeQuickAddButton();

            _domainList = new List <string>();
            InitializeColumnHeader();

            UserPermission = Framework.User.Acl[FCode.GetCode(GetType())];

            btnAdd.Visible    = UserPermission.Editable;
            btnModify.Visible = UserPermission.Editable;
            btnDelete.Visible = UserPermission.Editable;
            btnView.Visible   = UserPermission.Viewable & !UserPermission.Editable;

            _worker         = new BackgroundWorker();
            _worker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                if (_student == null)
                {
                    _student = JHStudent.SelectByID("" + e.Argument);
                }
                else if (_student.ID != "" + e.Argument)
                {
                    _student = JHStudent.SelectByID("" + e.Argument);
                }

                e.Result = JHSemesterScore.SelectByStudentID("" + e.Argument);
            };
            _worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                if (_RunningID != PrimaryKey)
                {
                    _RunningID = PrimaryKey;
                    _worker.RunWorkerAsync(_RunningID);
                    return;
                }

                _recordList = e.Result as List <JHSemesterScoreRecord>;
                FillListView();
            };

            FISCA.InteractionService.SubscribeEvent("CalculationHelper.SaveSemesterScore", (sender, args) => {
                AfterSaveSemesterScore();
            });
        }
Ejemplo n.º 12
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            _BeforeEnrollmentRecord.School         = txtSchool.Text;
            _BeforeEnrollmentRecord.SchoolLocation = txtSchoolLocation.Text;
            _BeforeEnrollmentRecord.ClassName      = txtClass.Text;
            int intSeatNo;

            if (string.IsNullOrEmpty(txtSeatNo.Text))
            {
                _BeforeEnrollmentRecord.SeatNo = null;
            }
            else
            {
                if (int.TryParse(txtSeatNo.Text, out intSeatNo))
                {
                    _BeforeEnrollmentRecord.SeatNo = intSeatNo;
                }
                else
                {
                    epSeatNo.SetError(txtSeatNo, "請填入數字.");
                    return;
                }
            }


            _BeforeEnrollmentRecord.Memo = txtMemo.Text;

            JHBeforeEnrollment.Update(_BeforeEnrollmentRecord);
            listener.Reset();
            SaveButtonVisible   = false;
            CancelButtonVisible = SaveButtonVisible;

            prlp.SetAfterSaveText("學校名稱", txtSchool.Text);
            prlp.SetAfterSaveText("所在地", txtSchoolLocation.Text);
            prlp.SetAfterSaveText("班級", txtClass.Text);
            prlp.SetAfterSaveText("座號", txtSeatNo.Text);
            prlp.SetAfterSaveText("備註", txtMemo.Text);
            prlp.SetActionBy("學籍", "學生前級畢業資訊");
            prlp.SetAction("修改學生前級畢業資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            prlp.SaveLog("", "", "student", PrimaryKey);
        }
Ejemplo n.º 13
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count <= 0)
            {
                return;
            }

            ListViewItem   item   = listView.SelectedItems[0];
            JHCourseRecord course = item.Tag as JHCourseRecord;

            if (MsgBox.Show(string.Format("您確定要刪除課程「{0}」的修課記錄及相關評量成績嗎?", course.Name), MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                JHStudentRecord student = JHStudent.SelectByID(PrimaryKey);

                List <JHSCETakeRecord> sces = JHSCETake.SelectByStudentAndCourse(student.ID, course.ID);
                if (sces.Count > 0)
                {
                    JHSCETake.Delete(sces);
                    FISCA.LogAgent.LogSaver logSaver = FISCA.LogAgent.ApplicationLog.CreateLogSaverInstance();
                    string studentInfo = StudentInfoConvertor.GetInfoWithClass(student);
                    foreach (var sce in sces)
                    {
                        string desc = studentInfo + " 刪除評量成績:" + sce.Course.Name + " " + sce.Exam.Name;
                        logSaver.AddBatch("成績系統.修課及評量成績", "刪除評量成績", "student", PrimaryKey, desc);
                    }
                    logSaver.LogBatch();
                }

                List <JHSCAttendRecord> scattends = JHSCAttend.SelectByStudentIDAndCourseID(new string[] { student.ID }, new string[] { course.ID });
                if (scattends.Count > 0)
                {
                    JHSCAttend.Delete(scattends);
                    StringBuilder builder = new StringBuilder("");
                    builder.Append(StudentInfoConvertor.GetInfoWithClass(student));
                    builder.Append(" 刪除修課:" + course.Name);
                    FISCA.LogAgent.ApplicationLog.Log("成績系統.修課及評量成績", "刪除修課", "student", PrimaryKey, builder.ToString());
                }

                listView.Items.Remove(item);
            }
        }
Ejemplo n.º 14
0
        // 儲存資料
        protected override void  OnSaveButtonClick(EventArgs e)
        {
            _PhoneRecord.Permanent = _PermanentPhone = txtEverPhone.Text;
            _PhoneRecord.Contact   = _ContactPhone = txtContactPhone.Text;
            _PhoneRecord.Cell      = _SMS = txtSMS.Text;
            if (btnOthers.Text.EndsWith("1"))
            {
                _OtherPhone1 = txtOtherPhone.Text;
            }
            if (btnOthers.Text.EndsWith("2"))
            {
                _OtherPhone2 = txtOtherPhone.Text;
            }
            if (btnOthers.Text.EndsWith("3"))
            {
                _OtherPhone3 = txtOtherPhone.Text;
            }

            _PhoneRecord.Phone1 = _OtherPhone1;
            _PhoneRecord.Phone2 = _OtherPhone2;
            _PhoneRecord.Phone3 = _OtherPhone3;

            prlp.SetAfterSaveText("戶籍電話", _PermanentPhone);
            prlp.SetAfterSaveText("聯絡電話", _ContactPhone);
            prlp.SetAfterSaveText("行動電話", _SMS);
            prlp.SetAfterSaveText("其他電話1", _OtherPhone1);
            prlp.SetAfterSaveText("其他電話2", _OtherPhone2);
            prlp.SetAfterSaveText("其他電話3", _OtherPhone3);
            JHSchool.Data.JHPhone.Update(_PhoneRecord);

            prlp.SetActionBy("學籍", "學生電話資訊");
            prlp.SetAction("修改學生電話資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            Student.Instance.SyncDataBackground(PrimaryKey);
            prlp.SaveLog("", "", "student", PrimaryKey);
            BindDataToForm();
        }
Ejemplo n.º 15
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            JHStudentRecord student = JHStudent.SelectByID(PrimaryKey);
            CreateForm      form    = new CreateForm(student);

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.Course == null)
                {
                    return;
                }

                try
                {
                    JHSCAttendRecord scattend = new JHSCAttendRecord();
                    scattend.RefCourseID  = form.Course.ID;
                    scattend.RefStudentID = PrimaryKey;
                    JHSCAttend.Insert(scattend);
                    StringBuilder builder = new StringBuilder("");
                    builder.Append(StudentInfoConvertor.GetInfoWithClass(student));
                    builder.Append(" 加入修課:" + form.Course.Name);
                    FISCA.LogAgent.ApplicationLog.Log("成績系統.修課及評量成績", "新增修課", "student", PrimaryKey, builder.ToString());
                }
                catch (Exception ex)
                {
                    MsgBox.Show("新增修課記錄失敗。" + ex.Message);
                }

                ScoreInputForm inputform = new ScoreInputForm(student, form.Course);
                inputform.ShowDialog();

                if (!_worker.IsBusy)
                {
                    _RunningID = PrimaryKey;
                    _worker.RunWorkerAsync();
                }
            }
        }
Ejemplo n.º 16
0
        private void InitializeBackgroundWorker()
        {
            _worker         = new BackgroundWorker();
            _worker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                JHStudentRecord student = JHStudent.SelectByID(PrimaryKey);

                List <string> courseIDs = new List <string>();
                foreach (JHSCAttendRecord record in JHSCAttend.SelectByStudentIDAndCourseID(new string[] { student.ID }, new string[] { }))
                {
                    if (!courseIDs.Contains(record.RefCourseID))
                    {
                        courseIDs.Add(record.RefCourseID);
                    }
                }
                List <JHCourseRecord> courses = JHCourse.SelectByIDs(courseIDs);
                courses.Sort(delegate(JHCourseRecord x, JHCourseRecord y)
                {
                    return(x.Name.CompareTo(y.Name));
                });

                e.Result = courses;
            };
            _worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                if (_RunningID != PrimaryKey)
                {
                    _RunningID = PrimaryKey;
                    _worker.RunWorkerAsync(_RunningID);
                    return;
                }

                ResetListView();
                PrefillItems(e.Result as List <JHCourseRecord>);
            };
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 設定使用者介面
        /// </summary>
        public void SetupPresentation()
        {
            if (_initialize)
            {
                return;
            }

            programPlanCache = new Dictionary <string, JHProgramPlanRecord>();

            _classProgramPlanField.PreloadVariableBackground += delegate
            {
                foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll())
                {
                    if (!programPlanCache.ContainsKey(record.ID))
                    {
                        programPlanCache.Add(record.ID, record);
                    }
                }
            };

            _classProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                JHProgramPlanRecord record = GetProgramPlan(JHClass.SelectByID(e.Key));

                if (record != null)
                {
                    e.Value = record.Name;
                }
                else
                {
                    e.Value = "";
                }
            };
            K12.Presentation.NLDPanels.Class.AddListPaneField(_classProgramPlanField);

            _studentProgramPlanField.PreloadVariableBackground += delegate
            {
                foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll())
                {
                    if (!programPlanCache.ContainsKey(record.ID))
                    {
                        programPlanCache.Add(record.ID, record);
                    }
                }
            };

            _studentProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                JHStudentRecord     stu    = JHStudent.SelectByID(e.Key);
                JHProgramPlanRecord record = GetProgramPlan(stu);
                if (record != null)
                {
                    e.Value = string.IsNullOrEmpty(stu.OverrideProgramPlanID) ? record.Name : "(指定)" + record.Name;
                }
                else
                {
                    e.Value = "";
                }
            };
            K12.Presentation.NLDPanels.Student.AddListPaneField(_studentProgramPlanField);

            JHClass.AfterUpdate += delegate
            {
                _classProgramPlanField.Reload();
            };

            JHStudent.AfterUpdate += delegate
            {
                _studentProgramPlanField.Reload();
            };

            AddAssignProgramPlanButtons();

            _initialize = true;
        }
Ejemplo n.º 18
0
        // save
        private void SemesterHistoryDetail_SaveButtonClick(object sender, EventArgs e)
        {
            // 資料檢查
            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }
                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (cell.ErrorText != "")
                    {
                        MsgBox.Show("資料有疑問無法儲存,請檢查標紅色儲存格.", "儲存失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            JHSchool.Data.JHSemesterHistoryRecord updateSemeHsitoryRec = new JHSchool.Data.JHSemesterHistoryRecord();

            updateSemeHsitoryRec.RefStudentID = PrimaryKey;

            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                int SchoolYear = 0, Semester = 0, GradeYear = 0, SchoolDayCount = 0, SeatNo = 0;

                if (row.IsNewRow)
                {
                    continue;
                }
                K12.Data.SemesterHistoryItem shi = new K12.Data.SemesterHistoryItem();

                if (row.Cells[colSchoolYear.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSchoolYear.Index].Value, out SchoolYear);
                }

                if (row.Cells[colSemester.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSemester.Index].Value, out Semester);
                }

                if (row.Cells[colGradeYear.Index] != null)
                {
                    int.TryParse("" + row.Cells[colGradeYear.Index].Value, out GradeYear);
                }

                if (row.Cells[colSchoolDayCount.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSchoolDayCount.Index].Value, out SchoolDayCount);
                }

                if (row.Cells[colSeatNo.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSeatNo.Index].Value, out SeatNo);
                }

                shi.SchoolYear = SchoolYear;
                shi.Semester   = Semester;
                shi.GradeYear  = GradeYear;
                if (row.Cells[colClassName.Index] != null)
                {
                    shi.ClassName = row.Cells[colClassName.Index].Value + "";
                }

                if (SeatNo == 0)
                {
                    shi.SeatNo = null;
                }
                else
                {
                    shi.SeatNo = SeatNo;
                }

                if (row.Cells[colTeacherName.Index] != null)
                {
                    shi.Teacher = row.Cells[colTeacherName.Index].Value + "";
                }

                if (SchoolDayCount == 0)
                {
                    shi.SchoolDayCount = null;
                }
                else
                {
                    shi.SchoolDayCount = SchoolDayCount;
                }

                updateSemeHsitoryRec.SemesterHistoryItems.Add(shi);

                string logIdxStr = shi.SchoolYear + "" + shi.Semester + "_";
                prlp.SetAfterSaveText(logIdxStr + "學年度", shi.SchoolYear + "");
                prlp.SetAfterSaveText(logIdxStr + "學期", shi.Semester + "");
                prlp.SetAfterSaveText(logIdxStr + "年級", shi.GradeYear + "");
                prlp.SetAfterSaveText(logIdxStr + "班級", shi.ClassName);
                prlp.SetAfterSaveText(logIdxStr + "座號", SeatNo + "");
                prlp.SetAfterSaveText(logIdxStr + "班導師", shi.Teacher);
                prlp.SetAfterSaveText(logIdxStr + "上課天數", SchoolDayCount + "");
            }

            JHSchool.Data.JHSemesterHistory.Update(updateSemeHsitoryRec);


            prlp.SetActionBy("學籍", "學生學期對照表");
            prlp.SetAction("修改學生學期對照表");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");

            prlp.SaveLog("", "", "student", PrimaryKey);

            this.CancelButtonVisible = false;
            this.SaveButtonVisible   = false;
        }
Ejemplo n.º 19
0
        internal static void Init()
        {
            #region ContentItem 資料項目
            //學期成績
            //Student.Instance.AddDetailBulider(new DetailBulider<StudentExtendControls.SemesterScoreItem>());
            //修課及評量成績
            Student.Instance.AddDetailBulider(new DetailBulider <StudentExtendControls.CourseScoreItem>());
            #endregion

            #region RibbonBar

            #region 學生/資料統計/匯入匯出
            RibbonBarButton rbItemExport = Student.Instance.RibbonBarItems["資料統計"]["匯出"];
            RibbonBarButton rbItemImport = Student.Instance.RibbonBarItems["資料統計"]["匯入"];

            rbItemExport["成績相關匯出"]["匯出學期科目成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0180"].Executable;
            rbItemExport["成績相關匯出"]["匯出學期科目成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportSemesterSubjectScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出學期領域成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0181"].Executable;
            rbItemExport["成績相關匯出"]["匯出學期領域成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportSemesterDomainScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出畢業成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0182"].Executable;
            rbItemExport["成績相關匯出"]["匯出畢業成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportGradScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出評量成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0184"].Executable;
            rbItemExport["成績相關匯出"]["匯出評量成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportExamScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            rbItemImport["成績相關匯入"]["匯入學期科目成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0190"].Executable;
            rbItemImport["成績相關匯入"]["匯入學期科目成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportSemesterSubjectScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();

                _eh(null, EventArgs.Empty);
            };
            rbItemImport["成績相關匯入"]["匯入學期領域成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0191"].Executable;
            rbItemImport["成績相關匯入"]["匯入學期領域成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportSemesterDomainScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();

                _eh(null, EventArgs.Empty);
            };
            rbItemImport["成績相關匯入"]["匯入畢業成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0192"].Executable;
            rbItemImport["成績相關匯入"]["匯入畢業成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportGradScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();
            };
            rbItemImport["成績相關匯入"]["匯入評量成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0194"].Executable;
            rbItemImport["成績相關匯入"]["匯入評量成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportExamScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();
            };
            #endregion

            #region 學生/成績
            //移到其他模組了。

            //RibbonBarItem rbItem = Student.Instance.RibbonBarItems["成績"];

            //rbItem["計算成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0057"].Executable;
            //rbItem["計算成績"].Image = KaoHsiung.JHEvaluation.Properties.Resources.calcScore;
            //rbItem["計算成績"]["計算學期成績"].Click += delegate
            //{
            //    if (K12.Presentation.NLDPanels.Student.SelectedSource.Count == 0) return;

            //    System.Windows.Forms.Form form = new KaoHsiung.JHEvaluation.StudentExtendControls.Ribbon.CalculationWizardStudent("Student");
            //    form.ShowDialog();
            //};
            //rbItem["計算成績"]["計算畢業成績"].Click += delegate
            //{
            //    if (K12.Presentation.NLDPanels.Student.SelectedSource.Count == 0) return;

            //    KaoHsiung.JHEvaluation.StudentExtendControls.Ribbon.GraduationScoreCalculation.Calculate(Student.Instance.SelectedList);
            //};
            #endregion

            #endregion

            #region Register Standard Function
            JHSchool.SF.Evaluation.QuickInputSemesterScoreForm.RegisterHandler(delegate(string studentId)
            {
                KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.QuickInputSemesterScoreForm form;
                form = new KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.QuickInputSemesterScoreForm(JHStudent.SelectByID(studentId));
                return(form.ShowDialog());
            });
            //JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId)
            //{
            //    KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor form;
            //    form = new KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor(Student.Instance[studentId]);
            //    return form.ShowDialog();
            //});
            //JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId, int schoolYear, int semester)
            //{
            //    KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor form;
            //    form = new KaoHsiung.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor(Student.Instance[studentId], JHSchool.Data.JHSemesterScore.SelectBySchoolYearAndSemester(studentId, schoolYear, semester));
            //    return form.ShowDialog();
            //});
            #endregion
        }
Ejemplo n.º 20
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <ExcelRow> rows = new List <ExcelRow>();

            #region 整理成一行一行
            foreach (string studentID in Info.DuplicateAttendInfo.Keys)
            {
                JHStudentRecord student = JHStudent.SelectByID(studentID);
                foreach (string subject in Info.DuplicateAttendInfo[studentID].Keys)
                {
                    ExcelRow row = new ExcelRow(student);
                    row.SetSubject(subject);
                    row.SetCourceIDs(Info.DuplicateAttendInfo[studentID][subject]);

                    rows.Add(row);
                }
            }
            #endregion

            rows.Sort(delegate(ExcelRow x, ExcelRow y)
            {
                if (x.ClassName == y.ClassName)
                {
                    int seatNoX, seatNoY;
                    if (!int.TryParse(x.SeatNo, out seatNoX))
                    {
                        seatNoX = int.MaxValue;
                    }
                    if (!int.TryParse(y.SeatNo, out seatNoY))
                    {
                        seatNoY = int.MaxValue;
                    }

                    if (seatNoX == seatNoY)
                    {
                        return(JHSchool.Evaluation.Subject.CompareSubjectOrdinal(x.Subject, y.Subject));
                    }
                    else
                    {
                        return(seatNoX.CompareTo(seatNoY));
                    }
                }
                else
                {
                    return(x.ClassName.CompareTo(y.ClassName));
                }
            });

            Workbook template = new Workbook();
            template.Open(new MemoryStream(Properties.Resources.重覆修課學生清單));
            Range tempRow = template.Worksheets[0].Cells.CreateRange(2, 1, false);

            Workbook book = new Workbook();
            book.Open(new MemoryStream(Properties.Resources.重覆修課學生清單));

            Worksheet ws = book.Worksheets[0];

            #region 填入 Excel
            double total = rows.Count;
            double count = 0;

            ws.Cells[0, 0].PutValue(string.Format("{0} 學年度 第 {1} 學期 學生學期修課檢查表", SchoolYear, Semester));

            int rowIndex = 2;
            foreach (ExcelRow row in rows)
            {
                count++;

                int colIndex = 0;
                ws.Cells.CreateRange(rowIndex, 1, false).Copy(tempRow);

                ws.Cells[rowIndex, colIndex++].PutValue(row.ClassName);
                ws.Cells[rowIndex, colIndex++].PutValue(row.SeatNo);
                ws.Cells[rowIndex, colIndex++].PutValue(row.StudentNumber);
                ws.Cells[rowIndex, colIndex++].PutValue(row.StudentName);
                ws.Cells[rowIndex, colIndex++].PutValue(row.Subject);
                ws.Cells[rowIndex, colIndex++].PutValue(row.CourseNames);

                rowIndex++;

                Worker.ReportProgress((int)(count * 100 / total));
            }
            #endregion

            e.Result = book;
        }
Ejemplo n.º 21
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            //// 當輸入沒有 鄰自動補
            //if (!string.IsNullOrEmpty(txtArea.Text))
            //{
            //    if (txtArea.Text.IndexOf("鄰") == -1)
            //        txtArea.Text += "鄰";
            //}

            // 檢查畫面儲存相對應
            if (_address_type == AddressType.Permanent)
            {
                _StudAddressRec.Permanent.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Permanent.County    = cboCounty.Text;
                _StudAddressRec.Permanent.Town      = cboTown.Text;
                _StudAddressRec.Permanent.District  = txtDistrict.Text;
                _StudAddressRec.Permanent.Area      = txtArea.Text;
                _StudAddressRec.Permanent.Detail    = txtDetail.Text;
                _StudAddressRec.Permanent.Longitude = txtLongtitude.Text;
                _StudAddressRec.Permanent.Latitude  = txtLatitude.Text;
            }

            if (_address_type == AddressType.Mailing)
            {
                _StudAddressRec.Mailing.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Mailing.County    = cboCounty.Text;
                _StudAddressRec.Mailing.Town      = cboTown.Text;
                _StudAddressRec.Mailing.District  = txtDistrict.Text;
                _StudAddressRec.Mailing.Area      = txtArea.Text;
                _StudAddressRec.Mailing.Detail    = txtDetail.Text;
                _StudAddressRec.Mailing.Longitude = txtLongtitude.Text;
                _StudAddressRec.Mailing.Latitude  = txtLatitude.Text;
            }

            if (_address_type == AddressType.Other)
            {
                _StudAddressRec.Address1.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Address1.County    = cboCounty.Text;
                _StudAddressRec.Address1.Town      = cboTown.Text;
                _StudAddressRec.Address1.District  = txtDistrict.Text;
                _StudAddressRec.Address1.Area      = txtArea.Text;
                _StudAddressRec.Address1.Detail    = txtDetail.Text;
                _StudAddressRec.Address1.Longitude = txtLongtitude.Text;
                _StudAddressRec.Address1.Latitude  = txtLatitude.Text;
            }

            prlp.SetAfterSaveText("戶籍郵遞區號", _StudAddressRec.Permanent.ZipCode);
            prlp.SetAfterSaveText("戶籍縣市", _StudAddressRec.Permanent.County);
            prlp.SetAfterSaveText("戶籍鄉鎮市區", _StudAddressRec.Permanent.Town);
            prlp.SetAfterSaveText("戶籍村里", _StudAddressRec.Permanent.District);
            prlp.SetAfterSaveText("戶籍鄰", _StudAddressRec.Permanent.Area);
            prlp.SetAfterSaveText("戶籍其它地址", _StudAddressRec.Permanent.Detail);
            prlp.SetAfterSaveText("戶籍經度", _StudAddressRec.Permanent.Longitude);
            prlp.SetAfterSaveText("戶籍緯度", _StudAddressRec.Permanent.Latitude);
            prlp.SetAfterSaveText("聯絡郵遞區號", _StudAddressRec.Mailing.ZipCode);
            prlp.SetAfterSaveText("聯絡縣市", _StudAddressRec.Mailing.County);
            prlp.SetAfterSaveText("聯絡鄉鎮市區", _StudAddressRec.Mailing.Town);
            prlp.SetAfterSaveText("聯絡村里", _StudAddressRec.Mailing.District);
            prlp.SetAfterSaveText("聯絡鄰", _StudAddressRec.Mailing.Area);
            prlp.SetAfterSaveText("聯絡其它地址", _StudAddressRec.Mailing.Detail);
            prlp.SetAfterSaveText("聯絡經度", _StudAddressRec.Mailing.Longitude);
            prlp.SetAfterSaveText("聯絡緯度", _StudAddressRec.Mailing.Latitude);
            prlp.SetAfterSaveText("其它郵遞區號", _StudAddressRec.Address1.ZipCode);
            prlp.SetAfterSaveText("其它縣市", _StudAddressRec.Address1.County);
            prlp.SetAfterSaveText("其它鄉鎮市區", _StudAddressRec.Address1.Town);
            prlp.SetAfterSaveText("其它村里", _StudAddressRec.Address1.District);
            prlp.SetAfterSaveText("其它鄰", _StudAddressRec.Address1.Area);
            prlp.SetAfterSaveText("其它其它地址", _StudAddressRec.Address1.Detail);
            prlp.SetAfterSaveText("其它經度", _StudAddressRec.Address1.Longitude);
            prlp.SetAfterSaveText("其它緯度", _StudAddressRec.Address1.Latitude);

            _errors.Clear();
            JHAddress.Update(_StudAddressRec);
            prlp.SetActionBy("學籍", "學生地址資訊");
            prlp.SetAction("修改學生地址資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            prlp.SaveLog("", "", "student", PrimaryKey);
            BindDataToForm();
        }
Ejemplo n.º 22
0
        public ImportStartupForm()
        {
            InitializeComponent();
            InitializeSemesters();

            _effortMapper = new EffortMapper();

            // 載入預設儲存值
            LoadConfigData();

            _worker = new BackgroundWorker();
            _worker.WorkerReportsProgress = true;
            _worker.ProgressChanged      += delegate(object sender, ProgressChangedEventArgs e)
            {
                lblMessage.Text = "" + e.UserState;
            };
            _worker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                #region Worker DoWork
                _worker.ReportProgress(0, "檢查讀卡文字格式…");

                #region 檢查文字檔
                ValidateTextFiles  vtf      = new ValidateTextFiles(intStudentNumberLenght.Value);
                ValidateTextResult vtResult = vtf.CheckFormat(_files);
                if (vtResult.Error)
                {
                    e.Result = vtResult;
                    return;
                }
                #endregion

                //文字檔轉 RawData
                RawDataCollection rdCollection = new RawDataCollection();
                rdCollection.ConvertFromFiles(_files);

                //RawData 轉 DataRecord
                DataRecordCollection drCollection = new DataRecordCollection();
                drCollection.ConvertFromRawData(rdCollection);

                _rawDataValidator    = new DataValidator <RawData>();
                _dataRecordValidator = new DataValidator <DataRecord>();

                #region 取得驗證需要的資料
                JHCourse.RemoveAll();
                _worker.ReportProgress(0, "取得學生資料…");
                List <JHStudentRecord> studentList = GetInSchoolStudents();

                List <string> s_ids = new List <string>();
                Dictionary <string, List <string> > studentNumberToStudentIDs = new Dictionary <string, List <string> >();
                foreach (JHStudentRecord student in studentList)
                {
                    string sn = SCValidatorCreator.GetStudentNumberFormat(student.StudentNumber);
                    if (!studentNumberToStudentIDs.ContainsKey(sn))
                    {
                        studentNumberToStudentIDs.Add(sn, new List <string>());
                    }
                    studentNumberToStudentIDs[sn].Add(student.ID);
                }
                foreach (var dr in drCollection)
                {
                    if (studentNumberToStudentIDs.ContainsKey(dr.StudentNumber))
                    {
                        s_ids.AddRange(studentNumberToStudentIDs[dr.StudentNumber]);
                    }
                }

                studentList.Clear();

                _worker.ReportProgress(0, "取得課程資料…");
                List <JHCourseRecord>    courseList = JHCourse.SelectBySchoolYearAndSemester(SchoolYear, Semester);
                List <JHAEIncludeRecord> aeList     = JHAEInclude.SelectAll();

                //List<JHSCAttendRecord> scaList = JHSCAttend.SelectAll();
                var c_ids = from course in courseList select course.ID;
                _worker.ReportProgress(0, "取得修課資料…");
                //List<JHSCAttendRecord> scaList2 = JHSCAttend.SelectByStudentIDAndCourseID(s_ids, c_ids.ToList<string>());
                List <JHSCAttendRecord> scaList = new List <JHSCAttendRecord>();
                FunctionSpliter <string, JHSCAttendRecord> spliter = new FunctionSpliter <string, JHSCAttendRecord>(300, 3);
                spliter.Function = delegate(List <string> part)
                {
                    return(JHSCAttend.Select(part, c_ids.ToList <string>(), null, SchoolYear.ToString(), Semester.ToString()));
                };
                scaList = spliter.Execute(s_ids);

                _worker.ReportProgress(0, "取得試別資料…");
                List <JHExamRecord> examList = JHExam.SelectAll();
                #endregion

                #region 註冊驗證
                _worker.ReportProgress(0, "載入驗證規則…");
                _rawDataValidator.Register(new SubjectCodeValidator());
                _rawDataValidator.Register(new ClassCodeValidator());
                _rawDataValidator.Register(new ExamCodeValidator());

                SCValidatorCreator scCreator = new SCValidatorCreator(JHStudent.SelectByIDs(s_ids), courseList, scaList);
                _dataRecordValidator.Register(scCreator.CreateStudentValidator());
                _dataRecordValidator.Register(new ExamValidator(examList));
                _dataRecordValidator.Register(scCreator.CreateSCAttendValidator());
                _dataRecordValidator.Register(new CourseExamValidator(scCreator.StudentCourseInfo, aeList, examList));
                #endregion

                #region 進行驗證
                _worker.ReportProgress(0, "進行驗證中…");
                List <string> msgList = new List <string>();

                foreach (RawData rawData in rdCollection)
                {
                    List <string> msgs = _rawDataValidator.Validate(rawData);
                    msgList.AddRange(msgs);
                }
                if (msgList.Count > 0)
                {
                    e.Result = msgList;
                    return;
                }

                foreach (DataRecord dataRecord in drCollection)
                {
                    List <string> msgs = _dataRecordValidator.Validate(dataRecord);
                    msgList.AddRange(msgs);
                }
                if (msgList.Count > 0)
                {
                    e.Result = msgList;
                    return;
                }
                #endregion

                #region 取得學生的評量成績
                _deleteScoreList.Clear();
                _addScoreList.Clear();

                //var student_ids = from student in scCreator.StudentNumberDictionary.Values select student.ID;
                //List<string> course_ids = scCreator.AttendCourseIDs;

                var scaIDs = from sca in scaList select sca.ID;

                Dictionary <string, JHSCETakeRecord>      sceList    = new Dictionary <string, JHSCETakeRecord>();
                FunctionSpliter <string, JHSCETakeRecord> spliterSCE = new FunctionSpliter <string, JHSCETakeRecord>(300, 3);
                spliterSCE.Function = delegate(List <string> part)
                {
                    return(JHSCETake.Select(null, null, null, null, part));
                };
                foreach (JHSCETakeRecord sce in spliterSCE.Execute(scaIDs.ToList()))
                {
                    string key = GetCombineKey(sce.RefStudentID, sce.RefCourseID, sce.RefExamID);
                    if (!sceList.ContainsKey(key))
                    {
                        sceList.Add(key, sce);
                    }
                }

                Dictionary <string, JHExamRecord>     examTable = new Dictionary <string, JHExamRecord>();
                Dictionary <string, JHSCAttendRecord> scaTable  = new Dictionary <string, JHSCAttendRecord>();

                foreach (JHExamRecord exam in examList)
                {
                    if (!examTable.ContainsKey(exam.Name))
                    {
                        examTable.Add(exam.Name, exam);
                    }
                }

                foreach (JHSCAttendRecord sca in scaList)
                {
                    string key = GetCombineKey(sca.RefStudentID, sca.RefCourseID);
                    if (!scaTable.ContainsKey(key))
                    {
                        scaTable.Add(key, sca);
                    }
                }

                foreach (DataRecord dr in drCollection)
                {
                    JHStudentRecord       student = student = scCreator.StudentNumberDictionary[dr.StudentNumber];
                    JHExamRecord          exam    = examTable[dr.Exam];
                    List <JHCourseRecord> courses = new List <JHCourseRecord>();
                    foreach (JHCourseRecord course in scCreator.StudentCourseInfo.GetCourses(dr.StudentNumber))
                    {
                        if (dr.Subjects.Contains(course.Subject))
                        {
                            courses.Add(course);
                        }
                    }

                    foreach (JHCourseRecord course in courses)
                    {
                        string key = GetCombineKey(student.ID, course.ID, exam.ID);

                        if (sceList.ContainsKey(key))
                        {
                            _deleteScoreList.Add(sceList[key]);
                        }

                        JHSCETakeRecord    jh     = new JHSCETakeRecord();
                        KH.JHSCETakeRecord sceNew = new KH.JHSCETakeRecord(jh);
                        sceNew.RefCourseID   = course.ID;
                        sceNew.RefExamID     = exam.ID;
                        sceNew.RefSCAttendID = scaTable[GetCombineKey(student.ID, course.ID)].ID;
                        sceNew.RefStudentID  = student.ID;
                        sceNew.Score         = dr.Score;
                        sceNew.Effort        = _effortMapper.GetCodeByScore(dr.Score);
                        _addScoreList.Add(sceNew.AsJHSCETakeRecord());
                    }
                }
                #endregion

                e.Result = null;
                #endregion
            };
            _worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                #region Worker Completed
                if (e.Error == null && e.Result == null)
                {
                    if (!_upload.IsBusy)
                    {
                        //如果學生身上已有成績,則提醒使用者
                        if (_deleteScoreList.Count > 0)
                        {
                            _warn.RunWorkerAsync();
                        }
                        else
                        {
                            lblMessage.Text = "成績上傳中…";
                            FISCA.Presentation.MotherForm.SetStatusBarMessage("成績上傳中…", 0);
                            counter = 0;
                            _upload.RunWorkerAsync();
                        }
                    }
                }
                else
                {
                    ControlEnable = true;

                    if (e.Error != null)
                    {
                        MsgBox.Show("匯入失敗。" + e.Error.Message);
                        SmartSchool.ErrorReporting.ReportingService.ReportException(e.Error);
                    }
                    else if (e.Result != null && e.Result is ValidateTextResult)
                    {
                        ValidateTextResult    result = e.Result as ValidateTextResult;
                        ValidationErrorViewer viewer = new ValidationErrorViewer();
                        viewer.SetTextFileError(result.LineIndexes, result.ErrorFormatLineIndexes, result.DuplicateLineIndexes);
                        viewer.ShowDialog();
                    }
                    else if (e.Result != null && e.Result is List <string> )
                    {
                        ValidationErrorViewer viewer = new ValidationErrorViewer();
                        viewer.SetErrorLines(e.Result as List <string>);
                        viewer.ShowDialog();
                    }
                }
                #endregion
            };

            _upload = new BackgroundWorker();
            _upload.WorkerReportsProgress = true;
            _upload.ProgressChanged      += new ProgressChangedEventHandler(_upload_ProgressChanged);
            //_upload.ProgressChanged += delegate(object sender, ProgressChangedEventArgs e)
            //{
            //    counter += double.Parse("" + e.ProgressPercentage);
            //    FISCA.Presentation.MotherForm.SetStatusBarMessage("成績上傳中…", (int)(counter * 100f / (double)_addScoreList.Count));
            //};
            _upload.DoWork += new DoWorkEventHandler(_upload_DoWork);

            //_upload.DoWork += delegate
            //{


            //#region Upload DoWork
            //Framework.MultiThreadWorker<JHSCETakeRecord> multi = new Framework.MultiThreadWorker<JHSCETakeRecord>();
            //multi.MaxThreads = 3;
            //multi.PackageSize = 500;
            //multi.PackageWorker += delegate(object sender, Framework.PackageWorkEventArgs<JHSCETakeRecord> e)
            //{
            //    JHSCETake.Delete(e.List);
            //};
            //multi.Run(_deleteScoreList);

            //Framework.MultiThreadWorker<JHSCETakeRecord> multi2 = new Framework.MultiThreadWorker<JHSCETakeRecord>();
            //multi2.MaxThreads = 3;
            //multi2.PackageSize = 500;
            //multi2.PackageWorker += delegate(object sender, Framework.PackageWorkEventArgs<JHSCETakeRecord> e)
            //{
            //    JHSCETake.Insert(e.List);
            //    lock (_upload)
            //    {
            //        _upload.ReportProgress(e.List.Count);
            //    }
            //};
            //multi2.Run(_addScoreList);
            //#endregion
            //};


            _upload.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_upload_RunWorkerCompleted);

            _warn = new BackgroundWorker();
            _warn.WorkerReportsProgress = true;
            _warn.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                _warn.ReportProgress(0, "產生警告訊息...");

                Dictionary <string, string> examDict = new Dictionary <string, string>();
                foreach (JHExamRecord exam in JHExam.SelectAll())
                {
                    if (!examDict.ContainsKey(exam.ID))
                    {
                        examDict.Add(exam.ID, exam.Name);
                    }
                }

                WarningForm form  = new WarningForm();
                int         count = 0;
                foreach (JHSCETakeRecord sce in _deleteScoreList)
                {
                    // 當成績資料是空值跳過
                    if (sce.Score.HasValue == false && sce.Effort.HasValue == false && string.IsNullOrEmpty(sce.Text))
                    {
                        continue;
                    }

                    count++;

                    JHStudentRecord student = JHStudent.SelectByID(sce.RefStudentID);
                    JHCourseRecord  course  = JHCourse.SelectByID(sce.RefCourseID);
                    string          exam    = (examDict.ContainsKey(sce.RefExamID) ? examDict[sce.RefExamID] : "<未知的試別>");

                    string s = "";
                    if (student.Class != null)
                    {
                        s += student.Class.Name;
                    }
                    if (!string.IsNullOrEmpty("" + student.SeatNo))
                    {
                        s += " " + student.SeatNo + "號";
                    }
                    if (!string.IsNullOrEmpty(student.StudentNumber))
                    {
                        s += " (" + student.StudentNumber + ")";
                    }
                    s += " " + student.Name;

                    form.Add(student.ID, s, string.Format("學生在「{0}」課程「{1}」中已有成績。", course.Name, exam));
                    _warn.ReportProgress((int)(count * 100 / _deleteScoreList.Count), "產生警告訊息...");
                }

                e.Result = form;
            };
            _warn.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                WarningForm form = e.Result as WarningForm;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    lblMessage.Text = "成績上傳中…";
                    FISCA.Presentation.MotherForm.SetStatusBarMessage("成績上傳中…", 0);
                    counter = 0;
                    _upload.RunWorkerAsync();
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            };
            _warn.ProgressChanged += delegate(object sender, ProgressChangedEventArgs e)
            {
                FISCA.Presentation.MotherForm.SetStatusBarMessage("" + e.UserState, e.ProgressPercentage);
            };

            _files           = new List <FileInfo>();
            _addScoreList    = new List <JHSCETakeRecord>();
            _deleteScoreList = new List <JHSCETakeRecord>();
        }
Ejemplo n.º 23
0
        public Workbook Output()
        {
            // 取得班級最大人數
            _MaxClassStudCot = 0;

            foreach (JHClassRecord classRec in Classes)
            {
                if (classRec.Students.Count >= _MaxClassStudCot)
                {
                    _MaxClassStudCot = classRec.Students.Count;
                }
            }



            OutputBook = new Workbook();
            OutputBook.Open(GetTemplateStream());
            OutputSheet = OutputBook.Worksheets[0];

            Template.Open(GetTemplateStream());

            int ScoreHeaderCount = (Perference.PaperSize == "B4") ? 32 : 18;

            int ClassOffset  = 0; //整個班級的 Offset。
            int RowOffset    = 0;
            int ColumnOffset = 0;

            Range all = Template.Worksheets.GetRangeByName("All");

            //Range printDate = Template.Worksheets.GetRangeByName("PrintDate");
            //printDate[0, 0].PutValue(DateTime.Today.ToString("yyyy/MM/dd"));

            Range title = Template.Worksheets.GetRangeByName("Title");
            //Range feedback = Template.Worksheets.GetRangeByName("Feedback");
            Range rowHeaders       = Template.Worksheets.GetRangeByName("RowHeaders");
            Range columnHeaders    = Template.Worksheets.GetRangeByName("ColumnHeaders");
            Range rankColumnHeader = Template.Worksheets.GetRangeByName("RankColumnHeader");

            int RowNumber     = all.RowCount;
            int DataRowNumber = rowHeaders.RowCount;

            //排序班級。
            Classes.Sort(new Comparison <JHClassRecord>(Utilities.JHClassRecordComparison));

            int summaryHeaderOffset = ScoreHeaderCount - Perference.PrintItems.Count;

            foreach (string each in Perference.PrintItems)
            {
                columnHeaders[0, summaryHeaderOffset].PutValue(each);
                summaryHeaderOffset++;
            }

            foreach (JHClassRecord each in Classes)
            {
                OutputSheet.Cells.CreateRange(ClassOffset, RowNumber, false).Copy(all);

                //轉換成 ReportStudent。
                List <ReportStudent> pageStudent = GetPreparedStudent(each.Students);
                pageStudent.Sort(delegate(ReportStudent x, ReportStudent y)
                {//將學生按座號排序。
                    return(x.OrderSeatNo.CompareTo(y.OrderSeatNo));
                });

                //描述要印出來的科目、領域有哪些。
                ScoreHeaderIndexer headers = new ScoreHeaderIndexer();
                foreach (ReportStudent eachStu in pageStudent)
                {
                    foreach (string eachSubj in SelectedSubject)
                    {
                        if (eachStu.Scores[Utilities.SubjectToken].Contains(eachSubj))
                        {
                            if (!headers.Contains(eachSubj, false)) // eachStu.Scores[Utilities.SubjectToken].Weights[eachSubj]))
                            {
                                headers.Add(eachSubj, false, eachStu.Scores[Utilities.SubjectToken].Weights[eachSubj]);
                            }
                        }
                    }

                    foreach (string eachDomain in SelectedDomain)
                    {
                        if (eachStu.Scores[Utilities.DomainToken].Contains(eachDomain))
                        {
                            if (!headers.Contains(eachDomain, true)) //eachStu.Scores[Utilities.DomainToken].Weights[eachDomain]))
                            {
                                headers.Add(eachDomain, true, eachStu.Scores[Utilities.DomainToken].Weights[eachDomain]);
                            }
                        }
                    }
                }

                headers.Sort(SubjectDomainMap); //排序資料。

                //填入科目、領域資料。
                RowOffset    = columnHeaders.FirstRow + ClassOffset;
                ColumnOffset = columnHeaders.FirstColumn;
                foreach (Header eachHeacher in headers)
                {
                    if (eachHeacher.IsDomain)
                    {
                        OutputSheet.Cells[RowOffset, ColumnOffset].Style.Font.IsBold = true;
                    }

                    OutputSheet.Cells[RowOffset, ColumnOffset].PutValue(eachHeacher.Name);
                    OutputSheet.Cells[RowOffset + 1, ColumnOffset].PutValue(eachHeacher.GetDisplayCredit());
                    eachHeacher.ColumnIndex = ColumnOffset;
                    ColumnOffset++;
                }

                //填入學生清單、成績與排名資料。
                RowOffset = rowHeaders.FirstRow + ClassOffset;
                foreach (ReportStudent eachStudent in pageStudent)
                {
                    OutputSheet.Cells[RowOffset, 0].PutValue(eachStudent.SeatNo);
                    OutputSheet.Cells[RowOffset, 1].PutValue(eachStudent.Name);

                    //填入科目成績。
                    foreach (string eachSubj in SelectedSubject)
                    {
                        ScoreCollection scores = eachStudent.Scores[Utilities.SubjectToken];

                        if (scores.Contains(eachSubj) && headers.Contains(eachSubj, false)) // scores.Weights[eachSubj]))
                        {
                            int headerIndex = headers[eachSubj, false].ColumnIndex;
                            OutputSheet.Cells[RowOffset, headerIndex].PutValue((double)scores[eachSubj]);
                        }
                    }

                    //填入領域成績。
                    foreach (string eachDomain in SelectedDomain)
                    {
                        ScoreCollection scores = eachStudent.Scores[Utilities.DomainToken];

                        if (scores.Contains(eachDomain) && headers.Contains(eachDomain, true))// scores.Weights[eachDomain]))
                        {
                            int    headerIndex = headers[eachDomain, true].ColumnIndex;
                            double value       = 0;
                            string ruleID      = GetScoreCalcRuleID(JHStudent.SelectByID(eachStudent.Id));
                            if (string.IsNullOrEmpty(ruleID))
                            {
                                value = (double)DefaultCalc.ParseDomainScore(scores[eachDomain]);
                            }
                            else if (Calcs.ContainsKey(ruleID))
                            {
                                value = (double)Calcs[ruleID].ParseDomainScore(scores[eachDomain]);
                            }
                            OutputSheet.Cells[RowOffset, headerIndex].PutValue(value);
                        }
                    }

                    //填入運算成績。
                    int             summaryDataOffset = (columnHeaders.FirstColumn + ScoreHeaderCount) - Perference.PrintItems.Count;
                    ScoreCollection summaryScores     = eachStudent.Scores[Utilities.SummaryToken];
                    foreach (string eachSummary in Perference.PrintItems)
                    {
                        if (summaryScores.Contains(eachSummary))
                        {
                            // 當0分布顯示
                            if (summaryScores[eachSummary] <= 0)
                            {
                                OutputSheet.Cells[RowOffset, summaryDataOffset].PutValue("");
                            }
                            else
                            {
                                OutputSheet.Cells[RowOffset, summaryDataOffset].PutValue(summaryScores[eachSummary]);
                            }
                        }
                        summaryDataOffset++;
                    }

                    //填入排名資料。
                    string rm = Perference.RankMethod; //排名依據。
                    if (eachStudent.Places.NS("班排名").Contains(rm))
                    {
                        OutputSheet.Cells[RowOffset, rankColumnHeader.FirstColumn].PutValue(eachStudent.Places.NS("班排名")[rm].Level);
                    }
                    if (eachStudent.Places.NS("年排名").Contains(rm))
                    {
                        OutputSheet.Cells[RowOffset, rankColumnHeader.FirstColumn + 1].PutValue(eachStudent.Places.NS("年排名")[rm].Level);
                    }

                    RowOffset++;
                    //if ((RowOffset - (rowHeaders.FirstRow + ClassOffset)) >= 45) break; //超過45個學生就不印了。
                }

                #region 填入標題及回條
                //Ex. 新竹市立光華國民中學 97 學年度第 1 學期    101  第1次平時評量成績單
                OutputSheet.Cells[title.FirstRow + ClassOffset, title.FirstColumn].PutValue(string.Format("{0} {1}學年度第{2}學期 {4} {3} 班級評量成績單", SchoolName, SchoolYear, Semester, ExamName, each.Name));
                //Ex. 101 第1次平時評量回條 (家長意見欄)
                //OutputSheet.Cells[feedback.FirstRow + ClassOffset, feedback.FirstColumn].PutValue(string.Format("{0} 班級評量成績單回條  (家長意見欄)", each.Name));
                #endregion

                ClassOffset += RowNumber;
                OutputSheet.HPageBreaks.Add(ClassOffset, 0);
            }

            //OutputSheet.Cells.HideColumn((byte)rankColumnHeader.FirstColumn - 1);

            //Utilities.Save(OutputBook, "班級學期成績單.xls");
            return(OutputBook);
        }
Ejemplo n.º 24
0
        internal static void Init()
        {
            #region ContentItem 資料項目
            //學期成績
            //Student.Instance.AddDetailBulider(new DetailBulider<HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItem>());
            //修課及評量成績
            Student.Instance.AddDetailBulider(new DetailBulider <HsinChu.JHEvaluation.StudentExtendControls.CourseScoreItem>());
            #endregion

            #region 學生/資料統計/匯入匯出
            RibbonBarButton rbItemExport = Student.Instance.RibbonBarItems["資料統計"]["匯出"];
            RibbonBarButton rbItemImport = Student.Instance.RibbonBarItems["資料統計"]["匯入"];

            rbItemExport["成績相關匯出"]["匯出學期科目成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0180"].Executable;
            rbItemExport["成績相關匯出"]["匯出學期科目成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportSemesterSubjectScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出學期領域成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0181"].Executable;
            rbItemExport["成績相關匯出"]["匯出學期領域成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportSemesterDomainScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出畢業成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0182"].Executable;
            rbItemExport["成績相關匯出"]["匯出畢業成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportGradScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };
            rbItemExport["成績相關匯出"]["匯出評量成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0184"].Executable;
            rbItemExport["成績相關匯出"]["匯出評量成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter           exporter = new ImportExport.ExportExamScore();
                JHSchool.Evaluation.ImportExport.ExportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            rbItemImport["成績相關匯入"]["匯入學期科目成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0190"].Executable;
            rbItemImport["成績相關匯入"]["匯入學期科目成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportSemesterSubjectScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();

                _eh(null, EventArgs.Empty);
            };
            rbItemImport["成績相關匯入"]["匯入學期領域成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0191"].Executable;
            rbItemImport["成績相關匯入"]["匯入學期領域成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportSemesterDomainScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();

                _eh(null, EventArgs.Empty);
            };
            rbItemImport["成績相關匯入"]["匯入畢業成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0192"].Executable;
            rbItemImport["成績相關匯入"]["匯入畢業成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportGradScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();
            };
            rbItemImport["成績相關匯入"]["匯入評量成績"].Enable = Framework.User.Acl["JHSchool.Student.Ribbon0194"].Executable;
            rbItemImport["成績相關匯入"]["匯入評量成績"].Click += delegate
            {
                SmartSchool.API.PlugIn.Import.Importer           importer = new ImportExport.ImportExamScore();
                JHSchool.Evaluation.ImportExport.ImportStudentV2 wizard   = new JHSchool.Evaluation.ImportExport.ImportStudentV2(importer.Text, importer.Image);
                importer.InitializeImport(wizard);
                wizard.ShowDialog();
            };
            #endregion

            #region Standard Function
            JHSchool.SF.Evaluation.QuickInputSemesterScoreForm.RegisterHandler(delegate(string studentId)
            {
                HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.QuickInputSemesterScoreForm form;
                form = new HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.QuickInputSemesterScoreForm(JHStudent.SelectByID(studentId));
                return(form.ShowDialog());
            });
            //JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId)
            //{
            //    HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor form;
            //    form = new HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor(Student.Instance[studentId]);
            //    return form.ShowDialog();
            //});
            //JHSchool.SF.Evaluation.SemesterScoreEditor.RegisterHandler(delegate(string studentId, int schoolYear, int semester)
            //{
            //    HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor form;
            //    form = new HsinChu.JHEvaluation.StudentExtendControls.SemesterScoreItemRelated.SemesterScoreEditor(Student.Instance[studentId], JHSchool.Data.JHSemesterScore.SelectBySchoolYearAndSemester(studentId, schoolYear, semester));
            //    return form.ShowDialog();
            //});
            #endregion
        }
Ejemplo n.º 25
0
        void bkwNotPassComputer_DoWork(object sender, DoWorkEventArgs e)
        {
            string        fileName         = (string)((object[])e.Argument)[0];
            List <string> studentFieldList = (List <string>)((object[])e.Argument)[1];
            List <string> exportFieldList  = (List <string>)((object[])e.Argument)[2];
            Dictionary <ManualResetEvent, List <RowData> > Filler = (Dictionary <ManualResetEvent, List <RowData> >)((object[])e.Argument)[3];
            double   totleProgress   = 0.0;
            double   packageProgress = 100.0 / Filler.Count;
            Workbook report          = new Workbook();

            report.Worksheets[0].Name = _Title;
            ((BackgroundWorker)sender).ReportProgress(1, _Title + " 資料整理中...");
            int RowIndex = 0;
            int i        = 0;

            //填表頭
            for (; i < studentFieldList.Count; i++)
            {
                report.Worksheets[0].Cells[0, i].PutValue(studentFieldList[i]);
            }
            for (int j = 0; j < exportFieldList.Count; j++)
            {
                report.Worksheets[0].Cells[0, i + j].PutValue(exportFieldList[j]);
            }
            RowIndex = 1;
            foreach (ManualResetEvent eve in Filler.Keys)
            {
                eve.WaitOne();
                if (RowIndex <= 65535)
                {
                    double miniProgress = Filler[eve].Count == 0 ? 1 : packageProgress / Filler[eve].Count;
                    double miniTotle    = 0;
                    foreach (RowData row in Filler[eve])
                    {
                        JHStudentRecord student = null;
                        if (row.ID != "")
                        {
                            student = JHStudent.SelectByID(row.ID);
                        }

                        if (student != null)
                        {
                            if (RowIndex <= 65535)
                            {
                                i = 0;
                                for (; i < studentFieldList.Count; i++)
                                {
                                    switch (studentFieldList[i])
                                    {
                                    case "學生系統編號": report.Worksheets[0].Cells[RowIndex, i].PutValue(student.ID); break;

                                    case "學號": report.Worksheets[0].Cells[RowIndex, i].PutValue(student.StudentNumber); break;

                                    case "班級": report.Worksheets[0].Cells[RowIndex, i].PutValue(student.Class == null ? "" : student.Class.Name); break;

                                    case "座號": report.Worksheets[0].Cells[RowIndex, i].PutValue(student.SeatNo); break;

                                    case "姓名": report.Worksheets[0].Cells[RowIndex, i].PutValue(student.Name); break;

                                    default:
                                        break;
                                    }
                                }
                                for (int j = 0; j < exportFieldList.Count; j++)
                                {
                                    report.Worksheets[0].Cells[RowIndex, i + j].PutValue(row.ContainsKey(exportFieldList[j]) ? row[exportFieldList[j]] : "");
                                }
                            }
                            RowIndex++;
                        }
                        miniTotle += miniProgress;
                        ((BackgroundWorker)sender).ReportProgress((int)(totleProgress + miniTotle), _Title + " 處理中...");
                    }
                }
                totleProgress += packageProgress;
                ((BackgroundWorker)sender).ReportProgress((int)(totleProgress), _Title + " 處理中...");
            }
            for (int k = 0; k < studentFieldList.Count + exportFieldList.Count; k++)
            {
                report.Worksheets[0].AutoFitColumn(k, 0, 150);
            }
            report.Worksheets[0].FreezePanes(1, 0, 1, studentFieldList.Count + exportFieldList.Count);
            e.Result = new object[] { report, fileName, RowIndex > 65535 };
        }
Ejemplo n.º 26
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            // 回存資料
            if (_ParentType == ParentType.Guardian)
            {
                _StudParentRec.Custodian.EducationDegree = cboEduDegree.Text;
                _StudParentRec.Custodian.IDNumber        = txtIDNumber.Text;
                _StudParentRec.Custodian.Job             = cboJob.Text;
                _StudParentRec.Custodian.Name            = txtParentName.Text;
                _StudParentRec.Custodian.Nationality     = cboNationality.Text;
                _StudParentRec.Custodian.Phone           = txtParentPhone.Text;
                _StudParentRec.Custodian.Relationship    = cboRelationship.Text;
                _StudParentRec.Custodian.EMail           = txtEMail.Text;
            }

            if (_ParentType == ParentType.Father)
            {
                _StudParentRec.Father.EducationDegree = cboEduDegree.Text;
                _StudParentRec.Father.IDNumber        = txtIDNumber.Text;
                _StudParentRec.Father.Job             = cboJob.Text;
                _StudParentRec.Father.Living          = cboAlive.Text;
                _StudParentRec.Father.Name            = txtParentName.Text;
                _StudParentRec.Father.Nationality     = cboNationality.Text;
                _StudParentRec.Father.Phone           = txtParentPhone.Text;
                _StudParentRec.Father.EMail           = txtEMail.Text;
            }

            if (_ParentType == ParentType.Mother)
            {
                _StudParentRec.Mother.EducationDegree = cboEduDegree.Text;
                _StudParentRec.Mother.IDNumber        = txtIDNumber.Text;
                _StudParentRec.Mother.Job             = cboJob.Text;
                _StudParentRec.Mother.Living          = cboAlive.Text;
                _StudParentRec.Mother.Name            = txtParentName.Text;
                _StudParentRec.Mother.Nationality     = cboNationality.Text;
                _StudParentRec.Mother.Phone           = txtParentPhone.Text;
                _StudParentRec.Mother.EMail           = txtEMail.Text;
            }

            prlp.SetAfterSaveText("父親姓名", _StudParentRec.Father.Name);
            prlp.SetAfterSaveText("父親身分證號", _StudParentRec.Father.IDNumber);
            prlp.SetAfterSaveText("父親電話", _StudParentRec.Father.Phone);
            prlp.SetAfterSaveText("父親存歿", _StudParentRec.Father.Living);
            prlp.SetAfterSaveText("父親國籍", _StudParentRec.Father.Nationality);
            prlp.SetAfterSaveText("父親職業", _StudParentRec.Father.Job);
            prlp.SetAfterSaveText("父親最高學歷", _StudParentRec.Father.EducationDegree);
            prlp.SetAfterSaveText("父親電子郵件", _StudParentRec.Father.EMail);
            prlp.SetAfterSaveText("母親姓名", _StudParentRec.Mother.Name);
            prlp.SetAfterSaveText("母親身分證號", _StudParentRec.Mother.IDNumber);
            prlp.SetAfterSaveText("母親電話", _StudParentRec.Mother.Phone);
            prlp.SetAfterSaveText("母親存歿", _StudParentRec.Mother.Living);
            prlp.SetAfterSaveText("母親國籍", _StudParentRec.Mother.Nationality);
            prlp.SetAfterSaveText("母親職業", _StudParentRec.Mother.Job);
            prlp.SetAfterSaveText("母親最高學歷", _StudParentRec.Mother.EducationDegree);
            prlp.SetAfterSaveText("母親電子郵件", _StudParentRec.Mother.EMail);
            prlp.SetAfterSaveText("監護人姓名", _StudParentRec.Custodian.Name);
            prlp.SetAfterSaveText("監護人身分證號", _StudParentRec.Custodian.IDNumber);
            prlp.SetAfterSaveText("監護人電話", _StudParentRec.Custodian.Phone);
            prlp.SetAfterSaveText("監護人關係", _StudParentRec.Custodian.Relationship);
            prlp.SetAfterSaveText("監護人國籍", _StudParentRec.Custodian.Nationality);
            prlp.SetAfterSaveText("監護人職業", _StudParentRec.Custodian.Job);
            prlp.SetAfterSaveText("監護人最高學歷", _StudParentRec.Custodian.EducationDegree);
            prlp.SetAfterSaveText("監護人電子郵件", _StudParentRec.Custodian.EMail);
            JHParent.Update(_StudParentRec);
            prlp.SetActionBy("學籍", "學生父母及監護人資訊");
            prlp.SetAction("修改學生父母及監護人資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            //Student.Instance.SyncDataBackground(PrimaryKey);
            Program.CustodianField.Reload();
            prlp.SaveLog("", "", "student", PrimaryKey);
            BindDataToForm();
        }