private void butAdd_Click(object sender, EventArgs e) { FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } //Make sure each selected sheet contains FName, LName, and Birthdate. for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++) //There will always only be one { if (!WebFormL.VerifyRequiredFieldsPresent(FormS.SelectedSheetDefs[i])) { return; } } 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; } for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++) //There will always only be one { WebFormL.LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]); wh.Timeout = 300000; //for slow connections more timeout is provided. The default is 100 seconds i.e 100000 wh.UpLoadSheetDef(RegistrationKey, FormS.SelectedSheetDefs[i]); } FillGrid(); Cursor = Cursors.Default; }
private void butAdd_Click(object sender, EventArgs e) { FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } //Make sure each selected sheet contains FName, LName, and Birthdate. foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs) //There will always only be one { if (!WebFormL.VerifyRequiredFieldsPresent(selectedSheetDef)) { return; } } Cursor = Cursors.WaitCursor; foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs) { WebFormL.LoadImagesToSheetDef(selectedSheetDef); WebFormL.TryAddOrUpdateSheetDef(this, selectedSheetDef, true); } FillGrid(); Cursor = Cursors.Default; }
private void butUpdate_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length < 1) { MsgBox.Show(this, "Please select an item from the grid first."); return; } if (gridMain.SelectedIndices.Length > 1) { MsgBox.Show(this, "Please select one web form at a time."); return; } webforms_sheetdef wf_sheetDef = (webforms_sheetdef)gridMain.Rows[gridMain.SelectedIndices[0]].Tag; SheetDef sheetDef = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum); if (sheetDef == null) //This web form has never had a SheetDefNum assigned or the sheet has been deleted. { MsgBox.Show(this, "This Web Form is not linked to a valid Sheet. Please select the correct Sheet that this Web Form should be linked to."); FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0) { return; } sheetDef = FormS.SelectedSheetDefs.FirstOrDefault(); } else //sheetDef not null { SheetDefs.GetFieldsAndParameters(sheetDef); } if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef)) { return; } 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; } WebFormL.LoadImagesToSheetDef(sheetDef); wh.UpdateSheetDef(RegistrationKey, wf_sheetDef.WebSheetDefID, sheetDef); FillGrid(); Cursor = Cursors.Default; }
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; }
private void butUpdate_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length < 1) { MsgBox.Show(this, "Please select an item from the grid first."); return; } if (gridMain.SelectedIndices.Length > 1) { MsgBox.Show(this, "Please select one web form at a time."); return; } WebForms_SheetDef wf_sheetDef = gridMain.SelectedTag <WebForms_SheetDef>(); SheetDef sheetDef = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum); if (sheetDef == null) //This web form has never had a SheetDefNum assigned or the sheet has been deleted. { MsgBox.Show(this, "This Web Form is not linked to a valid Sheet. Please select the correct Sheet that this Web Form should be linked to."); FormSheetPicker FormS = new FormSheetPicker(); FormS.SheetType = SheetTypeEnum.PatientForm; FormS.HideKioskButton = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0) { return; } sheetDef = FormS.SelectedSheetDefs.FirstOrDefault(); } else //sheetDef not null { SheetDefs.GetFieldsAndParameters(sheetDef); } if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef)) { return; } Cursor = Cursors.WaitCursor; WebFormL.LoadImagesToSheetDef(sheetDef); WebFormL.TryAddOrUpdateSheetDef(this, sheetDef, false, new List <WebForms_SheetDef> { wf_sheetDef }); FillGrid(); Cursor = Cursors.Default; }
/// <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); }
private void butRetrieve_Click(object sender, System.EventArgs e) { if (textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateEnd.errorProvider1.GetError(textDateEnd) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } Cursor = Cursors.WaitCursor; //this.backgroundWorker1.RunWorkerAsync(); call this method if theread is to be used later. string strMsg = WebFormL.RetrieveAndSaveData(_webFormPref.CultureName); // if a thread is used this method will go into backgroundWorker1_DoWork if (!string.IsNullOrEmpty(strMsg)) { gridMain.EndUpdate(); MsgBox.Show(strMsg); } FillGrid(); // if a thread is used this method will go into backgroundWorker1_RunWorkerCompleted Cursor = Cursors.Default; }
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; }