private void btnSave_Click(object sender, EventArgs e) { if (_QuestionData != null) { _QuestionData.ControlType = cbxControlType.Text; _QuestionData.QuestionType = cbxQuestionType.Text; _QuestionData.DisplayOrder = intDisplayOrder.Value; _QuestionData.CanPrint = chkCanPrint.Checked; _QuestionData.CanStudentEdit = chkCanStudentEdit.Checked; _QuestionData.CanTeacherEdit = chkCanTeacherEdit.Checked; if (dgItems.Rows.Count > 0) { List <QuestionItem> qiList = new List <QuestionItem>(); foreach (DataGridViewRow drv in dgItems.Rows) { if (drv.IsNewRow) { continue; } bool hasR = false; if (drv.Cells[colHasRemark.Index].Value != null) { hasR = bool.Parse(drv.Cells[colHasRemark.Index].Value.ToString()); } QuestionItem qi; string key = drv.Cells[colName.Index].Value.ToString(); if (hasR) { qi = new QuestionItem(key, hasR); } else { qi = new QuestionItem(key); } qiList.Add(qi); } _QuestionData.itemList = qiList; } List <UDTQuestionsDataDef> data = new List <UDTQuestionsDataDef>(); data.Add(_QuestionData.GetUpdateData()); UDTTransfer.ABUDTQuestionsDataUpdate(data); // 呼叫同步 EventHub.OnCounselChanged(); FISCA.Presentation.Controls.MsgBox.Show("儲存完成!"); } }