예제 #1
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (advertWindow.SelectedIndex > -1)
     {
         AdvertRepo.DeleteAd(Convert.ToInt32(
                                 AdvertTable.Rows[advertWindow.SelectedIndex]["AdID"]));
     }
     PopulateDataGrid();
 }
예제 #2
0
 private void btnCreateAd_Click(object sender, RoutedEventArgs e)
 {
     if (AdID == 0)
     {
         AdvertRepo.NewAd(txtNewTitle.Text, txtNewAdText.Text, float.Parse(txtPrice.Text),
                          Convert.ToInt32(cboCategoriesBox.SelectedValue), currentUserID);
     }
     else
     {
         AdvertRepo.DeleteAd(AdID);
         AdvertRepo.NewAd(txtNewTitle.Text, txtNewAdText.Text, float.Parse(txtPrice.Text),
                          Convert.ToInt32(cboCategoriesBox.SelectedValue), currentUserID);
     }
     ((MainWindow)Application.Current.MainWindow).PopulateDataGrid();
     this.Close();
 }