public StudABCard07Content() { InitializeComponent(); this.Group = "綜合表現紀錄表-畢業後計畫"; _StudentIDList = new List<string>(); _KeyNameList = new List<string>(); _KeyNameList.Add(_keyName1); _KeyNameList.Add(_keyName2); _KeyNameList.Add(_keyName3); _KeyNameList.Add(_keyName4); _KeyNameList.Add(_keyName5); _KeyNameList.Add(_keyName6); _flpList = new List<FlowLayoutPanel>(); _flpList.Add(flp1); _flpList.Add(flp2); _flpList.Add(flp3); _flpList.Add(flp4); _QDMang = new ABCardQuestionDataManager(); _PriorityData1 = new UDTPriorityDataDef(); _PriorityData2 = new UDTPriorityDataDef(); _QuestionDict = _QDMang.GetQuestionDataByGroupName(GroupName); _dataMDict = new Dictionary<string, UDTMultipleRecordDef>(); _dataPDict = new Dictionary<string, UDTPriorityDataDef>(); _insertPriorityDataList = new List<UDTPriorityDataDef>(); _InsertMultipleRecordDict = new Dictionary<string, UDTMultipleRecordDef>(); _updatePriorityDataList = new List<UDTPriorityDataDef>(); _deleteMultipleRecordList = new List<UDTMultipleRecordDef>(); _ChangeListener.StatusChanged += new EventHandler<ChangeEventArgs>(_ChangeListener_StatusChanged); _ChangeListener.Add(new DataGridViewSource(dgPriority)); LoadQuestionToUI(); EventHub.CounselChanged += new EventHandler(EventHub_CounselChanged); _bgWorkerM = new BackgroundWorker(); _bgWorkerM.DoWork += new DoWorkEventHandler(_bgWorkerM_DoWork); _bgWorkerM.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorkerM_RunWorkerCompleted); }
/// <summary> /// 報表用解析輔導綜合紀錄優先順序 一:;二:;.. /// </summary> /// <param name="data"></param> /// <returns></returns> public static string Counsel_PriorityData_Parse1(UDTPriorityDataDef data) { List<string> retVal = new List<string>(); if (data != null) { if (!string.IsNullOrWhiteSpace(data.P1)) retVal.Add("一:" + data.P1); if (!string.IsNullOrWhiteSpace(data.P2)) retVal.Add("二:" + data.P2); if (!string.IsNullOrWhiteSpace(data.P3)) retVal.Add("三:" + data.P3); if (!string.IsNullOrWhiteSpace(data.P4)) retVal.Add("四:" + data.P4); if (!string.IsNullOrWhiteSpace(data.P5)) retVal.Add("五:" + data.P5); if (!string.IsNullOrWhiteSpace(data.P6)) retVal.Add("六:" + data.P6); } return string.Join(";", retVal.ToArray()); }
public StudABCard_PriorityForm_Combo(UDTPriorityDataDef Data) { InitializeComponent(); _data = Data; }
void _bgWorkerM_DoWork(object sender, DoWorkEventArgs e) { if (_reloadQuestion) _QuestionDict = _QDMang.GetQuestionDataByGroupName(GroupName); _dataMDict.Clear(); foreach (UDTMultipleRecordDef data in UDTTransfer.ABUDTMultipleRecordSelectByStudentIDList(_StudentIDList)) { if (data.Key.Contains(GroupName)) { string key = data.Key + "_" + data.Data; if (!_dataMDict.ContainsKey(key)) _dataMDict.Add(key, data); } } _PriorityData1 = null; _PriorityData2 = null; string key1 = GroupName + "_" + _keyName5; string key2 = GroupName + "_" + _keyName6; foreach (UDTPriorityDataDef data in UDTTransfer.ABUDTPriorityDataSelectByStudentIDList(_StudentIDList)) { if (data.Key.Contains(GroupName)) { if (key1 == data.Key) _PriorityData1 = data; if (key2 == data.Key) _PriorityData2 = data; } } }
/// <summary> /// 設定儲存資料 /// </summary> private void SetData() { // 刪除舊資料 _deleteMultipleRecordList = _dataMDict.Values.ToList(); UDTTransfer.ABUDTMultipleRecordDelete(_deleteMultipleRecordList); _InsertMultipleRecordDict.Clear(); // 儲存資料 for (int idx = 0; idx < 4; idx++) { FlowLayoutPanel flp = _flpList[idx]; string KeyName = _KeyNameList[idx]; foreach (Control cr in flp.Controls) { if (cr is CheckBox) { CheckBox cb = cr as CheckBox; if (cb.Checked) { UDTMultipleRecordDef data1 = new UDTMultipleRecordDef(); data1.StudentID = _intStudentID; data1.Key = GroupName + "_" + KeyName; data1.Data = cb.Name; data1.Remark = ""; // 處理備註資料 foreach (Control t in flp.Controls) if (t is TextBox) if (t.Name == cb.Name) data1.Remark = t.Text; string insertKey = data1.Key + "_" + cb.Name; if (!_InsertMultipleRecordDict.ContainsKey(insertKey)) _InsertMultipleRecordDict.Add(insertKey, data1); } } } } // 新增至 UDT if (_InsertMultipleRecordDict.Count > 0) UDTTransfer.ABUDTMultipleRecordInsert(_InsertMultipleRecordDict.Values.ToList()); // 讀存資料 List<UDTPriorityDataDef> insertData = new List<UDTPriorityDataDef>(); List<UDTPriorityDataDef> updateData = new List<UDTPriorityDataDef>(); // 將來就業 UDTPriorityDataDef p1 = dgPriority.Columns[1].Tag as UDTPriorityDataDef; if (p1 == null) { p1 = new UDTPriorityDataDef(); p1.Key = GroupName + "_" + _keyName5; p1.StudentID = _intStudentID; } if (dgPriority.Rows[0].Cells[1].Value != null) p1.P1 = dgPriority.Rows[0].Cells[1].Value.ToString(); else p1.P1 = ""; if (dgPriority.Rows[1].Cells[1].Value != null) p1.P2 = dgPriority.Rows[1].Cells[1].Value.ToString(); else p1.P2 = ""; if (dgPriority.Rows[2].Cells[1].Value != null) p1.P3 = dgPriority.Rows[2].Cells[1].Value.ToString(); else p1.P3 = ""; if (string.IsNullOrEmpty(p1.UID)) insertData.Add(p1); else updateData.Add(p1); // 就業地區 UDTPriorityDataDef p2 = dgPriority.Columns[2].Tag as UDTPriorityDataDef; if (p2 == null) { p2 = new UDTPriorityDataDef(); p2.Key = GroupName+"_"+_keyName6; p2.StudentID = _intStudentID; } if (dgPriority.Rows[0].Cells[2].Value != null) p2.P1 = dgPriority.Rows[0].Cells[2].Value.ToString(); else p2.P1 = ""; if (dgPriority.Rows[1].Cells[2].Value != null) p2.P2 = dgPriority.Rows[1].Cells[2].Value.ToString(); else p2.P2 = ""; if (dgPriority.Rows[2].Cells[2].Value != null) p2.P3 = dgPriority.Rows[2].Cells[2].Value.ToString(); else p2.P3 = ""; if (string.IsNullOrEmpty(p2.UID)) insertData.Add(p2); else updateData.Add(p2); if (insertData.Count > 0) UDTTransfer.ABUDTPriorityDataInsert(insertData); if (updateData.Count > 0) UDTTransfer.ABUDTPriorityDataUpdate(updateData); }