public static List <DayEntry> Days; //global list of all Day Entries found in current program state #endregion #region Constructor public MainForm() //init list and components { InitializeComponent(); Foods = new List <FoodItem>(); Days = new List <DayEntry>(); DBCommands.loadDefaults(); //load default DB values for DBHelper use }
private void buttonPeriodFromDB_Click(object sender, EventArgs e) //loads from Database data program state data(Foods and Days) from selected calendar range { output.AppendText($"TESTING...\n"); Stopwatch timer = Stopwatch.StartNew(); Days = DBCommands.SelectDayEntries(calendar.SelectionStart, calendar.SelectionEnd, out int x); output.AppendText($"Meal Entry Affected:{x}\n"); timer.Stop(); output.AppendText($"\n...DONE! ({timer.Elapsed})\n"); }
private void button_LoadIntoDB_Click(object sender, EventArgs e) //loads all the currect program state data(Foods and Days) into Database { output.AppendText($"Inserting Foods and Day Entries into DataBase...\n"); output.Update(); Stopwatch timer = Stopwatch.StartNew(); output.AppendText("\nInsert FoodItems Affected:" + DBCommands.InsertFoodItems(Foods)); //prints to output all DB rows affected/called relating to Foods output.AppendText("\nInsert Days Affected: " + DBCommands.InsertDays(Days)); //prints to output all DB rows affected/called relating to Days timer.Stop(); output.AppendText($"\n...DONE! ({timer.Elapsed})\n"); }
private void button_GetFromDB_Click(object sender, EventArgs e) //loads from Database all data into program state data(Foods and Days) { output.AppendText($"Loading Entries from DataBase..."); output.Update(); Stopwatch timer = Stopwatch.StartNew(); Foods = new List <FoodItem>(); Days = new List <DayEntry>(); output.AppendText($"Meal Entry Affected:{DBCommands.SelectDayEntriesAll()}\n"); //prints to output all DB rows affected/called timer.Stop(); output.AppendText($"\n...DONE! ({timer.Elapsed})\n"); button_intoDB.Enabled = true; //enables loading data to Database }