private void menuItemClaimForms_Click(object sender, System.EventArgs e) { if(!PrefC.UsingAtoZfolder){ MsgBox.Show(this,"Claim Forms feature is unavailable when data path A to Z folder is disabled."); return; } if(!Security.IsAuthorized(Permissions.Setup)){ return; } FormClaimForms FormCF=new FormClaimForms(); FormCF.ShowDialog(); SecurityLogs.MakeLogEntry(Permissions.Setup,0,"Claim Forms"); }
private void butDownloadClaimform_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; //Application.DoEvents(); string remoteUri = textWebsitePath.Text + textRegClaimform.Text + "/"; WebRequest wr; WebResponse webResp; //int fileSize; //copy image file------------------------------------------------------------------------------- if (BackgroundImg != "") { myStringWebResource = remoteUri + BackgroundImg; WriteToFile = PrefB.GetString("DocPath") + BackgroundImg; if (File.Exists(WriteToFile)) { File.Delete(WriteToFile); } wr = WebRequest.Create(myStringWebResource); int fileSize; try{ webResp = wr.GetResponse(); fileSize = (int)webResp.ContentLength / 1024; } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show("Error downloading " + BackgroundImg + ". " + ex.Message); return; //fileSize=0; } if (fileSize > 0) { //start the thread that will perform the download Thread workerThread = new Thread(new ThreadStart(InstanceMethod)); workerThread.Start(); //display the progress dialog to the user: FormP = new FormProgress(); FormP.MaxVal = (double)fileSize / 1024; FormP.NumberMultiplication = 100; FormP.DisplayText = "?currentVal MB of ?maxVal MB copied"; FormP.NumberFormat = "F"; FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { workerThread.Abort(); Cursor = Cursors.Default; return; } MsgBox.Show(this, "Image file downloaded successfully."); } } Cursor = Cursors.WaitCursor; //have to do this again for some reason. //Import ClaimForm.xml---------------------------------------------------------------------------------- myStringWebResource = remoteUri + "ClaimForm.xml"; WriteToFile = PrefB.GetString("DocPath") + "ClaimForm.xml"; if (File.Exists(WriteToFile)) { File.Delete(WriteToFile); } try{ InstanceMethod(); } catch { } int rowsAffected; if (File.Exists(WriteToFile)) { int newclaimformnum = 0; try{ newclaimformnum = FormClaimForms.ImportForm(WriteToFile, true); } catch (ApplicationException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); return; } finally{ File.Delete(WriteToFile); } if (newclaimformnum != 0) { Prefs.UpdateInt("DefaultClaimForm", newclaimformnum); } //switch all insplans over to new claimform ClaimForm oldform = null; for (int i = 0; i < ClaimForms.ListLong.Length; i++) { if (ClaimForms.ListLong[i].UniqueID == OldClaimFormID) { oldform = ClaimForms.ListLong[i]; } } if (oldform != null) { rowsAffected = InsPlans.ConvertToNewClaimform(oldform.ClaimFormNum, newclaimformnum); MessageBox.Show("Number of insurance plans changed to new form: " + rowsAffected.ToString()); } DataValid.SetInvalid(InvalidTypes.ClaimForms | InvalidTypes.Prefs); } //Import ProcCodes.xml------------------------------------------------------------------------------------ myStringWebResource = remoteUri + "ProcCodes.xml"; WriteToFile = PrefB.GetString("DocPath") + "ProcCodes.xml"; if (File.Exists(WriteToFile)) { File.Delete(WriteToFile); } try { InstanceMethod(); } catch { } if (File.Exists(WriteToFile)) { //move T codes over to a new "Obsolete" category which is hidden ProcedureCodes.TcodesMove(); rowsAffected = 0; try { rowsAffected = FormProcCodes.ImportProcCodes(WriteToFile, false); } catch (ApplicationException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); return; } finally { File.Delete(WriteToFile); } ProcedureCodes.Refresh(); //? MessageBox.Show("Procedure codes inserted: " + rowsAffected.ToString()); //Change all procbuttons and autocodes from T to D. ProcedureCodes.TcodesAlter(); DataValid.SetInvalid(InvalidTypes.AutoCodes | InvalidTypes.Defs | InvalidTypes.ProcCodes | InvalidTypes.ProcButtons); } MsgBox.Show(this, "Done"); Cursor = Cursors.Default; }