private void DgItemList_LostFocus(object sender, RoutedEventArgs e) { SaveDataHandler.OpenConnection(); for (int i = 0; i < categoryManager.SelectedCategoryItems.Count; i++) { SaveDataHandler.UpdateItemInTableManualConnection(categoryManager.SelectedCategoryItems[i]); } SaveDataHandler.CloseConnection(); //Console.WriteLine("data grid lost focus"); //HistoryRecord(); }
private void RewriteAllData() { SaveDataHandler.OpenConnection(); for (int i = 0; i < categoryManager.CategoryCount; i++) { SaveDataHandler.UpdateCategoryInTableManualConnection(categoryManager.Categories[i]); for (int x = 0; x < categoryManager.Categories[i].Items.Count; x++) { SaveDataHandler.UpdateItemInTableManualConnection(categoryManager.Categories[i].Items[x]); } } SaveDataHandler.CloseConnection(); }