예제 #1
0
        private void ShowEventDetail(int appID, string table)
        {
            string          sql       = $"SELECT * FROM {table} WHERE ID = {appID}";
            DatabaseManager dbManager = new DatabaseManager();
            DataTable       dt        = dbManager.QueryAsDataTable(sql);

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                if (table == "activity")
                {
                    FormActivityWindow eventForm = new FormActivityWindow(appID);
                    eventForm.FillFieldsFromDataRow(row);
                    eventForm.Show();
                }
                else if (table == "meal")
                {
                    FormMealWindow eventForm = new FormMealWindow(appID);
                    eventForm.FillFieldsFromDataRow(row);
                    eventForm.Show();
                }
                else
                {
                    MessageBox.Show("No such table");
                }
            }
        }
 private void AddNewMeal()
 {
     ActivityMonitor.Forms.FormMealWindow chooseWindow = new Forms.FormMealWindow();
     chooseWindow.ShowDialog();
     DisplayCurrentDate();
 }