Exemple #1
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(GameIdTextBox.Text))
            {
                MyDialog.Show("Game ID is empty!",
                              "You need to fill Game ID text box");
            }
            else
            {
                Game editedGame = new Game();
                editedGame.GameId      = Convert.ToInt32(GameIdTextBox.Text);
                editedGame.Title       = TitleTextBox.Text;
                editedGame.Genre       = GenreTextBox.Text;
                editedGame.Publisher   = ((Publisher)PublisherComboBox.SelectedItem).Name;
                editedGame.PublisherId = ((Publisher)PublisherComboBox.SelectedItem).PublisherId;
                editedGame.Platform    = PlatformComboBox.SelectedItem.ToString();
                editedGame.Price       = Convert.ToInt32(PriceTextBox.Text);
                editedGame.Quantity    = Convert.ToInt32(QuantityTextBox.Text);

                Game.UpdateAllProperties(editedGame);

                MyDialog.Show(editedGame.Title + " has been edited");
                GameIdTextBox.Text = "";
                TitleTextBox.Text  = "";
                GenreTextBox.Text  = "";
                PublisherComboBox.SelectedIndex = -1;
                PlatformComboBox.SelectedIndex  = -1;
                PriceTextBox.Text    = "";
                QuantityTextBox.Text = "";

                this.games           = Game.SelectAll();
                DataGrid.ItemsSource = games;
            }
        }
Exemple #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(PublisherIdTextBox.Text))
            {
                MyDialog.Show("Publisher ID is empty!",
                              "You need to fill Publisher ID text box");
            }
            else
            {
                int    id      = Convert.ToInt32(PublisherIdTextBox.Text);
                string name    = NameTextBox.Text;
                string country = CountryTextBox.Text;

                Publisher editedPublisher = new Publisher(id, name, country);

                Publisher.UpdateAllProperty(editedPublisher);

                MyDialog.Show(editedPublisher.Name + " has been edited");
                PublisherIdTextBox.Text = "";
                NameTextBox.Text        = "";
                CountryTextBox.Text     = "";

                this.publishers      = Publisher.SelectAll();
                DataGrid.ItemsSource = publishers;
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     if (theDialog.Visible)
     {
         theDialog.BringToFront();
     }
     else
     {
         theDialog.Show();
     }
 }
Exemple #4
0
    private void Gv_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
    {
        //FragmentTransaction ft = FragmentManager.BeginTransaction();
        //fragment_Info f1 = new fragment_Info();
        //f1.Show(ft, "ok");
        int                 position    = e.Position;
        Student             student     = listStudents[position];
        FragmentTransaction transcation = FragmentManager.BeginTransaction();
        MyDialog            signup      = new MyDialog(student);

        signup.Show(transcation, "Dialog Fragment");
    }
Exemple #5
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(GameIdTextBox.Text))
     {
         MyDialog.Show("Game ID is empty!",
                       "You need to fill Game ID text box");
     }
     else
     {
         int gameId = Convert.ToInt32(GameIdTextBox.Text);
         Game.Delete(gameId);
         MyDialog.Show("Publisher ID = " + gameId + " has been deleted");
         this.games           = Game.SelectAll();
         DataGrid.ItemsSource = games;
     }
 }
Exemple #6
0
        private void OrderButton_Click(object sender, RoutedEventArgs e)
        {
            if (newOrder.OrderItems.Count < 1)
            {
                MyDialog.Show("Order Item is empty!",
                              "Please add at least one game item.");
            }
            else if (string.IsNullOrWhiteSpace(CashTextBox.Text))
            {
                MyDialog.Show("Cash is empty!",
                              "Please input the cash.");
            }
            else
            {
                newOrder.Cash    = Convert.ToInt32(CashTextBox.Text);
                newOrder.OrderAt = DateTime.Now;

                if (newOrder.Cash < newOrder.TotalPrice)
                {
                    MyDialog.Show("Insufficient cash");
                    return;
                }

                newOrder.CountChange();

                Order.Insert(newOrder);

                int nextOrderItemId = this.initialOrderItemId;

                foreach (var orderItem in newOrder.OrderItems)
                {
                    OrderItem.Insert(nextOrderItemId, newOrder.OrderId, orderItem.GameId);
                    nextOrderItemId++;
                }

                MyDialog.ShowTo("Order is sucessfully added",
                                "Cash : Rp " + newOrder.Cash +
                                "\nTotal : Rp " + newOrder.TotalPrice +
                                "\nChange : Rp " + newOrder.Change);
            }
        }