예제 #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");
                }
            }
        }
        //metoda dodająca nową aktywnosc
        private void AddNewActivity()
        {
            FormActivityWindow chooseWindow = new Forms.FormActivityWindow();

            chooseWindow.ShowDialog();
            DisplayCurrentDate();
        }