Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // 初始化資料
            SHUpdateRecordRecord updateRec = new SHUpdateRecordRecord();
            // 取得學生ID
            // 先清DAL Cache
            List <string> rmIDs = new List <string> ();

            rmIDs.Add(PrimaryKey);
            SHStudent.RemoveByIDs(rmIDs);
            SHStudentRecord studRec = SHStudent.SelectByID(PrimaryKey);

            // 取得最後一筆異動資料,備查使用。
            List <SHUpdateRecordRecord> UpdList = (from rec in SHUpdateRecord.SelectByStudentID(PrimaryKey) where rec.ID != updateRec.ID && rec.ADDate.Trim() != "" orderby DateTime.Parse(rec.ADDate) descending, int.Parse(rec.ID) descending select rec).ToList();

            if (UpdList.Count > 0)
            {
                updateRec.LastADDate     = UpdList[0].ADDate;
                updateRec.LastADNumber   = UpdList[0].ADNumber;
                updateRec.LastUpdateCode = UpdList[0].UpdateCode;
            }

            updateRec.StudentID     = studRec.ID;
            updateRec.StudentNumber = studRec.StudentNumber;
            updateRec.StudentName   = studRec.Name;
            updateRec.IDNumber      = studRec.IDNumber;
            if (studRec.Birthday.HasValue)
            {
                updateRec.Birthdate = studRec.Birthday.Value.ToShortDateString();
            }
            updateRec.Gender = studRec.Gender;
            if (studRec.Department != null)
            {
                updateRec.Department = studRec.Department.FullName;
            }

            // 取得學生學籍特殊身分代碼
            updateRec.SpecialStatus = DAL.DALTransfer.GetSpecialCode(studRec.ID);

            updateRec.UpdateDate = DateTime.Now.ToShortDateString();
            if (updateRec == null)
            {
                return;
            }
            UpdateRecordItemForm form = new UpdateRecordItemForm(UpdateRecordItemForm.actMode.新增, updateRec, PrimaryKey);

            form.ShowDialog();
        }
Example #2
0
        void ImportNewStudentsUpdateRecord_BeginValidate(object sender, BeginValidateEventArgs e)
        {
            #region 整理異動代號及類別對照

            updateCodeMapping = new Dictionary <string, string>();

            foreach (SHUpdateCodeMappingInfo var in SHUpdateCodeMapping.SelectAll())
            {
                if (!updateCodeMapping.ContainsKey(var.Code))
                {
                    updateCodeMapping.Add(var.Code, var.Type);
                }
            }
            #endregion

            _NewStudentUpdateRecordInfoList = new Dictionary <string, SHUpdateRecordRecord>();

            List <SHStudentRecord> students = SHStudent.SelectByIDs(e.List);

            foreach (SHStudentRecord stu in students)
            {
                if (!_NewStudentUpdateRecordInfoList.ContainsKey(stu.ID))
                {
                    _NewStudentUpdateRecordInfoList.Add(stu.ID, null);
                }
                else
                {
                    _NewStudentUpdateRecordInfoList[stu.ID] = null;
                }
                foreach (SHUpdateRecordRecord uinfo in SHUpdateRecord.SelectByStudentID(stu.ID))
                {
                    if (uinfo.UpdateType == Type)
                    {
                        _NewStudentUpdateRecordInfoList[stu.ID] = uinfo;
                        break;
                    }
                }
            }
        }
Example #3
0
 void BGWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     _StudUpateRecList = SHUpdateRecord.SelectByStudentID(PrimaryKey);
 }
        private void ExportUpdateRecord_ExportPackage(object sender, ExportPackageEventArgs e)
        {
            for (int i = 0; i < e.List.Count; i++)
            {
                foreach (SHUpdateRecordRecord var in SHUpdateRecord.SelectByStudentID(e.List[i]))
                {
                    if (var.UpdateType != Type)
                    {
                        continue;
                    }

                    RowData row = new RowData();
                    row.ID = e.List[i];
                    foreach (string field in e.ExportFields)
                    {
                        if (ExportableFields.Contains(field))
                        {
                            switch (field)
                            {
                            case "班別": row.Add(field, var.ClassType); break;

                            case "特殊身份代碼": row.Add(field, var.SpecialStatus); break;

                            case "異動科別": row.Add(field, var.Department); break;

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

                            case "異動學號": row.Add(field, var.StudentNumber); break;

                            case "異動姓名": row.Add(field, var.StudentName); break;

                            case "身分證號": row.Add(field, var.IDNumber); break;

                            case "註1": row.Add(field, var.IDNumberComment); break;

                            case "性別": row.Add(field, var.Gender); break;

                            case "生日": row.Add(field, var.Birthdate); break;

                            case "異動種類": row.Add(field, var.UpdateType); break;

                            case "異動代碼": row.Add(field, var.UpdateCode); break;

                            case "異動日期": row.Add(field, var.UpdateDate); break;

                            case "原因及事項": row.Add(field, var.UpdateDescription); break;

                            case "新學號": row.Add(field, var.NewStudentNumber); break;

                            case "更正後資料": row.Add(field, var.NewData); break;

                            case "轉入前學生資料-科別": row.Add(field, var.PreviousDepartment); break;

                            case "轉入前學生資料-年級": row.Add(field, var.PreviousGradeYear); break;

                            case "轉入前學生資料-學校": row.Add(field, var.PreviousSchool); break;

                            case "轉入前學生資料-(備查日期)": row.Add(field, var.PreviousSchoolLastADDate); break;

                            case "轉入前學生資料-(備查文號)": row.Add(field, var.PreviousSchoolLastADNumber); break;

                            case "轉入前學生資料-學號": row.Add(field, var.PreviousStudentNumber); break;

                            case "入學資格-畢業國中": row.Add(field, var.GraduateSchool); break;

                            case "入學資格-畢業國中所在地代碼": row.Add(field, var.GraduateSchoolLocationCode); break;

                            case "入學資格-畢業國中年度": row.Add(field, var.GraduateSchoolYear); break;

                            case "入學資格-註2": row.Add(field, var.GraduateComment); break;

                            case "最後異動代碼": row.Add(field, var.LastUpdateCode); break;

                            case "畢(結)業證書字號": row.Add(field, var.GraduateCertificateNumber); break;

                            case "舊班別": row.Add(field, var.OldClassType); break;

                            case "舊科別代碼": row.Add(field, var.OldDepartmentCode); break;

                            case "備查日期": row.Add(field, var.LastADDate); break;

                            case "備查文號": row.Add(field, var.LastADNumber); break;

                            case "核准日期": row.Add(field, var.ADDate); break;

                            case "核准文號": row.Add(field, var.ADNumber); break;

                            case "備註": row.Add(field, var.Comment); break;
                            }
                        }
                    }
                    e.Items.Add(row);
                }
            }
        }
Example #5
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (UpdateRecordEditorPanle.Controls.Count > 0)
            {
                IUpdateRecordInfo IU;
                IU             = UpdateRecordEditorPanle.Controls[0] as IUpdateRecordInfo;
                _StudUpdateRec = IU.GetStudUpdateRecord();
                _prlp          = IU.GetLogData();

                int codeInt;
                if (_StudUpdateRec != null)
                {
                    if (int.TryParse(_StudUpdateRec.UpdateCode, out codeInt) && _actMode == actMode.新增)
                    {
                        int icode;
                        List <SHUpdateRecordRecord> UpRec01List = new List <SHUpdateRecordRecord>();
                        // 檢查是否有新生異動
                        foreach (SHUpdateRecordRecord rec in SHUpdateRecord.SelectByStudentID(_StudentID))
                        {
                            if (int.TryParse(rec.UpdateCode, out icode))
                            {
                                if (icode > 0 && icode < 100)
                                {
                                    UpRec01List.Add(rec);
                                }
                            }
                        }
                        if (UpRec01List.Count > 0 && codeInt < 100)
                        {
                            if (FISCA.Presentation.Controls.MsgBox.Show("已有" + UpRec01List.Count + "筆新生異動,是否覆蓋", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                            {
                                SHUpdateRecord.Delete(UpRec01List);
                            }
                            else
                            {
                                return;
                            }
                        }

                        // 檢查是否有畢業異動
                        List <SHUpdateRecordRecord> UpRec05List = (from data in SHUpdateRecord.SelectByStudentID(_StudentID) where data.UpdateCode == "501" select data).ToList();
                        if (UpRec05List.Count > 0 && codeInt == 501)
                        {
                            if (FISCA.Presentation.Controls.MsgBox.Show("已有" + UpRec01List.Count + "筆畢業異動,是否覆蓋", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                            {
                                SHUpdateRecord.Delete(UpRec05List);
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }

                if (_StudUpdateRec != null)
                {
                    // 儲存學年度學期 年級
                    _StudUpdateRec.SchoolYear = intSchoolYear.Value;
                    _StudUpdateRec.Semester   = intSemester.Value;

                    if (cbxGradeYear.Text == "延修生")
                    {
                        _StudUpdateRec.GradeYear = "延修生";
                    }
                    else
                    {
                        _StudUpdateRec.GradeYear = cbxGradeYear.Text;
                    }

                    // 儲存異動資料
                    string strItemName = "";
                    if (_actMode == actMode.新增)
                    {
                        SHUpdateRecord.Insert(_StudUpdateRec);
                        strItemName = "新增:";
                    }
                    else
                    {
                        SHUpdateRecord.Update(_StudUpdateRec);
                        strItemName = "修改:";
                    }

                    SHStudentRecord studRec = SHStudent.SelectByID(_StudentID);
                    // Log
                    strItemName += "學生姓名:" + studRec.Name + _actMode.ToString();

                    _prlp.SetActionBy("學生", strItemName);
                    _prlp.SaveLog("", ":", "student", _StudentID);
                    _checkSave = true;

                    // 取得 UpdateCode
                    int intUpdateCode;
                    int.TryParse(_StudUpdateRec.UpdateCode, out intUpdateCode);



                    // 學生資料 Cache
                    List <SHStudentRecord> AllStudRec = null;


                    // 復學,學生狀態是非一般,輸入異動代碼是復學,問使用者是否轉成一般。
                    if (intUpdateCode >= 221 && intUpdateCode <= 226 && studRec.Status != K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成一般?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            if (AllStudRec == null)
                            {
                                AllStudRec = SHStudent.SelectAll();
                            }

                            // 檢查將變更學生狀態
                            // 身分證
                            List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.一般 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList();
                            // 學號
                            List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.一般 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList();

                            if (studNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在一般狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態");
                            }

                            if (studIDNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在一般狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態");
                            }

                            if (studIDNumber.Count == 0 && studNumber.Count == 0)
                            {
                                studRec.Status = K12.Data.StudentRecord.StudentStatus.一般;
                                SHStudent.Update(studRec);
                            }
                        }
                    }

                    // 轉出,學生狀態是一般,輸入異動代碼是轉出,問使用者是否轉成畢業或離校。
                    if (intUpdateCode >= 311 && intUpdateCode <= 316 && studRec.Status == K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成畢業或離校?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            if (AllStudRec == null)
                            {
                                AllStudRec = SHStudent.SelectAll();
                            }

                            // 檢查將變更學生狀態
                            // 身分證
                            List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList();
                            // 學號
                            List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList();

                            if (studNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在畢業或離校狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態");
                            }

                            if (studIDNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在畢業或離校狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態");
                            }

                            if (studIDNumber.Count == 0 && studNumber.Count == 0)
                            {
                                studRec.Status = K12.Data.StudentRecord.StudentStatus.畢業或離校;
                                SHStudent.Update(studRec);
                            }
                        }
                    }

                    // 休學,學生狀態是一般,輸入異動代碼是休學,問使用者是否轉成休學。
                    if (intUpdateCode >= 341 && intUpdateCode <= 349 && studRec.Status == K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成休學?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            if (AllStudRec == null)
                            {
                                AllStudRec = SHStudent.SelectAll();
                            }

                            // 檢查將變更學生狀態
                            // 身分證
                            List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.休學 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList();
                            // 學號
                            List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.休學 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList();

                            if (studNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在休學狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態");
                            }

                            if (studIDNumber.Count > 0)
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在休學狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態");
                            }


                            if (studIDNumber.Count == 0 && studNumber.Count == 0)
                            {
                                studRec.Status = K12.Data.StudentRecord.StudentStatus.休學;
                                SHStudent.Update(studRec);
                            }
                        }
                    }
                    this.Close();
                    // 畫面同步
                    SmartSchool.StudentRelated.Student.Instance.SyncAllBackground();
                }
            }
        }