public frmStatistics_SingleForm(UDT.StatisticsGroup StatisticsGroup, UDT.Survey Survey)
 {
     InitializeComponent();
     this.StatisticsGroup = StatisticsGroup;
     this.Survey = Survey;
     Access = new AccessHelper();
     this.ErrorProvider = new ErrorProvider();
     this.Load += new EventHandler(frmStatistics_SingleForm_Load);
 }
        private void Save_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            if (!this.Validated())
            {
                MessageBox.Show("請修正錯誤再儲存。");
                this.DialogResult = System.Windows.Forms.DialogResult.None;
                return;
            }
            if (this.StatisticsGroup == null)
                this.StatisticsGroup = new UDT.StatisticsGroup();

            this.StatisticsGroup.Name = this.txtStatisticsGroup.Text.Trim();

            ComboItem item = (ComboItem)this.cboSurvey.SelectedItem;
            string SurveyID = ((UDT.Survey)item.Tag).UID;
            this.StatisticsGroup.SurveyID = int.Parse(SurveyID);

            StringBuilder sb = new StringBuilder("<Questions>");
            /// <Questions>
            ///     <Question QuestionID="123" DisplayOrder="1">本課程的內容和學習目標十分明確</Question>
            ///     <Question QuestionID="456" DisplayOrder="2">本課程上課內容充實,且符合教學大綱</Question>
            /// </Questions>
            foreach (ListViewItem Item in this.lstQuestions.Items)
            {
                if (Item.Checked)
                {
                    UDT.Question Question = Item.Tag as UDT.Question;
                    sb.AppendFormat(@"<Question QuestionID='{0}' DisplayOrder='{1}'>{2}</Question>", Question.UID, Question.DisplayOrder, Question.Title);
                }
            }

            this.StatisticsGroup.DisplayOrderList = sb.Append("</Questions>").ToString();

            this.StatisticsGroup.Save();
            this.Close();
        }