Ejemplo n.º 1
0
        public void UpdateAllItems()
        {
            try
            {
                DetermineItemStatus();

                if (LBTitle.Text == "Bicycle")
                {
                    if (LBID.Text != null)
                    {
                        TBikeDAL      MyDAL = new TBikeDAL();
                        ConfirmWindow con   = new ConfirmWindow(ImageType.Question, "Confirmation", "Are you sure to make these changes?", "Yes, Change This", "No, Don't Change");
                        con.ShowDialog();
                        if (con.Confirmed)
                        {
                            MyDAL.UpdateBicycleTable(LBID.Text, TBName.Text, TBType.Text, Convert.ToInt32(TBQuantity.Text), ItemStatus, Convert.ToDouble(TBPrice.Text), TBColor.Text, TLUsername.Text);
                            PopulateBikeDataTable();
                            PopWindow pop = new PopWindow(ImageType.Information, "Success!", "Changes Made, Successfully!", "Ok");
                            pop.ShowDialog();
                        }
                    }
                }
                else if (LBTitle.Text == "Snacks")
                {
                    TBikeDAL      MyDAL = new TBikeDAL();
                    ConfirmWindow con   = new ConfirmWindow(ImageType.Question, "Confirmation", "Are you sure to make these changes?", "Yes, Change This", "No, Don't Change");
                    con.ShowDialog();
                    if (con.Confirmed)
                    {
                        MyDAL.UpdateSnackTable(LBID.Text, TBName.Text, TBType.Text, Convert.ToDouble(TBPrice.Text), Convert.ToInt32(TBColor.Text), ItemStatus, TLUsername.Text);
                        PopulateSnackDataTable();
                        PopWindow pop = new PopWindow(ImageType.Information, "Success!", "Changes Made, Successfully!", "Ok");
                        pop.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                PopWindow pop = new PopWindow(ImageType.Error, "Error", ex.Message, "I will Fix this");
                pop.ShowDialog();
            }
        }