private void btnSearch_Click(object sender, EventArgs e)
        {
            if (!VehicleUtility.isNRICValid(txbNRIC.Text))
            {
                MessageBox.Show(VehicleMessage.InvalidNRIC);
            }
            else
            {
                Customer c = rentvehiclecontrol.retrieveCustomerDetails(txbNRIC.Text.Trim());

                if (c != null)
                {
                    name.Text     = c.CustomerName;
                    telphone.Text = c.TelNum;
                    email.Text    = c.Email;
                }
                else
                {
                    MessageBox.Show("Your NRIC is not found, Enter your information ");
                    name.Enabled     = true;
                    telphone.Enabled = true;
                    email.Enabled    = true;
                }
            }
        }
예제 #2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (!VehicleUtility.isVehiclePlateValid(txbPlateNum.Text.Trim()))
     {
         MessageBox.Show(VehicleMessage.InvalidPlateNum);
         return;
     }
     enquiryControl.retrieveVehicle(txbPlateNum.Text.Trim());
 }
        public void insertCustomer()
        {
            try
            {
                if (VehicleUtility.isEmpty(name.Text))
                {
                    MessageBox.Show(VehicleMessage.EmptyName);
                    return;
                }

                if (!VehicleUtility.isNRICValid(txbNRIC.Text))
                {
                    MessageBox.Show(VehicleMessage.InvalidNRIC);
                    return;
                }

                if (!VehicleUtility.isEmailValid(email.Text))
                {
                    MessageBox.Show(VehicleMessage.InvalidEmaildAddress);
                }

                Customer customer = new Customer();
                customer.IDNumber     = txbNRIC.Text;
                customer.CustomerName = name.Text;
                customer.TelNum       = telphone.Text;
                customer.Email        = email.Text;


                rentvehiclecontrol.createCustomer(customer);
                MessageBox.Show(VehicleMessage.CustomerRecordSuccessful);
            }
            catch (Exception excep)
            {
                Console.WriteLine("Exception !!!");
                Console.WriteLine(excep.Message);
                Console.WriteLine(excep.StackTrace);
                MessageBox.Show(VehicleMessage.GeneralErrorMsg);
            }
        }
예제 #4
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (btnEnter.Enabled == true)
     {
         if (!VehicleUtility.isNRICValid(txbNRIC.Text))
         {
             MessageBox.Show(VehicleMessage.InvalidNRIC);
             return;
         }
         try
         {
             record.RentingCustomer = rentvehiclecontrol.RetrieveCustomer(txbNRIC.Text.Trim());
             txbCusName.Text        = record.RentingCustomer.Name;
             txbPhone.Text          = record.RentingCustomer.TelNum;
             txbEmail.Text          = record.RentingCustomer.Email;
         }
         catch (VehicleException)
         {
             MessageBox.Show(VehicleMessage.CustomerRecordNotFound);
             return;
         }
     }
 }