Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();


            listView1.View = View.Details;

            listView1.Columns.Add("Name");
            listView1.Columns.Add("Meal");
            listView1.Columns.Add("Category");
            listView1.Columns.Add("Day");
            listView1.Columns.Add("Day Num");

            try
            {
                conn.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show("We cannot connect to the database", ex.Message);
                return;
            }
            Updates.updateSource(conn);
            Updates.updateDays(conn);
            Updates.updateCuisine(conn);
            Updates.updateMeal(conn);
            Updates.updateCategory(conn);
            Updates.updateSeason(conn);
            Updates.updateUnits(conn);
            Updates.updateIngredients(conn);
        }
Esempio n. 2
0
        // Add store button
        private void button4_Click(object sender, EventArgs e)
        {
            foreach (string store in Updates.getStores())
            {
                if (store == comboBox2.Text)
                {
                    MessageBox.Show("This store is already in the list");
                    return;
                }
            }
            string theCmd = "INSERT INTO Source (name) VALUES (\'" + comboBox2.Text + "\');";

            cmd = new MySqlCommand(theCmd, conn);
            cmd.ExecuteNonQuery();
            Updates.updateSource(conn);
            MessageBox.Show("This store is added to the list");
        }