public override string Import(List <IRowStream> Rows) { string retStr = ""; bool run = false; MsgForm mf = new MsgForm(); mf.Text = "匯入高關懷學生"; mf.SetMsg("匯入高關懷學生,按下「是」確認後,需報局備查,新生編班時確認之特殊生和高關懷學生名單,匯入系統後不需報局。"); //if (FISCA.Presentation.Controls.MsgBox.Show("匯入高關懷學生,按下「是」確認後,需報局備查,新生編班時確認之特殊生和高關懷學生名單,匯入系統後不需報局。", "匯入高關懷學生", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) if (mf.ShowDialog() == DialogResult.Yes) { run = true; } else { FISCA.Presentation.Controls.MsgBox.Show("停止匯入高關懷學生,不會變更資料。"); } if (_Option.Action == ImportAction.InsertOrUpdate && run) { List <UDT_HighConcern> HighConcernList = new List <UDT_HighConcern>(); List <logStud> logStudList = new List <logStud>(); int pIdx = 0; foreach (IRowStream row in Rows) { pIdx++; this.ImportProgress = pIdx; string IDNumber = "", StudentNumber = "", StudentName = "", ClassName = "", SeatNo = "", NumberReduce = "", DocNo = "", EDoc = ""; StudentNumber = row.GetValue("學號"); int hCount = int.Parse(row.GetValue("減免人數")); DocNo = row.GetValue("文號"); EDoc = row.GetValue("相關證明文件網址"); if (_StudentNumIDDict.ContainsKey(StudentNumber)) { string sid = _StudentNumIDDict[StudentNumber]; StudentRecord rec = _StudentRecDict[sid]; IDNumber = rec.IDNumber; StudentName = rec.Name; if (rec.SeatNo.HasValue) { SeatNo = rec.SeatNo.Value.ToString(); } if (rec.Class != null) { ClassName = rec.Class.Name; } NumberReduce = hCount.ToString(); if (_HighConcernDict.ContainsKey(sid)) { // 更新 _HighConcernDict[sid].NumberReduce = hCount; _HighConcernDict[sid].DocNo = DocNo; _HighConcernDict[sid].EDoc = EDoc; HighConcernList.Add(_HighConcernDict[sid]); } else { // 新增 UDT_HighConcern newData = new UDT_HighConcern(); newData.ClassName = ClassName; newData.SeatNo = SeatNo; newData.StudentNumber = StudentNumber; newData.RefStudentID = sid; newData.HighConcern = true; newData.NumberReduce = hCount; newData.DocNo = DocNo; newData.EDoc = EDoc; HighConcernList.Add(newData); } // 傳送至局端 logStud ls = new logStud(); ls.IDNumber = IDNumber; ls.StudentNumber = StudentNumber; ls.StudentName = StudentName; ls.ClassName = ClassName; ls.SeatNo = SeatNo; ls.DocNo = DocNo; ls.NumberReduce = NumberReduce; ls.EDoc = EDoc; logStudList.Add(ls); //Utility.SendData("匯入特殊身分", IDNumber, StudentNumber, StudentName, ClassName, SeatNo, DocNo, NumberReduce); } } // save if (logStudList.Count > 0) { Utility.SendDataList("匯入特殊身分", logStudList); } HighConcernList.SaveAll(); eh(this, EventArgs.Empty); } return(retStr); }
protected override void OnSaveButtonClick(EventArgs e) { if (chkData()) { int bb; int.TryParse(txtCount.Text, out bb); _ChangeListener.SuspendListen(); string IDNumber = "", StudentNumber = "", StudentName = "", ClassName = "", SeatNo = "", NumberReduce = "", DocNo = "", EDoc = ""; IDNumber = _StudRec.IDNumber; StudentNumber = _StudRec.StudentNumber; StudentName = _StudRec.Name; if (_StudRec.SeatNo.HasValue) { SeatNo = _StudRec.SeatNo.Value.ToString(); } if (_StudRec.Class != null) { ClassName = _StudRec.Class.Name; } NumberReduce = bb.ToString(); DocNo = txtDocNo.Text; EDoc = txtEDoc.Text; if (chkHighConcern.Checked) { #region 傳送變更特殊身分 MsgForm mf = new MsgForm(); mf.Text = "高關懷學生"; mf.SetMsg("變更高關懷特殊身分,按下「是」確認後,不需函報教育局,僅由局端線上審核。"); // 再次確認畫面 //if (FISCA.Presentation.Controls.MsgBox.Show("變更高關懷特殊身分,按下「是」確認後,不需函報教育局,僅由局端線上審核。", "高關懷學生", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) if (mf.ShowDialog() == DialogResult.Yes) { // 檢查當已是高關懷 if (_HighConcernDict.ContainsKey(PrimaryKey)) { // 有勾選更新人數,沒有勾選刪除,因為沒存在必要 if (chkHighConcern.Checked) { _HighConcernDict[PrimaryKey].NumberReduce = bb; _HighConcernDict[PrimaryKey].DocNo = txtDocNo.Text; _HighConcernDict[PrimaryKey].EDoc = txtEDoc.Text; } else { txtCount.Text = ""; txtDocNo.Text = ""; txtEDoc.Text = ""; _HighConcernDict[PrimaryKey].Deleted = true; } _HighConcernDict[PrimaryKey].Save(); } else { UDT_HighConcern newData = new UDT_HighConcern(); newData.StudentNumber = StudentNumber; newData.SeatNo = SeatNo; newData.ClassName = ClassName; newData.DocNo = txtDocNo.Text; newData.EDoc = txtEDoc.Text; newData.RefStudentID = PrimaryKey; newData.HighConcern = true; newData.NumberReduce = bb; newData.DocNo = txtDocNo.Text; newData.Save(); } // 傳送至局端 string errMsg = Utility.SendData("變更特殊身分", IDNumber, StudentNumber, StudentName, ClassName, SeatNo, DocNo, NumberReduce, EDoc); if (errMsg != "") { FISCA.Presentation.Controls.MsgBox.Show(errMsg); } } else { chkHighConcern.Checked = false; } #endregion } else { #region 傳送取消特殊身分 if (_HighConcernDict.ContainsKey(PrimaryKey)) { // 取消清空畫面值與刪除該筆UDT txtCount.Text = ""; txtDocNo.Text = ""; txtEDoc.Text = ""; _HighConcernDict[PrimaryKey].Deleted = true; _HighConcernDict[PrimaryKey].Save(); string errMsg = Utility.SendData("取消特殊身分", IDNumber, StudentNumber, StudentName, ClassName, SeatNo, DocNo, NumberReduce, EDoc); if (errMsg != "") { FISCA.Presentation.Controls.MsgBox.Show(errMsg); } } #endregion } this.CancelButtonVisible = false; this.SaveButtonVisible = false; eh(this, EventArgs.Empty); _ChangeListener.Reset(); _ChangeListener.ResumeListen(); } }