Esempio n. 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         IserviceHandler = new ServiceHandler();
         if (validateAddress() && validateContactDetails() && validateClientDetails())
         {
             ClientDetail clientDetails = new ClientDetail
             {
                 IdNumber = long.Parse(txtIdNumber.Text),
                 Name     = txtName.Text,
                 Gender   = cmbGender.Text,
                 Surname  = txtSurname.Text,
                 Id       = Guid.NewGuid()
             };
             var saved = IserviceHandler.SaveClientData(clientDetails);
             if (saved)
             {
                 _ClientId = clientDetails.Id;
                 SaveAddressDetails(clientDetails.Id);
                 SaveContactDetails(clientDetails.Id);
             }
         }
         else
         {
             MessageBox.Show("All fields are required!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         _rttLogger.WriteToLog(LogType.Fatal, ex.Message);
         throw;
     }
 }