Ejemplo n.º 1
0
 protected void OnCheckConnection(object sender, EventArgs e)
 {
     try
     {
         nameValidator.Enabled = false;
         UnbindFormData();
     }
     finally
     {
         nameValidator.Enabled = true;
     }
     if (!this.IsValid)
     {
         return;
     }
     try
     {
         Exception exception = _dataItemService.CheckConnection(_dataItem.ProviderType, _dataItem.ConnectionString);
         if (exception != null)
         {
             divPageError.Visible   = true;
             divPageError.InnerText = UIUtility.ParseException(exception);
         }
         else
         {
             divPageNote.Visible   = true;
             divPageNote.InnerText = "Database connection attempt was successful!";
         }
     }
     catch (Exception ex)
     {
         LOG.Error(ex.Message, ex);
         divPageError.Visible   = true;
         divPageError.InnerText = UIUtility.ParseException(ex);
     }
 }