private void BatchStudGraduateUpdateRec_Load(object sender, EventArgs e) { dtUpdateDate.Text = DateTime.Now.ToShortDateString(); dtUpdateDate.Select(); if (Errors == null) { Errors = new EnhancedErrorProvider(); } // 載入預設年度與月份 UpdateRecordUtil.LoadYearAndMonth(txtYear, cboMonth); StudentIDList = new List <string>(); StudOldUpdateRecsDic = new Dictionary <string, List <JHPermrec.UpdateRecord.DAL.StudUpdateRecordEntity> >(); StudOldUpdateRecList = new List <JHPermrec.UpdateRecord.DAL.StudUpdateRecordEntity>(); StudUpdateRecsList = new List <JHPermrec.UpdateRecord.DAL.StudUpdateRecordEntity>(); // Load 上來樣式 if (_FLT == FormLoadType.學生) { labelX2.Location = new Point(12, 41); dtUpdateDate.Location = new Point(74, 42); labelX3.Location = new Point(11, 73); txtYear.Location = new Point(73, 73); labelX5.Location = new Point(136, 73); cboMonth.Location = new Point(169, 71); btnAddData.Location = new Point(55, 106); btnExit.Location = new Point(150, 106); this.MaximumSize = new System.Drawing.Size(242, 173); this.Size = new System.Drawing.Size(242, 173); labelX4.Visible = false; cboGradeYear.Visible = false; } else { labelX4.Visible = true; cboGradeYear.Visible = true; labelX4.Location = new Point(36, 42); cboGradeYear.Location = new Point(75, 42); labelX2.Location = new Point(13, 73); dtUpdateDate.Location = new Point(75, 73); labelX3.Location = new Point(13, 108); txtYear.Location = new Point(75, 106); labelX5.Location = new Point(138, 108); btnAddData.Location = new Point(71, 141); btnExit.Location = new Point(150, 141); cboMonth.Location = new Point(169, 106); this.MaximumSize = new System.Drawing.Size(252, 203); this.Size = new System.Drawing.Size(252, 203); cboGradeYear.Items.Clear(); foreach (int gr in DAL.DALTransfer2.GetClassGardeYearList()) { cboGradeYear.Items.Add(gr.ToString()); } } this.StartPosition = FormStartPosition.CenterScreen; }
private void btnAddData_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(dtUpdateDate.Text)) { Errors.SetError(dtUpdateDate, "請輸入異動日期."); return; } strEnrrolSchoolYear = UpdateRecordUtil.checkYearAndMonthInput(txtYear, cboMonth, Errors); if (strEnrrolSchoolYear == "") { return; } int intMonth; int.TryParse(cboMonth.Text.Trim(), out intMonth); if (intMonth < 10) { _StudentBatchEnrollYearMonth = txtYear.Text.Trim() + "0" + intMonth; } else { _StudentBatchEnrollYearMonth = txtYear.Text.Trim() + intMonth; } // 取得學生 ID 方式 // 取得畫面上所選學生ID if (_FLT == FormLoadType.學生) { StudentIDList = DAL.DALTransfer2.GetStudentTypeIDFromIDs(K12.Presentation.NLDPanels.Student.SelectedSource, K12.Data.StudentRecord.StudentStatus.一般); } else { StudentIDList = DAL.DALTransfer2.GetStudentIDListByGradeYear(cboGradeYear.Text); } if (StudentIDList.Count == 0) { return; } else { btnAddData.Enabled = false; } // 讀取資料 _ReadDataWork = new BackgroundWorker(); _ReadDataWork.DoWork += new DoWorkEventHandler(_ReadDataWork_DoWork); _ReadDataWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_ReadDataWork_RunWorkerCompleted); _ReadDataWork.RunWorkerAsync(); }