コード例 #1
0
 private void btnCategoryAdd_Click(object sender, EventArgs e)
 {
     if (txtSupplierName.Text != "")
     {
         if (SupplierRepo.checkIfSupplierExists(txtSupplierName.Text))
         {
             MessageBox.Show("Supplier already exists.");
         }
         else
         {
             double num;
             bool   b = double.TryParse(txtContactNumber.Text, out num);
             if (b)
             {
                 SupplierRepo.insert(Guid.NewGuid(), txtSupplierName.Text, txtAddress.Text, double.Parse(txtContactNumber.Text));
                 fillListView();
                 clearAll();
                 MessageBox.Show("Supplier has been added.");
             }
             else
             {
                 MessageBox.Show("Invalid contact number");
             }
         }
     }
     else
     {
         MessageBox.Show("Supplier name must not be empty");
     }
 }