示例#1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            AddTransStudBase.AddTransStudStatus status;

            if (string.IsNullOrEmpty(txtSSN.Text))
            {
                return;
            }


            if (AddTransBackgroundManager.GetHasStudentData() == false || (txtSSN.Text != AddTransBackgroundManager.StudentIDNumber))
            {
                AddTransBackgroundManager.SetStudentBySSN(txtSSN.Text.ToUpper());
            }

            AddTransBackgroundManager.StudentIDNumber = txtSSN.Text.ToUpper();

            // 已有學生資料
            if (AddTransBackgroundManager.GetHasStudentData())
            {
                status = AddTransStudBase.AddTransStudStatus.Modify;
            }
            else
            {
                status = AddTransStudBase.AddTransStudStatus.Added;
            }

            setTransClassAndCourse(status, AddTransBackgroundManager.GetStudent());

            //StudentEntity student=null ;

            //if (AddTransBackgroundManager.GetCheckSSN()==false )
            //{
            //student = DAL.TransferDAL.GetStudent(txtSSN.Text);

            //}

            //if (student == null)
            //{
            //    // 修改先不新增學生
            //    // student = DAL.TransferDAL.AddStudent(txtSSN.Text);

            //    status = AddTransStudBase.AddTransStudStatus.Added;
            //}
            //else
            //    status = AddTransStudBase.AddTransStudStatus.Modify;

            //setTransClassAndCourse(status, student);
        }
示例#2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string sid = AddTransBackgroundManager.GetStudent().ID;

            JHSchool.Data.JHStudentRecord StudRec = JHSchool.Data.JHStudent.SelectByID(sid);

            if (chkStudBase.Checked)
            {
                AddTransStudBaseData atsbd = new AddTransStudBaseData(AddTransBackgroundManager.GetStudent());
                atsbd.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atsbd.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }

            if (chkStudCourse.Checked)
            {
                AddTransStudCourse atsc = new AddTransStudCourse(StudRec);
                atsc.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atsc.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }

            if (chkStudCourseScore.Checked)
            {
                AddTransStudCourseScore atscs = new AddTransStudCourseScore(StudRec);
                atscs.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atscs.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }

            if (chkSemesterHistory.Checked)
            {
                AddTransStudSemesterHistory atssh = new AddTransStudSemesterHistory(StudRec);
                atssh.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atssh.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }

            if (chkStudSemsSubjScore.Checked)
            {
                AddTransStudSemsSubjScore atssss = new AddTransStudSemsSubjScore(AddTransBackgroundManager.GetStudent());
                atssss.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atssss.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }

            if (chkStudUpdateRec.Checked)
            {
                AddTransStudUpdateRecord atsur = new AddTransStudUpdateRecord(AddTransBackgroundManager.GetStudent());
                atsur.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                atsur.ShowDialog(FISCA.Presentation.MotherForm.Form);
            }
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNewName.Text.Trim() == "")
                {
                    MsgBox.Show("姓名必填");
                    return;
                }

                if (string.IsNullOrEmpty(cbotStudentNumber.Text))
                {
                    Errors.SetError(cbotStudentNumber, "學號空白!");
                }

                string sid = string.Empty;
                if (_status == AddTransStudStatus.Added)
                {
                    JHSchool.Data.JHStudentRecord NewStudRec = new JHSchool.Data.JHStudentRecord();
                    NewStudRec.Name     = txtNewName.Text;
                    NewStudRec.Gender   = cboNewGender.Text;
                    NewStudRec.IDNumber = txtNewSSN.Text;
                    sid                   = JHSchool.Data.JHStudent.Insert(NewStudRec);
                    _StudentPhone         = JHSchool.Data.JHPhone.SelectByStudentID(sid);
                    _StudentPhone.Contact = txtNewTel.Text;
                }

                if (StudCheckTool.CheckStudIDNumberSame(txtNewSSN.Text, sid))
                {
                    FISCA.Presentation.Controls.MsgBox.Show("身分證號重複請檢查");
                    return;
                }

                Dictionary <string, int> chkSum = new Dictionary <string, int>();
                foreach (JHSchool.Data.JHStudentRecord studRec in JHSchool.Data.JHStudent.SelectAll())
                {
                    if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般)
                    {
                        if (!string.IsNullOrEmpty(studRec.StudentNumber))
                        {
                            if (chkSum.ContainsKey(studRec.StudentNumber))
                            {
                                chkSum[studRec.StudentNumber]++;
                            }
                            else
                            {
                                chkSum.Add(studRec.StudentNumber, 1);
                            }
                        }
                    }
                }

                if (chkSum.ContainsKey(cbotStudentNumber.Text))
                {
                    if (chkSum[cbotStudentNumber.Text] > 1)
                    {
                        FISCA.Presentation.Controls.MsgBox.Show("學號重複請檢查");
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(sid))
                {
                    _student = JHSchool.Data.JHStudent.SelectByID(sid);
                }

                //_student.Name = txtNewName.Text;

                _student.IDNumber = txtNewSSN.Text;
                DateTime dt;
                if (DateTime.TryParse(dtNewBirthday.Text, out dt))
                {
                    _student.Birthday = dt;
                }

                //_student.Gender = cboNewGender.Text;
                _student.Nationality = cboNewNationality.Text;
                _student.BirthPlace  = txtNewBirthPlace.Text;
                //_StudentPhone.Contact = txtNewTel.Text;
                //_student.EnglishName = txtNewEngName.Text;

                foreach (JHSchool.Data.JHClassRecord cr in JHSchool.Data.JHClass.SelectAll())
                {
                    if (cboClass.Text == cr.Name)
                    {
                        _student.RefClassID = cr.ID;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(cboSeatNo.Text))
                {
                    _student.SeatNo = null;
                }
                else
                {
                    int no;
                    int.TryParse(cboSeatNo.Text, out no);
                    _student.SeatNo = no;
                }
                _student.StudentNumber = cbotStudentNumber.Text;


                if (_status == AddTransStudStatus.Added)
                {
                }

                JHSchool.Data.JHStudent.Update(_student);
                JHSchool.Data.JHPhone.Update(_StudentPhone);


                //log
                JHSchool.PermRecLogProcess prlp = new JHSchool.PermRecLogProcess();
                if (_status == AddTransStudStatus.Added)
                {
                    prlp.SaveLog("學生.轉入異動", "新增班級資料", "修改轉入與班級資料.");
                }
                else
                {
                    prlp.SaveLog("學生.轉入異動", "修改班級資料", "修改轉入與班級資料.");
                }

                AddTransBackgroundManager.SetStudent(_student);

                AddTransManagerForm atmf = new AddTransManagerForm();
                this.Visible       = false;
                atmf.StartPosition = FormStartPosition.CenterParent;
                atmf.ShowDialog(FISCA.Presentation.MotherForm.Form);
                this.Close();
                JHSchool.Student.Instance.SyncAllBackground();
                JHSchool.Data.JHStudent.RemoveAll();
                JHSchool.Data.JHStudent.SelectAll();
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show(ex.Message);
                return;
            }
        }