コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string item = textBox1.Text;
            int quantity = (int)numericUpDown1.Value;

            ConnectToDB conn = new ConnectToDB();
            conn.AddItemToWarehouse(item, quantity);
        }
コード例 #2
0
        public bool Make()
        {
            ConnectToDB conn = new ConnectToDB();
            bool liq = false;
            if (ingredients[0] != "")
                liq = conn.RemoveItemFromWarehouse(ingredients[0], 1);
            bool dec = false;
            if (ingredients[2] != "")
                dec = conn.RemoveItemFromWarehouse(ingredients[2], 1);

            if (liq && dec)
                return true;
            else
            {
                if (liq)
                    conn.AddItemToWarehouse(ingredients[0], 1);
                else if (dec)
                    conn.AddItemToWarehouse(ingredients[2], 1);
                return false;
            }
        }