예제 #1
0
        //private SpecialStudentConfig mconfig;
        public RewardStatistics(List<RewardInfo> RewardList, int Kind, SpecialStudentConfig mconfig)
        {
            mRewardList = RewardList;

            //獎懲記錄
            foreach (RewardInfo Reward in mRewardList)
            {
                if (Kind == 1 || Kind == 2)
                {
                    if (Reward.SchoolYear == mconfig.thisSchoolYear && Reward.Semester == mconfig.thisSemester)
                        if (Kind == 3)
                        {
                            if (Reward.OccurDate >= mconfig.StartDate && Reward.OccurDate <= mconfig.EndDate)
                                SetCount(Reward);
                        }
                        else if (Kind == 2) //2012/2/3 - 新增判斷式,以判斷當使用者選擇日期區間時,累積的值
                        {
                            if (Reward.OccurDate >= mconfig.StartDate && Reward.OccurDate <= mconfig.EndDate)
                                SetCount(Reward);
                        }
                        else
                        {
                            SetCount(Reward);
                        }
                }
                else
                    SetCount(Reward);
            }
        }
예제 #2
0
        private void btnReport_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.SaveFileDialog saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            saveFileDialog1.FileName = "特殊學生清單.xls";
            saveFileDialog1.AddExtension = true;
            saveFileDialog1.DefaultExt = "xls";

            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                mconfig = new SpecialStudentConfig(this);
                if (mconfig.ReportType == 0)
                    MessageBox.Show("未選定報表類別,無法產生清單");
                else
                {
                    if (mconfig.ReportType == 5 && (mconfig.Period <= 0 || mconfig.AbsenceList == null))
                        MessageBox.Show("輸入資料不完整,無法產生清單");
                    else
                    {
                        if (mconfig.Date && (mconfig.StartDate == null || mconfig.EndDate == null))
                            MessageBox.Show("輸入資料不完整,無法產生清單");
                        else
                        {
                            ProcessDocument();
                            try
                            {
                                SpecialStudentBook.Save(saveFileDialog1.FileName);
                                System.Diagnostics.Process.Start(saveFileDialog1.FileName);
                            }
                            catch
                            {
                                System.Windows.Forms.MessageBox.Show("指定路徑無法存取。", "建立檔案失敗", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            }
                        }
                    }
                }
            }
        }