Example #1
0
 private bool IsValidData()
 {
     return(WPFValidator.IsPresent(txtInventoryID) &&
            WPFValidator.IsInteger(txtInventoryID) &&
            WPFValidator.IsPresent(txtManufacturer) &&
            WPFValidator.IsPresent(txtModelName) &&
            WPFValidator.IsPresent(txtModelYear) &&
            WPFValidator.IsInteger(txtModelYear) &&
            WPFValidator.IsPresent(txtVehicleID) &&
            WPFValidator.IsPresent(txtCostValue) &&
            WPFValidator.IsDecimal(txtCostValue) &&
            WPFValidator.IsDecimal(txtCostValue, 0m));
 }
Example #2
0
 private void btnInsert_Click(object sender, RoutedEventArgs e)
 {
     if (WPFValidator.IsPresent(txtNumber) && WPFValidator.IsPresent(txtName) && WPFValidator.IsSelected(cboInventoryID))
     {
         string   number      = txtNumber.Text;
         string   name        = txtName.Text;
         int      inventoryid = Convert.ToInt32(cboInventoryID.SelectedItem);
         Customer c           = new Customer(number, name, inventoryid);
         if (CustomerDB.InsertCustomer(c))
         {
             txtMessage.Text = "The above customer was entered into the database.";
         }
         else
         {
             txtMessage.Text = "The above customer was not entered into the database.";
         }
     }
 }