private void ClearAll() { try { _startPoint = DateTime.Now.Ticks; SetState(1); int toBeCleared = 3; Invoke(new InitProgressCallBack(InitProgress), new object[] { toBeCleared }); Invoke(new SetTextCallBack(SetText), new object[] { txtProgress, "" }); Invoke(new SetTextCallBack(SetText), new object[] { txtDuration, "" }); int clearing = 0; int cleared = 0; clearing++; string textProgress = "Clearing: " + clearing + "/" + toBeCleared + " (Cleared: " + cleared + ")"; Invoke(new AddProgressCallBack(AddProgress), new object[] { 1 }); Invoke(new SetTextCallBack(SetText), new object[] { txtProgress, textProgress }); Invoke(new SetTextCallBack(SetText), new object[] { txtDuration, GetDuration() }); clearing++; if (_dtCtrl.DeleteAllAttendanceRecord()) { cleared++; } textProgress = "Clearing: " + clearing + "/" + toBeCleared + " (Cleared: " + cleared + ")"; Invoke(new AddProgressCallBack(AddProgress), new object[] { 1 }); Invoke(new SetTextCallBack(SetText), new object[] { txtProgress, textProgress }); Invoke(new SetTextCallBack(SetText), new object[] { txtDuration, GetDuration() }); clearing++; if (_dtCtrl.DeleteAllAttendanceReport()) { cleared++; } textProgress = "Clearing: " + clearing + "/" + toBeCleared + " (Cleared: " + cleared + ")"; Invoke(new AddProgressCallBack(AddProgress), new object[] { 1 }); Invoke(new SetTextCallBack(SetText), new object[] { txtProgress, textProgress }); Invoke(new SetTextCallBack(SetText), new object[] { txtDuration, GetDuration() }); MessageBox.Show(cleared + " table(s) have been cleared"); } catch (Exception ex) { MessageBox.Show(ex.Message); } SetState(0); }
public void TestDeleteAllAttendanceRecord() { AddAttRecord(); Assert.AreEqual(true, _dtCtrl.DeleteAllAttendanceRecord()); Assert.AreEqual(0, _dtCtrl.GetAttendanceRecordList().Count); DelAttRecord(); }