Пример #1
0
        private void wizardPage3_FinishButtonClick(object sender, CancelEventArgs e)
        {
            StringBuilder   desc = new StringBuilder("");
            SHStudentRecord stu  = SHStudent.SelectByID(mStudentID);

            desc.AppendLine("學生姓名:" + stu.Name + " ");

            if (office2007StyleRadioButton1.Checked)
            {
                desc.AppendLine("姓名由「" + stu.Name + "」變更為「" + textBoxX1.Text + "」");
                stu.Name = textBoxX1.Text;
            }
            if (office2007StyleRadioButton2.Checked)
            {
                desc.AppendLine("身分證號由「" + stu.IDNumber + "」變更為「" + textBoxX1.Text + "」");
                stu.IDNumber = textBoxX1.Text;
            }
            if (office2007StyleRadioButton3.Checked)
            {
                desc.AppendLine("學號由「" + stu.StudentNumber + "」變更為「" + textBoxX1.Text + "」");
                stu.StudentNumber = textBoxX1.Text;
            }
            if (office2007StyleRadioButton4.Checked)
            {
                desc.AppendLine("生日由「" + stu.Birthday + "」變更為「" + textBoxX1.Text + "」");
                stu.Birthday = K12.Data.DateTimeHelper.Parse(textBoxX1.Text);
            }
            if (office2007StyleRadioButton5.Checked)
            {
                desc.AppendLine("性別由「" + stu.Gender + "」變更為「" + textBoxX1.Text + "」");
                stu.Gender = textBoxX1.Text;
            }

            this.Close();
//            CurrentUser.Instance.AppLog.Write(EntityType.Student, "學籍更正", mStudentID, desc.ToString(), "", "");
            SHStudent.Update(stu);

            this.updateRecordInfo1.Save();
            //          SmartSchool.Broadcaster.Events.Items["學生/資料變更"].Invoke(mStudentID);
        }
Пример #2
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();
                }
            }
        }
Пример #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            // 檢查是否要修改學生狀態
            int  UpdateCoodeInt;
            bool UpdateStudStatus = false;

            if (int.TryParse(updateRecordInfo1.UpdateCode, out UpdateCoodeInt))
            {
                string StudIDNumber = "", StudNumber = "";

                SHStudentRecord stud = SHStudent.SelectByID(updateRecordInfo1.StudentID);

                if (stud != null)
                {
                    StudIDNumber = stud.IDNumber;
                    StudNumber   = stud.StudentNumber;
                }


                // 收集檢查用資料
                // 一般
                List <string> tmp01 = new List <string>();
                // 畢業或離校
                List <string> tmp02 = new List <string>();
                // 休學
                List <string> tmp03 = new List <string>();

                foreach (SHStudentRecord studRec in SHStudent.SelectAll())
                {
                    if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        tmp01.Add(studRec.IDNumber);
                        tmp01.Add(studRec.StudentNumber);
                    }

                    if (studRec.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校)
                    {
                        tmp02.Add(studRec.IDNumber);
                        tmp02.Add(studRec.StudentNumber);
                    }

                    if (studRec.Status == K12.Data.StudentRecord.StudentStatus.休學)
                    {
                        tmp03.Add(studRec.IDNumber);
                        tmp03.Add(studRec.StudentNumber);
                    }
                }

                // 復學
                if (UpdateCoodeInt >= 221 && UpdateCoodeInt <= 226)
                {
                    if (MessageBox.Show("請問是否更改學生狀態成 一般?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        // 檢查該狀態是否有相同學號或身分證號學生
                        if (tmp01.Contains(StudIDNumber) || tmp01.Contains(StudNumber))
                        {
                            FISCA.Presentation.Controls.MsgBox.Show("在一般狀態已有相同身分證號或學號的學生,無法自動變更狀態。");
                        }
                        else
                        {
                            UpdateStudStatus = true;
                            stud.Status      = K12.Data.StudentRecord.StudentStatus.一般;
                        }
                    }
                }

                // 轉出
                if (UpdateCoodeInt >= 311 && UpdateCoodeInt <= 316)
                {
                    if (MessageBox.Show("請問是否更改學生狀態成 畢業或離校?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        // 檢查該狀態是否有相同學號或身分證號學生
                        if (tmp02.Contains(StudIDNumber) || tmp02.Contains(StudNumber))
                        {
                            FISCA.Presentation.Controls.MsgBox.Show("在畢業或離校狀態已有相同身分證號或學號的學生,無法自動變更狀態。");
                        }
                        else
                        {
                            UpdateStudStatus = true;
                            stud.Status      = K12.Data.StudentRecord.StudentStatus.畢業或離校;
                        }
                    }
                }

                // 休學
                if (UpdateCoodeInt >= 341 && UpdateCoodeInt <= 349)
                {
                    if (MessageBox.Show("請問是否更改學生狀態成 休學?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (MessageBox.Show("請問是否更改學生狀態成 畢業或離校?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            // 檢查該狀態是否有相同學號或身分證號學生
                            if (tmp03.Contains(StudIDNumber) || tmp03.Contains(StudNumber))
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("在休學狀態已有相同身分證號或學號的學生,無法自動變更狀態。");
                            }
                            else
                            {
                                UpdateStudStatus = true;
                                stud.Status      = K12.Data.StudentRecord.StudentStatus.休學;
                            }
                        }
                    }
                }
                // 更新學生狀態
                if (UpdateStudStatus)
                {
                    SHStudent.Update(stud);
                    StudentRelated.Student.Instance.SyncAllBackground();
                }
            }
            if (updateRecordInfo1.Save())
            {
                _saved = true;
                if (DataSaved != null)
                {
                    DataSaved(this, null);
                }
                this.Close();
            }
        }