Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (K12.Presentation.NLDPanels.Class.SelectedSource.Count == 0)
            {
                return;
            }

            this.btnSave.Enabled = false;

            //LoadPreference();

            GetCD = new GetConfigData();
            GetCD.SaveAll();
            GetCD.Reset();


            FISCA.Presentation.MotherForm.SetStatusBarMessage("正在初始化班級學生缺曠明細(確認表)...");

            object[] args = new object[] { dateTimeInput1.Value, dateTimeInput2.Value, _sizeIndex, Absence, GetCD.ClassNoData }; //日期起始,結束,紙張大小,列印假別,是否列印無資料班級

            _BGWClassStudentAbsenceDetail                       = new BackgroundWorker();
            _BGWClassStudentAbsenceDetail.DoWork               += new DoWorkEventHandler(_BGWClassStudentAbsenceDetail_DoWork);
            _BGWClassStudentAbsenceDetail.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(_BGWClassStudentAbsenceDetail_RunWorkerCompleted);
            _BGWClassStudentAbsenceDetail.ProgressChanged      += new ProgressChangedEventHandler(_BGWClassStudentAbsenceDetail_ProgressChanged);
            _BGWClassStudentAbsenceDetail.WorkerReportsProgress = true;
            _BGWClassStudentAbsenceDetail.RunWorkerAsync(args);
        }
Example #2
0
        public AttendanceListForm()
        {
            InitializeComponent();

            string TimmeInput1 = DateTime.Now.AddMonths(-1).ToString("yyyy/MM/dd");

            dateTimeInput1.Text = TimmeInput1;

            string TimmeInput2 = DateTime.Now.ToString("yyyy/MM/dd");

            dateTimeInput2.Text = TimmeInput2;

            GetCD = new GetConfigData();


            //LoadPreference(); //驗證設定檔 及 設定內容
        }
        public SetupForm(GetConfigData RT)
        {
            InitializeComponent();

            _CD = RT;
        }
        public GetAbsenceDetail(DateTime startDate, DateTime endDate, List <string> periodList)
        {
            #region 建構子
            allAbsenceDetail.Clear();
            studentClassDict.Clear();
            StudentRecordList.Clear();
            studentInfoDict.Clear();

            GetConfigData cd = new GetConfigData();

            selectedClass = Class.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource);
            selectedClass = SortClassIndex.K12Data_ClassRecord(selectedClass);
            //selectedClass.Sort(new Comparison<ClassRecord>(ClassComparer));

            //所有學生ID
            List <string> allStudentID = new List <string>();

            //缺曠筆數
            //int currentCount = 1;
            int totalNumber = 0;

            //紀錄每一個 Column 的 Index
            Dictionary <string, int> columnTable = new Dictionary <string, int>();

            //建立學生班級對照表
            foreach (ClassRecord aClass in selectedClass)
            {
                foreach (StudentRecord student in aClass.Students)
                {
                    if (student.Status == StudentRecord.StudentStatus.刪除 || student.Status == StudentRecord.StudentStatus.畢業或離校)
                    {
                        continue;
                    }

                    StudentRecordList.Add(student);
                    allStudentID.Add(student.ID);
                    studentClassDict.Add(student.ID, aClass.ID);
                    studentInfoDict.Add(student.ID, student);
                }

                allAbsenceDetail.Add(aClass.ID, new Dictionary <string, Dictionary <string, Dictionary <string, string> > >());
            }

            //取得相關資料
            List <AttendanceRecord> GetAttList = Attendance.SelectByDate(StudentRecordList, startDate, endDate);

            //處理資料
            foreach (AttendanceRecord var in GetAttList)
            {
                string studentID = var.RefStudentID;
                string occurDate = HowManyWeek(var.OccurDate);
                string classID   = studentClassDict[studentID];

                if (!allAbsenceDetail.ContainsKey(classID))
                {
                    allAbsenceDetail.Add(classID, new Dictionary <string, Dictionary <string, Dictionary <string, string> > >());
                }

                if (!allAbsenceDetail[classID].ContainsKey(studentID))
                {
                    allAbsenceDetail[classID].Add(studentID, new Dictionary <string, Dictionary <string, string> >());
                }

                if (!allAbsenceDetail[classID][studentID].ContainsKey(occurDate))
                {
                    allAbsenceDetail[classID][studentID].Add(occurDate, new Dictionary <string, string>());
                }

                foreach (AttendancePeriod period in var.PeriodDetail)
                {
                    //與設定檔對照,如果沒有就不列入列印資料
                    if (!cd.Setup_AttendanceList.Contains(period.AbsenceType))
                    {
                        continue;
                    }
                    //節次
                    string innertext = period.Period;
                    //缺曠別
                    string absence = period.AbsenceType;

                    if (!allAbsenceDetail[classID][studentID][occurDate].ContainsKey(innertext))
                    {
                        allAbsenceDetail[classID][studentID][occurDate].Add(innertext, absence);
                    }
                }

                //累計筆數
                totalNumber++;
            }


            #endregion
        }
        public AttendanceSetup(GetConfigData CD)
        {
            InitializeComponent();

            _CD = CD;
        }