Ejemplo n.º 1
0
 private void FetchValuesFromWebServer()
 {
     try {
         String WebHostSynchServerURL = PrefC.GetString(PrefName.WebHostSynchServerURL);
         textboxWebHostAddress.Text = WebHostSynchServerURL;
         butSave.Enabled            = false;
         if ((WebHostSynchServerURL == WebFormL.SynchUrlStaging) || (WebHostSynchServerURL == WebFormL.SynchUrlDev))
         {
             WebFormL.IgnoreCertificateErrors();
         }
         Cursor = Cursors.WaitCursor;
         if (!TestWebServiceExists())
         {
             Cursor = Cursors.Default;
             MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
             return;
         }
         DentalOfficeID = wh.GetDentalOfficeID(RegistrationKey);
         if (wh.GetDentalOfficeID(RegistrationKey) == 0)
         {
             Cursor = Cursors.Default;
             MsgBox.Show(this, "Registration key provided by the dental office is incorrect");
             return;
         }
         OpenDental.WebSheets.webforms_preference PrefObj = wh.GetPreferences(RegistrationKey);
         if (PrefObj == null)
         {
             Cursor = Cursors.Default;
             MsgBox.Show(this, "There has been an error retrieving values from the server");
         }
         butWebformBorderColor.BackColor = Color.FromArgb(PrefObj.ColorBorder);
         SheetDefAddress = wh.GetSheetDefAddress(RegistrationKey);
         //dennis: the below if statement is for backward compatibility only April 14 2011 and can be removed later.
         if (String.IsNullOrEmpty(PrefObj.CultureName))
         {
             PrefObj.CultureName = System.Globalization.CultureInfo.CurrentCulture.Name;
             wh.SetPreferencesV2(RegistrationKey, PrefObj);
         }
     }
     catch (Exception ex) {
         Cursor = Cursors.Default;
         MessageBox.Show(ex.Message);
     }
     FillGrid();            //Also gets sheet def list from server
     Cursor = Cursors.Default;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// An empty method to test if the webservice is up and running. This was made with the intention of testing the correctness of the webservice URL. If an incorrect webservice URL is used in a background thread the exception cannot be handled easily to a point where even a correct URL cannot be keyed in by the user. Because an exception in a background thread closes the Form which spawned it.
 /// </summary>
 /// <returns></returns>
 private bool TestWebServiceExists()
 {
     try {
         wh.Url = textboxWebHostAddress.Text;
         //if(textboxWebHostAddress.Text.Contains("192.168.0.196") || textboxWebHostAddress.Text.Contains("localhost")) {
         if (textboxWebHostAddress.Text.Contains("10.10.1.196") || textboxWebHostAddress.Text.Contains("localhost"))
         {
             WebFormL.IgnoreCertificateErrors();                    // done so that TestWebServiceExists() does not thow an error.
         }
         if (wh.ServiceExists())
         {
             return(true);
         }
     }
     catch {           //(Exception ex) {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 private void FetchValuesFromWebServer()
 {
     try {
         String WebHostSynchServerURL = PrefC.GetString(PrefName.WebHostSynchServerURL);
         textboxWebHostAddress.Text = WebHostSynchServerURL;
         butSave.Enabled            = false;
         if ((WebHostSynchServerURL == WebFormL.SynchUrlStaging) || (WebHostSynchServerURL == WebFormL.SynchUrlDev))
         {
             WebFormL.IgnoreCertificateErrors();
         }
         Cursor          = Cursors.WaitCursor;
         _dentalOfficeID = WebUtils.GetDentalOfficeID();
         if (_dentalOfficeID == 0)
         {
             Cursor = Cursors.Default;
             MsgBox.Show(this, "Either the registration key provided by the dental office is incorrect or the Host Server Address cannot be found.");
             return;
         }
         if (WebForms_Preferences.TryGetPreference(out _webFormPref))
         {
             butWebformBorderColor.BackColor = _webFormPref.ColorBorder;
             _sheetDefAddress = WebUtils.GetSheetDefAddress();
             checkDisableWebFormSignatures.Checked = _webFormPref.DisableSignatures;
             if (string.IsNullOrEmpty(_webFormPref.CultureName))                    //Just in case.
             {
                 _webFormPref.CultureName = System.Globalization.CultureInfo.CurrentCulture.Name;
                 WebForms_Preferences.SetPreferences(_webFormPref);
             }
             _webFormPrefOld = _webFormPref.Copy();
         }
     }
     catch (Exception ex) {
         Cursor = Cursors.Default;
         MessageBox.Show(ex.Message);
     }
     FillGrid();            //Also gets sheet def list from server
     Cursor = Cursors.Default;
 }