public void SetAbsence(UDT.Absence abs, int rowIndex, int colIndex)
        {
            if (abs == null)  this.Close();

            this.abs = abs;
            this.rowIndex = rowIndex;
            this.colIndex = colIndex;
        }
        private void addAbsRec()
        {
            int studentID = (int)dg.CurrentCell.OwningRow.Tag;
            int sectionID = this.SectionIDs[this.dg.CurrentCell.ColumnIndex - 7];
            int course_ID = int.Parse(this.dicCourses[this.cboCourse.SelectedItem.ToString()]);
            //判斷這筆紀錄在 DB 中是否存在
            string key = studentID + "_" + sectionID;
            UDT.Absence absRec = this.GetAbsenceRecord(studentID, sectionID);

            if (!this.updatedRecs.ContainsKey(key)) //判斷記憶體中是否存在。理論上應該不會存在才對,如果已存在,就忽略不理。
            {
                //如果 DB 有,而記憶體中沒有 (雖然不可能),就加入
                if (absRec != null)
                {
                    absRec.Deleted = false;
                    this.updatedRecs.Add(key, absRec);
                }
                else   //如果 DB 有,而記憶體中沒有 (雖然不可能),就加入
                {
                    UDT.Absence abs = new UDT.Absence();
                    abs.SectionID = sectionID;
                    abs.StudentID = studentID;
                    abs.CourseID = course_ID;
                    this.updatedRecs.Add(key, abs);
                }
            }
            else  //如果存在記憶體中,只有一種狀況 => 已存在 DB,然後畫面上被刪除,且尚未儲存,這時候該物件的 Deleted = false ,讓它變成修改
            {
                if (absRec != null)
                {
                    this.updatedRecs[key].Deleted = false;
                }
            }
            this.dg.CurrentCell.Value = makeCellContent(this.updatedRecs[key]);
            this.dg.CurrentCell.Style.ForeColor = Color.Red;
            this.enableButtons();
        }