Ejemplo n.º 1
0
 public StudentScoreRank(RankProgressForm rankForm, DoWorkEventArgs workArgs)
 {
     //排名相關參數,由主畫面選項決定。
     _parameters = rankForm.RatingParams;
     //BackgroundWorker 事件物件。
     _work_args = workArgs;
     //工作進度權重管理物件。
     _weights = new JobWeightTable();
     //畫面進度回報物件。
     _progress = new MainProgress(rankForm.ProgressUI, rankForm.MessageLabel);
     //要排名的學生集合。
     _students = new StudentCollection();
     //填入資料的 Adapter 集合。
     _adapters = new AdapterCollection();
     //是否不儲存,只試排看結果。
     _save_required = !rankForm.IsViewMode;
 }
Ejemplo n.º 2
0
        private void btnRank_Click(object sender, EventArgs e)
        {
            RatingParameters parameters = new RatingParameters();

            parameters.SchoolYear = intSchoolYear.Value.ToString();
            parameters.Semester   = intSemester.Value.ToString();

            string       msg = string.Format("現在將會進行成績排名,您確定嗎?", parameters.SchoolYear, parameters.Semester);
            DialogResult dr  = MsgBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            if (chkSequence.Checked)
            {
                parameters.RatingMethod = RatingMethod.Sequence;
            }
            else if (chkUnSequence.Checked)
            {
                parameters.RatingMethod = RatingMethod.Unsequence;
            }
            else
            {
                MsgBox.Show("您必須要決定一種「排名選項」。", Application.ProductName);
                return;
            }

            if (chkGrade1.Checked)
            {
                parameters.TargetGradeYears.Add("1");
            }
            if (chkGrade2.Checked)
            {
                parameters.TargetGradeYears.Add("2");
            }
            if (chkGrade3.Checked)
            {
                parameters.TargetGradeYears.Add("3");
            }

            if (parameters.TargetGradeYears.Count <= 0)
            {
                MsgBox.Show("您必須選擇要排名的年級。", Application.ProductName);
                return;
            }

            if (chkSemsSubjectScore.Checked)
            {
                parameters.RatingItems |= RatingItems.SemsSubject;
            }

            if (chkSemsScore.Checked)
            {
                parameters.RatingItems |= RatingItems.SemsScore;
            }

            if (chkSemsMoral.Checked)
            {
                parameters.RatingItems |= RatingItems.SemsMoral;
            }

            if (((int)parameters.RatingItems) == 0)
            {
                MsgBox.Show("您必須至少選擇一種「排名項目」。", Application.ProductName);
                return;
            }

            RankProgressForm progress;

            if (Control.ModifierKeys == Keys.Shift)
            {
                progress = new RankProgressForm(parameters, true);
            }
            else
            {
                progress = new RankProgressForm(parameters, false);
            }

            if (progress.ShowDialog() == DialogResult.OK)
            {
                Utility.LogRank("學期成績固定排名", parameters, true);
                MsgBox.Show("排名完成。");
            }
        }