示例#1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            FormComponetEnable(false);

            if (CheckData() == false)
            {
                return;
            }

            SaveConfigure();

            _PassRate = decimal.Parse(this.iiPassRate.Text);
            _ExamObj  = this.cboExamList.SelectedItem as DAO.ExamVO;

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Title    = "另存新檔";
            saveFileDialog1.FileName = _ExcelFileName + "(" + _ExamObj.SchoolYear + "學年度 第" + _ExamObj.Semester + "學期 " + _ExamObj.ExameName + ")";
            saveFileDialog1.Filter   = "Excel (*.xls)|*.xls|所有檔案 (*.*)|*.*";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // 新增背景執行緒來處理資料的輸出, 把檔案儲存的路徑當作參數傳入
                _BGW_Step1.RunWorkerAsync(new object[] { saveFileDialog1.FileName });
            }
            else
            {
                FormComponetEnable(true);
            }
        }
示例#2
0
        }   // end of OutRowData

        #endregion

        #region 自訂的方法
        private void SetComponentValue()
        {
            // 開始填入內容
            foreach (DAO.ExamVO ExamObj in _ExamList)
            {
                if (!this.cboSchoolYear.Items.Contains(ExamObj.SchoolYear))
                {
                    this.cboSchoolYear.Items.Add(ExamObj.SchoolYear);
                }
            }

            this.cboSemester.Items.Add("1");
            this.cboSemester.Items.Add("2");

            // 填入上次使用者的內容
            this.iiPassRate.Text = _Configure.PassCreditRate;

            foreach (string str in this.cboSchoolYear.Items)
            {
                if (str == _Configure.SchoolYear)
                {
                    // will call ShowExamList
                    this.cboSchoolYear.SelectedItem = str;
                    break;
                }
            }

            foreach (string str in this.cboSemester.Items)
            {
                if (str == _Configure.Semester)
                {
                    // will call ShowExamList
                    this.cboSemester.SelectedItem = str;
                    break;
                }
            }

            for (int intI = 1; intI < this.cboExamList.Items.Count; intI++)
            {
                DAO.ExamVO ExamObj = this.cboExamList.Items[intI] as DAO.ExamVO;

                if (ExamObj.ExamId == _Configure.ExamId)
                {
                    this.cboExamList.SelectedItem = ExamObj;
                    break;
                }
            }
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            FormComponetEnable(false);

            if (CheckData() == false) return;

            SaveConfigure();

            _PassRate = decimal.Parse(this.iiPassRate.Text);
            _ExamObj = this.cboExamList.SelectedItem as DAO.ExamVO;

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Title = "另存新檔";
            saveFileDialog1.FileName = _ExcelFileName + "(" + _ExamObj.SchoolYear + "學年度 第" + _ExamObj.Semester + "學期 " + _ExamObj.ExameName + ")";
            saveFileDialog1.Filter = "Excel (*.xls)|*.xls|所有檔案 (*.*)|*.*";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // 新增背景執行緒來處理資料的輸出, 把檔案儲存的路徑當作參數傳入
                _BGW_Step1.RunWorkerAsync(new object[] { saveFileDialog1.FileName });
            }
            else
            {
                FormComponetEnable(true);
            }
            
        }