private void cmsMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { bool night = false; int section; string sn = e.ClickedItem.Text; int dow = currentCellColumnIndex; if (currentCellRowIndex < Global.LessonPerMorning) { morning = true; night = false; section = currentCellRowIndex; } else if (currentCellRowIndex < Global.LessonPerDay + Global.LessonPerMorning) { morning = false; night = false; section = currentCellRowIndex - Global.LessonPerMorning; } else { night = true; morning = false; section = currentCellRowIndex - Global.LessonPerDay - Global.LessonPerMorning; } int ti = (int)e.ClickedItem.Tag; if (morning) { StaticSQLiteHelper.ReforceSetMorningLesson(currentClassID, dow, section, ti); } else if (night) { StaticSQLiteHelper.ReforceSetNightLesson(currentClassID, dow, section, ti); } else { StaticSQLiteHelper.ReforceSetLesson(currentClassID, dow, section, ti); } if (ti == 0) { dgv.Rows[currentCellRowIndex].Cells[currentCellColumnIndex].Value = ""; } else { dgv.Rows[currentCellRowIndex].Cells[currentCellColumnIndex].Value = sn.Substring(0, 1); } loadHistory(); }