Exemplo n.º 1
0
        private static void AddOfferConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            DataModels    database     = DataModels.GetInstance();
            Button        button       = (Button)sender;
            List <object> data         = (List <object>)button.Tag;
            ComboBox      websiteCombo = (ComboBox)data[0];
            ComboBox      HotelCombo   = (ComboBox)data[1];
            ComboBox      RoomCombo    = (ComboBox)data[2];
            TextBox       priceText    = (TextBox)data[3];

            Website website = (Website)websiteCombo.SelectedItem;
            Room    room    = (Room)RoomCombo.SelectedItem;
            int     price   = int.Parse(priceText.Text);

            bool done = database.AddOffer(new Offer(website, room, price));

            if (done)
            {
                MessageBox.Show("Offer Added successfully !");
            }
            else
            {
                MessageBox.Show("Couldn't add offer");
            }
        }