Exemplo n.º 1
0
        public AddTransStudCourse(JHSchool.Data.JHStudentRecord studentRec)
        {
            InitializeComponent();
            classRecIdx = new Dictionary <string, JHClassRecord>();

            foreach (JHClassRecord cr in JHSchool.Data.JHClass.SelectAll())
            {
                if (cr != null)
                {
                    cboSelectClass.Items.Add(cr.Name);
                    if (!classRecIdx.ContainsKey(cr.Name))
                    {
                        classRecIdx.Add(cr.Name, cr);
                    }
                }
            }

            chkSaveYes.Checked = true;
            studRec            = studentRec;
            if (studRec.Class != null)
            {
                lblStudMsg.Text     = "班級:" + studRec.Class.Name + ", 座號:" + studRec.SeatNo + ", 姓名:" + studRec.Name + ", 學號:" + studRec.StudentNumber;
                cboSelectClass.Text = studRec.Class.Name;
                studClassRec        = studRec.Class;
            }
            else
            {
                lblStudMsg.Text = "未設定班級";
            }
            AddTransBackgroundManager.AddTransStudCourseObj = this;
        }
        public AddTransStudSemsSubjScore(JHSchool.Data.JHStudentRecord student)
        {
            InitializeComponent();
            chkNextYes.Checked = true;
            studRec            = student;
            _domainList        = new List <string>();
            InitializeColumnHeader();

            string msg = "班級:";

            if (student.Class != null)
            {
                msg += student.Class.Name;
            }
            if (student.SeatNo.HasValue)
            {
                msg += ", 座號:" + student.SeatNo.Value;
            }
            msg += ", 姓名:" + student.Name + ", 學號:" + student.StudentNumber;

            if (studRec.Class != null)
            {
                lblStudMsg.Text = msg;
            }
            else
            {
                lblStudMsg.Text = "未設定班級";
            }

            _worker         = new BackgroundWorker();
            _worker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                e.Result = JHSchool.Data.JHSemesterScore.SelectByStudentID("" + e.Argument);
            };
            _worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                if (_RunningID != student.ID)
                {
                    _RunningID = student.ID;
                    _worker.RunWorkerAsync(_RunningID);
                    return;
                }

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


            LoadSemesterScores();
            AddTransBackgroundManager.AddTransStudSemsSubjScoreObj = this;
        }
        private void StudentClassItemContent_Load(object sender, EventArgs e)
        {
            // 檢查班級調整功能
            if (FISCA.Permission.UserAcl.Current["JHSchool.Student.Detail0090"].Editable)
            {
                lnkSend.Enabled = true;
            }
            else
            {
                lnkSend.Enabled = false;
            }

            Errors           = new ErrorProvider();
            _ClassNameIDDic  = new Dictionary <string, string>();
            _ClassSeatNoList = new List <int>();

            JHSchool.Data.JHStudent.AfterChange += new EventHandler <K12.Data.DataChangedEventArgs>(JHStudent_AfterChange);

            objStudent    = JHSchool.Data.JHStudent.SelectByID(PrimaryKey);
            _AllClassRecs = JHSchool.Data.JHClass.SelectAll();

            _studRecList               = new List <JHSchool.Data.JHStudentRecord>();
            BGWork                     = new BackgroundWorker();
            BGWork.DoWork             += new DoWorkEventHandler(BGWork_DoWork);
            BGWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGWork_RunWorkerCompleted);

            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(txtStudentNumber));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(ValueManager_StatusChanged);
            prlp = new PermRecLogProcess();

            if (!string.IsNullOrEmpty(PrimaryKey))
            {
                BGWork.RunWorkerAsync();
            }

            Disposed += new EventHandler(ClassItem_Disposed);
        }
        protected override void OnSaveButtonClick(EventArgs e)
        {
            Errors.Clear();

            objStudent = JHSchool.Data.JHStudent.SelectByID(PrimaryKey);


            // 檢查學號是否重複
            if (txtStudentNumber.Text != this._DefaultStudNum)
            {
                // 判斷是否是空
                if (string.IsNullOrEmpty(txtStudentNumber.Text))
                {
                    objStudent.StudentNumber = "";
                }
                else
                {
                    // 取得目前學生狀態
                    JHStudentRecord.StudentStatus studtStatus = JHSchool.Data.JHStudent.SelectByID(PrimaryKey).Status;

                    List <string> checkData = new List <string>();
                    // 同狀態下學號不能重複
                    foreach (JHSchool.Data.JHStudentRecord studRec in JHSchool.Data.JHStudent.SelectAll())
                    {
                        if (studRec.Status == studtStatus)
                        {
                            checkData.Add(studRec.StudentNumber);
                        }
                    }

                    if (checkData.Contains(txtStudentNumber.Text))
                    {
                        Errors.SetError(txtStudentNumber, "學號重複!");
                        return;
                    }
                    objStudent.StudentNumber = txtStudentNumber.Text;
                }
            }


            JHStudent.Update(objStudent);

            SaveButtonVisible   = false;
            CancelButtonVisible = false;

            prlp.SetAfterSaveText("班級", lblClassName.Text);
            prlp.SetAfterSaveText("座號", lblSeatNo.Text);
            prlp.SetAfterSaveText("學號", txtStudentNumber.Text);
            prlp.SetActionBy("學籍", "學生班級資訊");
            prlp.SetAction("修改學生班級資訊");
            prlp.SetDescTitle("學生姓名:" + objStudent.Name + ",學號:" + objStudent.StudentNumber + ",");

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


            this._DefaultClassName = lblClassName.Text;
            this._DefaultSeatNo    = lblSeatNo.Text;
            this._DefaultStudNum   = txtStudentNumber.Text;
            //      Student.Instance.SyncDataBackground(PrimaryKey);

            reloadChkdData();
        }
 void BGWork_DoWork(object sender, DoWorkEventArgs e)
 {
     objStudent = JHSchool.Data.JHStudent.SelectByID(PrimaryKey);
 }
Exemplo n.º 6
0
        public AddTransStudUpdateRecord(JHSchool.Data.JHStudentRecord studEntity)
        {
            InitializeComponent();
            // 取得原理:當有同一天轉入異動,帶入同一筆,如果沒有新增一筆。
            bool checkNoTodayUrData = true;

            // 取得 StudUpdateRecordEntityList
            List <DAL.StudUpdateRecordEntity> sureList = DAL.DALTransfer2.GetStudUpdateRecordEntityListByUpdateType(studEntity.ID, JHPermrec.UpdateRecord.DAL.DALTransfer2.UpdateType.轉入);

            foreach (DAL.StudUpdateRecordEntity sure in sureList)
            {
                if (sure.GetUpdateDate().HasValue)
                {
                    if (sure.GetUpdateDate().Value.ToShortDateString() == DateTime.Now.ToShortDateString())
                    {
                        _StudUpdateRecordEntity = sure;
                        checkNoTodayUrData      = false;
                    }
                }
            }

            if (checkNoTodayUrData)
            {
                _StudUpdateRecordEntity = DAL.DALTransfer2.AddStudUpdateRecordEntity(studEntity.ID, JHPermrec.UpdateRecord.DAL.DALTransfer2.UpdateType.轉入, DateTime.Now.ToShortDateString());

                txtClass.Text         = _StudUpdateRecordEntity.GetClassName();
                txtName.Text          = _StudUpdateRecordEntity.GetName();
                txtStudentNumber.Text = _StudUpdateRecordEntity.GetStudentNumber();
                txtSeatNo.Text        = _StudUpdateRecordEntity.GetSeatNo();
                txtIDNumber.Text      = _StudUpdateRecordEntity.GetIDNumber();
                cboGender.Text        = _StudUpdateRecordEntity.GetGender();
                if (_StudUpdateRecordEntity.GetBirthday().HasValue)
                {
                    dtBirthday.Value = _StudUpdateRecordEntity.GetBirthday().Value;
                }
                else
                {
                    dtBirthday.IsEmpty = true;
                };
                dtUpdateDate.Text = DateTime.Now.ToString();
                txtAddress.Text   = _StudUpdateRecordEntity.GetAddress();
                // cboUpdateDescription.Items.AddRange(new string[] { "遷居", "安置", "其他" });
            }
            else
            {
                if (_StudUpdateRecordEntity.GetUpdateDate().HasValue)
                {
                    dtUpdateDate.Value = _StudUpdateRecordEntity.GetUpdateDate().Value;
                }
                else
                {
                    dtUpdateDate.IsEmpty = true;
                }

                if (_StudUpdateRecordEntity.GetADDate().HasValue)
                {
                    dtADDate.Value = _StudUpdateRecordEntity.GetADDate().Value;
                }
                else
                {
                    dtADDate.IsEmpty = true;
                }

                txtComment.Text      = _StudUpdateRecordEntity.GetComment();
                txtClass.Text        = _StudUpdateRecordEntity.GetClassName();
                txtAddress.Text      = _StudUpdateRecordEntity.GetAddress();
                txtSeatNo.Text       = _StudUpdateRecordEntity.GetSeatNo();
                txtExportSchool.Text = _StudUpdateRecordEntity.GetImportExportSchool();
                if (_StudUpdateRecordEntity.GetLastADDate().HasValue)
                {
                    dtLastADDate.Value = _StudUpdateRecordEntity.GetLastADDate().Value;
                }
                else
                {
                    dtLastADDate.IsEmpty = true;
                }
                txtLastADNumber.Text  = _StudUpdateRecordEntity.GetLastADNumber();
                txtName.Text          = _StudUpdateRecordEntity.GetName();
                txtIDNumber.Text      = _StudUpdateRecordEntity.GetIDNumber();
                txtStudentNumber.Text = _StudUpdateRecordEntity.GetStudentNumber();
                cboGender.Text        = _StudUpdateRecordEntity.GetGender();
                if (_StudUpdateRecordEntity.GetBirthday().HasValue)
                {
                    dtBirthday.Value = _StudUpdateRecordEntity.GetBirthday().Value;
                }
                else
                {
                    dtBirthday.IsEmpty = true;
                }

                txtADNumber.Text          = _StudUpdateRecordEntity.GetADNumber();
                cboUpdateDescription.Text = _StudUpdateRecordEntity.GetUpdateDescription();
            }
            cboUpdateDescription.Items.AddRange(new string[] { "遷居", "安置", "其他" });
            chkNextYes.Checked = true;
            AddTransBackgroundManager.AddTransStudUpdateRecordObj = this;
        }