Esempio n. 1
0
        private void editBurritoBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows.Count > 0)
                {
                    bDialog.clearState(curInventory);

                    //keep track of the burrito we are modifying
                    int     selectedIndex = Int32.Parse(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
                    Burrito tBurrito      = newOrder.burritos[selectedIndex];
                    bDialog.setBurrito(tBurrito);

                    if (bDialog.ShowDialog() == DialogResult.OK && oManager.updateBurritoInOrder(newOrder, bDialog.getNewBurrito()))
                    {
                        dataGridView1.Rows[selectedIndex].Cells[1].Value = bDialog.getBurritoType();
                        dataGridView1.Rows[selectedIndex].Cells[2].Value = bDialog.getNewBurrito().Price;

                        //remove ingredients from Inventory
                        iManager.removeFromInventory(curInventory, tBurrito);
                        iManager.removeFromInventory(curInventory, bDialog.getNewBurrito());
                        iManager.updateInventory(curInventory);

                        //update cost
                        updateTotalCost();
                    }
                }
            }
            catch (Exception err)
            {
                dLog.Error("Exception in editBurritoBtn_Click: " + err.Message);
            }
        }