示例#1
0
        //update contract
        private void update_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (errorMessages.Any()) //errorMessages.Count > 0
                {
                    string err = "Exception:";
                    foreach (var item in errorMessages)
                    {
                        err += "\n" + item;
                    }

                    MessageBox.Show(err);
                    return;
                }
                else
                {
                    bl.reContract(contract);
                    MessageBox.Show(contract.ToString(), "successfully update!", MessageBoxButton.OK, MessageBoxImage.Information);
                    refreshData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void UpdateContractButton_Click(object sender, RoutedEventArgs e)
 {
     BL.FactoryBL.getBL().UpdateContract(contract);
     MessageBox.Show(contract.ToString());
     contract    = new BE.Contract();
     DataContext = contract;
     this.Close();
 }
 private void DeleteContract_Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (contract != null)
         {
             bl.deleteContract(contract);
             MessageBox.Show(contract.ToString());
             refreshData();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#4
0
 public void idCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         int id = (int)contractIDComboBox.SelectedValue;
         contract = this.bl.GetContractByID(id);
         MessageBox.Show(contract.ToString());
     }
     catch (FormatException)
     {
         MessageBox.Show("Incorrect input");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }