Ejemplo n.º 1
0
        public TransferStudentForm(string studentid)
        {
            CurrentStudentID = studentid;

            InitializeComponent();
            _steps = new List <IStep>();

            this.TransferStudentData = TransferStudentDAL.GetStudentTransferData(studentid);

            _steps.Add(new Step1(this));
            _steps.Add(new Step2(this));
            _steps.Add(new Step3(this));

            _currentStepIndex   = 0;
            btnPrevious.Enabled = false;
            btnSave.Enabled     = false;
            LoadCurrentStep();
        }
Ejemplo n.º 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     foreach (IStep step in _steps)
     {
         if (!step.Valid())
         {
             MessageBoxEx.Show(step.ErrorMessage, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         step.OnChangeStep();
     }
     try
     {
         TransferStudentDAL.Save(this.TransferStudentData, CurrentStudentID);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show("儲存過程中發生錯誤", "儲存失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
        public Step2(TransferStudentForm parent)
        {
            _parent = parent;

            InitializeComponent();

            if (Student.Instance.SelectedList.Count == 0)
            {
                return;
            }
            _studentID = Student.Instance.SelectedList[0].ID;

            // 處理日常生活表現畫面
            dgDailyLifeRecommend.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgDailyLifeRecommend.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgDailyLifeRecommend.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgDailyLifeRecommend.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> dailyLifeRecommendItems = TransferStudentDAL.GetDailyLifeRecommendItems();

            foreach (string dailyLifeRecommend in dailyLifeRecommendItems)
            {
                int columnIndex           = dgDailyLifeRecommend.Columns.Add(dailyLifeRecommend, dailyLifeRecommend);
                DataGridViewColumn column = dgDailyLifeRecommend.Columns[columnIndex];
                column.Width = 400;
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgDailyLifeRecommend.Rows.Add();

                DataGridViewRow row = dgDailyLifeRecommend.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                //把值塞進來 .....
                foreach (string dailyLifeRecommend in dailyLifeRecommendItems)
                {
                    DailyLifeRecommendItem item = _parent.TransferStudentData.DailyLifeRecommendData.GetItem(dailyLifeRecommend, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[dailyLifeRecommend].Value = item.Description;
                    }
                }
            }

            _dailyLifeRecommendDegrees = TransferStudentDAL.GetDailyLifeRecommendMapping();

            // 公共服務表現畫面
            dgPublicService.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgPublicService.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgPublicService.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgPublicService.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> PublicServiceServiceItems = TransferStudentDAL.GetPublicServicesItems();

            foreach (string dailyBehavior in TransferStudentDAL.GetPublicServicesItems())
            {
                dgPublicService.Columns.Add(dailyBehavior, dailyBehavior);
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgPublicService.Rows.Add();

                DataGridViewRow row = dgPublicService.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in PublicServiceServiceItems)
                {
                    PublicServiceItem item = _parent.TransferStudentData.PublicServiceData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[each].Value = item.Description;
                    }
                }
            }

            //校內外特殊表現輸入畫面
            dgSchoolSpecial.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgSchoolSpecial.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgSchoolSpecial.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgSchoolSpecial.Columns[SEMESTER_COLUMN].Width = 65;

            List <string> schoolSpecialItems = TransferStudentDAL.GetSchoolSpecialItems();

            foreach (string each in schoolSpecialItems)
            {
                dgSchoolSpecial.Columns.Add(each, each);
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgSchoolSpecial.Rows.Add();

                DataGridViewRow row = dgSchoolSpecial.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in schoolSpecialItems)
                {
                    SchoolSpecialItem item = _parent.TransferStudentData.SchoolSpecialData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[each].Value = item.Description;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        //public TransferStudentData TransferStudentData { get; set; }

        public Step1(TransferStudentForm parent)
        {
            InitializeComponent();

            _parent = parent;

            if (Student.Instance.SelectedList.Count == 0)
            {
                return;
            }
            _studentID = Student.Instance.SelectedList[0].ID;

            // 處理日常生活表現畫面
            dgDailyBehavior.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgDailyBehavior.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgDailyBehavior.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgDailyBehavior.Columns[SEMESTER_COLUMN].Width = 60;

            List <string> dailyBehaviorItems = TransferStudentDAL.GetDailyBehaviorItems();

            foreach (string dailyBehavior in dailyBehaviorItems)
            {
                dgDailyBehavior.Columns.Add(dailyBehavior, dailyBehavior);
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgDailyBehavior.Rows.Add();

                DataGridViewRow row = dgDailyBehavior.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in dailyBehaviorItems)
                {
                    DailyBehaviorItem item = _parent.TransferStudentData.DailyBehaviorData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[each].Value = item.Degree;
                    }
                }
            }

            _dailyBehaviorDegrees = TransferStudentDAL.GetDailyBehaviorDegrees();

            //處理團體活動輸入畫面
            dgTeam.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgTeam.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgTeam.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgTeam.Columns[SEMESTER_COLUMN].Width = 60;

            _groupActivityItems = TransferStudentDAL.GetGroupActivitieItems();
            foreach (string each in _groupActivityItems)
            {
                string each1 = GetGADegreeColName(each);
                string each2 = GetGATextColName(each);

                int columnIndex1 = dgTeam.Columns.Add(each1, each1);
                int columnIndex2 = dgTeam.Columns.Add(each2, each2);

                DataGridViewColumn column1 = dgTeam.Columns[columnIndex1];
                DataGridViewColumn column2 = dgTeam.Columns[columnIndex2];

                column1.Tag = each;
                column2.Tag = each;
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgTeam.Rows.Add();

                DataGridViewRow row = dgTeam.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                foreach (string each in _groupActivityItems)
                {
                    GroupActivityItem item = _parent.TransferStudentData.GroupActivityData.GetItem(each, sh.SchoolYear, sh.Semester);

                    if (item != null)
                    {
                        row.Cells[GetGADegreeColName(each)].Value = item.Degree;
                        row.Cells[GetGATextColName(each)].Value   = item.Text;
                    }
                }
            }

            _groupActivityDegrees = TransferStudentDAL.GetGroupActivityDegrees();
        }
Ejemplo n.º 5
0
        public Step3(TransferStudentForm parent)
        {
            InitializeComponent();

            _parent = parent;

            if (Student.Instance.SelectedList.Count == 0)
            {
                return;
            }
            _studentID = Student.Instance.SelectedList[0].ID;

            dgMeritStatistic.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgMeritStatistic.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgMeritStatistic.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgMeritStatistic.Columns[SEMESTER_COLUMN].Width = 60;

            _meritTypes = TransferStudentDAL.GetMeritTypes();

            foreach (string merit in _meritTypes)
            {
                int columnIndex = dgMeritStatistic.Columns.Add(merit, merit);
                dgMeritStatistic.Columns[columnIndex].Width = 60;
            }

            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int rowIndex = dgMeritStatistic.Rows.Add();

                DataGridViewRow row = dgMeritStatistic.Rows[rowIndex];
                row.Tag = sh;

                DataGridViewCell cell = row.Cells[SCHOOL_YEAR_COLUMN];
                cell.Value    = sh.SchoolYear;
                cell.ReadOnly = true;

                cell          = row.Cells[SEMESTER_COLUMN];
                cell.Value    = sh.Semester;
                cell.ReadOnly = true;

                //把值塞進來 .....
                foreach (string mt in _meritTypes)
                {
                    MeritStatisticItem item = _parent.TransferStudentData.MeritStatisticData.GetItem(sh.SchoolYear, sh.Semester, mt);

                    if (item != null)
                    {
                        row.Cells[mt].Value = item.Count;
                    }
                }
            }

            //處理缺曠輸入畫面
            dgAbsence.Columns.Add(SCHOOL_YEAR_COLUMN, SCHOOL_YEAR_COLUMN);
            dgAbsence.Columns[SCHOOL_YEAR_COLUMN].Width = 75;
            dgAbsence.Columns.Add(SEMESTER_COLUMN, SEMESTER_COLUMN);
            dgAbsence.Columns[SEMESTER_COLUMN].Width = 60;

            _periodTypes = TransferStudentDAL.GetPeriodTypeItems();
            _absenceList = TransferStudentDAL.GetAbsenceItems();

            foreach (string periodType in _periodTypes)
            {
                foreach (string each in _absenceList)
                {
                    string columnName = periodType + each;

                    dgAbsence.Columns.Add(columnName, columnName);
                    dgAbsence.Columns[columnName].Width = 60;
                    dgAbsence.Columns[columnName].Tag   = periodType + ":" + each;
                }
            }

            // 塞入缺曠之預設值
            foreach (SemesterHistoryData sh in TransferStudentDAL.GetSemesterHistory(_studentID))
            {
                int             rowIndex = dgAbsence.Rows.Add();
                DataGridViewRow row      = dgAbsence.Rows[rowIndex];

                row.Cells[SCHOOL_YEAR_COLUMN].Value = sh.SchoolYear;
                row.Cells[SEMESTER_COLUMN].Value    = sh.Semester;

                foreach (string periodType in _periodTypes)
                {
                    foreach (string each in _absenceList)
                    {
                        string columnName = periodType + each;

                        AbsenceItem item = _parent.TransferStudentData.AbsenceData.GetItem(sh.SchoolYear, sh.Semester, periodType, each);

                        if (item != null)
                        {
                            row.Cells[columnName].Value = item.Count;
                        }
                    }
                }
            }
        }