Exemplo n.º 1
0
 protected void CreateUser_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         try
         {
             TravelAgencyService service = new TravelAgencyService();
             try
             {
                 if (FirmPanel.Visible)
                 {
                     CreateUser(FirmData.EmailString, FirmData.PasswordString, service, () =>
                     {
                         service.CreateFirm(FirmData.Firm, FirmData.GetAddressEntity(service), FirmData.EmailString);
                     });
                 }
                 else if (PersonPanel.Visible)
                 {
                     CreateUser(PersonData.EmailString, PersonData.PasswordString, service, () =>
                     {
                         service.CreatePerson(PersonData.Person, PersonData.GetAddressEntity(service), PersonData.EmailString);
                     });
                 }
             }
             finally
             {
                 service.Dispose();
             }
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
         }
     }
 }
Exemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         service.Dispose();
     }
     base.Dispose(disposing);
 }
 public override void Dispose()
 {
     base.Dispose();
     service.Dispose();
 }
Exemplo n.º 4
0
 public static void ClassCleanup()
 {
     service.Dispose();
 }