Пример #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ac                  = AdvertisementController.getInstance();
     id.Content          = oldAds.AdvertisementID;
     nameBox.Text        = oldAds.AdvertisementName;
     descriptionBox.Text = oldAds.AdvertisementDescription;
 }
        private void load()
        {
            txtName.Text = "Good to see you back, " + employee.Name + "!";


            viewAdvertisement.ItemsSource = AdvertisementController.getInstance().getAll();
            viewPers.ItemsSource          = getPersList();
            viewPurchase.ItemsSource      = getPurchaseList();
            viewFund.ItemsSource          = getFundList();
        }
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);

            AdvertisementController.getInstance().viewUpdate(id).Show();
            load();
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtTitle.Text == "" || txtDescription.Text == "")
            {
                MessageBox.Show("Invalid input!");
                return;
            }

            AdvertisementController.getInstance().add(txtTitle.Text, txtDescription.Text);
            MessageBox.Show("Success add new advertisement!");

            reset();
            load();
        }
Пример #5
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (txtTitle.Text == "" || txtDesc.Text == "")
            {
                MessageBox.Show("Invalid input!");
                txtTitle.Clear();
                txtDesc.Clear();
                return;
            }

            if (AdvertisementController.getInstance().update(id, txtTitle.Text, txtDesc.Text))
            {
                MessageBox.Show("Success update the data!");
            }

            else
            {
                MessageBox.Show("The data is no longer active! Error updating data");
            }

            Close();
        }
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);

            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                if (AdvertisementController.getInstance().remove(id))
                {
                    MessageBox.Show("Success remove the data!");
                }

                else
                {
                    MessageBox.Show("Only active data can be removed!");
                }
            }

            load();
        }
Пример #7
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ac         = AdvertisementController.getInstance();
     id.Content = ac.getLastIndex() + 1;
 }
Пример #8
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ac = AdvertisementController.getInstance();
     refreshTable();
 }