コード例 #1
0
        private void butPreview_Click(object sender, EventArgs e)
        {
            //A couple options here
            //Download the file and run the explorer windows process to show the temporary file
            if (!gridMain.Rows[gridMain.GetSelectedIndex()].Cells[0].Text.Contains("."))             //File path doesn't contain an extension and thus is a subfolder.
            {
                return;
            }
            FormProgress FormP = new FormProgress();

            FormP.DisplayText          = "Downloading...";
            FormP.NumberFormat         = "F";
            FormP.NumberMultiplication = 1;
            FormP.MaxVal = 100;          //Doesn't matter what this value is as long as it is greater than 0
            FormP.TickMS = 1000;
            OpenDentalCloud.Core.TaskStateDownload state = CloudStorage.DownloadAsync(textPath.Text
                                                                                      , Path.GetFileName(gridMain.Rows[gridMain.GetSelectedIndex()].Cells[0].Text)
                                                                                      , new OpenDentalCloud.ProgressHandler(FormP.OnProgress));
            if (FormP.ShowDialog() == DialogResult.Cancel)
            {
                state.DoCancel = true;
                return;
            }
            string tempFile = ODFileUtils.CreateRandomFile(Path.GetTempPath(), Path.GetExtension(gridMain.Rows[gridMain.GetSelectedIndex()].Cells[0].Text));

            File.WriteAllBytes(tempFile, state.FileContent);
            System.Diagnostics.Process.Start(tempFile);
        }
コード例 #2
0
 private void EcwOldTimerCallbackSendFunction(Object stateInfo)
 {
     //does not happen for standalone
     if (_ecwOldIsSending)             //if there is a thread that is still sending, return
     {
         return;
     }
     try {
         _ecwOldIsSending = true;
         if (IsVerboseLogging)
         {
             EventLog.WriteEntry("GetOnePending Start");
         }
         List <HL7Msg> list = HL7Msgs.GetOnePending();
         if (IsVerboseLogging)
         {
             EventLog.WriteEntry("GetOnePending Finished");
         }
         string filename;
         for (int i = 0; i < list.Count; i++)           //Right now, there will only be 0 or 1 item in the list.
         {
             if (list[i].AptNum == 0)
             {
                 filename = ODFileUtils.CreateRandomFile(ecwOldHl7FolderIn, ".txt");
             }
             else
             {
                 filename = Path.Combine(ecwOldHl7FolderIn, list[i].AptNum.ToString() + ".txt");
             }
             //EventLog.WriteEntry("Attempting to create file: "+filename);
             File.WriteAllText(filename, list[i].MsgText);
             list[i].HL7Status = HL7MessageStatus.OutSent;
             HL7Msgs.Update(list[i]);                    //set the status to sent.
         }
         if (_ecwOldDateTimeOldMsgsDeleted.Date < DateTime.Now.Date)
         {
             if (IsVerboseLogging)
             {
                 EventLog.WriteEntry("DeleteOldMsgText Starting");
             }
             _ecwOldDateTimeOldMsgsDeleted = DateTime.Now;
             HL7Msgs.DeleteOldMsgText();                    //this function deletes if DateTStamp is less than CURDATE-INTERVAL 4 MONTH.  That means it will delete message text only once a day, not time based.
             if (IsVerboseLogging)
             {
                 EventLog.WriteEntry("DeleteOldMsgText Finished");
             }
         }
     }
     catch (Exception ex) {
         EventLog.WriteEntry("OpenDentHL7 error when sending HL7 message: " + ex.Message, EventLogEntryType.Warning);             //Warning because the service will spawn a new thread in 1.8 seconds
     }
     finally {
         _ecwOldIsSending = false;
     }
 }
コード例 #3
0
ファイル: ServiceHL7.cs プロジェクト: steev90/opendental
        private void TimerCallbackSendFiles(Object stateInfo)
        {
            List <HL7Msg> list = HL7Msgs.GetOnePending();
            string        filename;

            for (int i = 0; i < list.Count; i++)       //Right now, there will only be 0 or 1 item in the list.
            {
                filename = ODFileUtils.CreateRandomFile(hl7FolderOut, ".txt");
                File.WriteAllText(filename, list[i].MsgText);
                list[i].HL7Status = HL7MessageStatus.OutSent;
                HL7Msgs.Update(list[i]);                //set the status to sent.
                HL7Msgs.DeleteOldMsgText();             //This is inside the loop so that it happens less frequently.  To clean up incoming messages, we may move this someday.
            }
        }
コード例 #4
0
		private void butShowImages_Click(object sender,EventArgs e) {
			try {
				//We need a folder in order to place the images beside the html file in order for the relative image paths to work correctly.
				string htmlFolderPath=ODFileUtils.CreateRandomFolder(PrefC.GetTempFolderPath());//Throws exceptions.
				string filePathHtml=ODFileUtils.CreateRandomFile(htmlFolderPath,".html");
				string html=webBrowser.DocumentText;
				List<MimeEntity> listMimeEntries=new List<MimeEntity>();
				listMimeEntries.AddRange(_listAppParts);
				listMimeEntries.AddRange(_listImageParts);
				html=ParseAndSaveAttachement(htmlFolderPath,html,listMimeEntries);
				File.WriteAllText(filePathHtml,html);
				_isLoading=true;
				webBrowser.Navigate(filePathHtml);
				butShowImages.Visible=false;
			}
			catch(Exception ex) {
				MessageBox.Show(ex.ToString());
			}
		}
コード例 #5
0
ファイル: ServiceHL7.cs プロジェクト: nampn/ODental
        private void TimerCallbackSendFunction(Object stateInfo)
        {
            //does not happen for standalone
            List <HL7Msg> list = HL7Msgs.GetOnePending();
            string        filename;

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].AptNum == 0)
                {
                    filename = ODFileUtils.CreateRandomFile(hl7FolderIn, ".txt");
                }
                else
                {
                    filename = Path.Combine(hl7FolderIn, list[i].AptNum.ToString() + ".txt");
                }
                //EventLog.WriteEntry("Attempting to create file: "+filename);
                File.WriteAllText(filename, list[i].MsgText);
                list[i].HL7Status = HL7MessageStatus.OutSent;
                HL7Msgs.Update(list[i]);                //set the status to sent.
            }
        }
コード例 #6
0
 private void butShowImages_Click(object sender, EventArgs e)
 {
     try {
         //We need a folder in order to place the images beside the html file in order for the relative image paths to work correctly.
         string htmlFolderPath = ODFileUtils.CreateRandomFolder(PrefC.GetTempFolderPath());              //Throws exceptions.
         string filePathHtml   = ODFileUtils.CreateRandomFile(htmlFolderPath, ".html");
         string html           = webBrowser.DocumentText;
         for (int i = 0; i < _listImageParts.Count; i++)
         {
             string contentId = EmailMessages.GetMimeImageContentId(_listImageParts[i]);
             string fileName  = EmailMessages.GetMimeImageFileName(_listImageParts[i]);
             html = html.Replace("cid:" + contentId, fileName);
             EmailMessages.SaveMimeImageToFile(_listImageParts[i], htmlFolderPath);
         }
         File.WriteAllText(filePathHtml, html);
         _isLoading = true;
         webBrowser.Navigate(filePathHtml);
         butShowImages.Visible = false;
     }
     catch (Exception ex) {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #7
0
        private void EcwOldTimerCallbackSendFunction(Object stateInfo)
        {
            //does not happen for standalone
            List <HL7Msg> list = HL7Msgs.GetOnePending();
            string        filename;

            for (int i = 0; i < list.Count; i++)       //Right now, there will only be 0 or 1 item in the list.
            {
                if (list[i].AptNum == 0)
                {
                    filename = ODFileUtils.CreateRandomFile(ecwOldHl7FolderIn, ".txt");
                }
                else
                {
                    filename = Path.Combine(ecwOldHl7FolderIn, list[i].AptNum.ToString() + ".txt");
                }
                //EventLog.WriteEntry("Attempting to create file: "+filename);
                File.WriteAllText(filename, list[i].MsgText);
                list[i].HL7Status = HL7MessageStatus.OutSent;
                HL7Msgs.Update(list[i]);                //set the status to sent.
                HL7Msgs.DeleteOldMsgText();             //This is inside the loop so that it happens less frequently.  To clean up incoming messages, we may move this someday.
            }
        }
コード例 #8
0
ファイル: FormLetterMerges.cs プロジェクト: royedwards/DRDNet
        private void butPreview_Click(object sender, System.EventArgs e)
        {
#if !DISABLE_MICROSOFT_OFFICE
            if (listLetters.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a letter first.");
                return;
            }
            LetterMerge letterCur = ListForCat[listLetters.SelectedIndex];
            letterCur.ImageFolder = comboImageCategory.SelectedTag <Def>().DefNum;
            string templateFile = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.TemplateName);
            string dataFile     = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.DataFileName);
            if (!File.Exists(templateFile))
            {
                MsgBox.Show(this, "Template file does not exist.");
                return;
            }
            if (!CreateDataFile(dataFile, letterCur))
            {
                return;
            }
            Word.MailMerge wrdMailMerge;
            //Create an instance of Word.
            Word.Application WrdApp;
            try{
                WrdApp = LetterMerges.WordApp;
            }
            catch {
                MsgBox.Show(this, "Error. Is Word installed?");
                return;
            }
            string errorMessage = "";
            //Open a document.
            try {
                Object oName = templateFile;
                wrdDoc = WrdApp.Documents.Open(ref oName, ref oMissing, ref oMissing,
                                               ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                               ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                wrdDoc.Select();
            }
            catch (Exception ex) {
                errorMessage = Lan.g(this, "Error opening document:") + "\r\n" + ex.Message;
                MessageBox.Show(errorMessage);
                return;
            }
            //Attach the data file.
            try {
                wrdMailMerge = wrdDoc.MailMerge;
                wrdDoc.MailMerge.OpenDataSource(dataFile, ref oMissing, ref oMissing, ref oMissing,
                                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
                wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
                wrdMailMerge.Execute(ref oFalse);
            }
            catch (Exception ex) {
                errorMessage = Lan.g(this, "Error attaching data file:") + "\r\n" + ex.Message;
                MessageBox.Show(errorMessage);
                return;
            }
            if (letterCur.ImageFolder != 0)           //if image folder exist for this letter, save to AtoZ folder
            //Open document from the atoz folder.
            {
                try {
                    WrdApp.Activate();
                    string tempFilePath = ODFileUtils.CreateRandomFile(Path.GetTempPath(), GetFileExtensionForWordDoc(templateFile));
                    Object oFileName    = tempFilePath;
                    WrdApp.ActiveDocument.SaveAs(oFileName);                    //save the document to temp location
                    Document doc       = SaveToImageFolder(tempFilePath, letterCur);
                    string   patFolder = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());
                    string   fileName  = ImageStore.GetFilePath(doc, patFolder);
                    if (!FileAtoZ.Exists(fileName))
                    {
                        throw new ApplicationException(Lans.g("LetterMerge", "Error opening document" + " " + doc.FileName));
                    }
                    FileAtoZ.StartProcess(fileName);
                    WrdApp.ActiveDocument.Close();                    //Necessary since we created an extra document
                    try {
                        File.Delete(tempFilePath);                    //Clean up the temp file
                    }
                    catch (Exception ex) {
                        ex.DoNothing();
                    }
                }
                catch (Exception ex) {
                    FriendlyException.Show(Lan.g(this, "Error saving file to the Image module:") + "\r\n" + ex.Message, ex);
                }
            }
            //Close the original form document since just one record.
            try {
                wrdDoc.Saved = true;
                wrdDoc.Close(ref oFalse, ref oMissing, ref oMissing);
            }
            catch (Exception ex) {
                errorMessage = Lan.g(this, "Error closing document:") + "\r\n" + ex.Message;
                MessageBox.Show(errorMessage);
                return;
            }
            //At this point, Word remains open with just one new document.
            try {
                WrdApp.Activate();
                if (WrdApp.WindowState == Word.WdWindowState.wdWindowStateMinimize)
                {
                    WrdApp.WindowState = Word.WdWindowState.wdWindowStateMaximize;
                }
            }
            catch (Exception ex) {
                errorMessage = Lan.g(this, "Error showing Microsoft Word:") + "\r\n" + ex.Message;
                MessageBox.Show(errorMessage);
                return;
            }
            wrdMailMerge = null;
            wrdDoc       = null;
            Commlog CommlogCur = new Commlog();
            CommlogCur.CommDateTime   = DateTime.Now;
            CommlogCur.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
            CommlogCur.Mode_          = CommItemMode.Mail;
            CommlogCur.SentOrReceived = CommSentOrReceived.Sent;
            CommlogCur.PatNum         = PatCur.PatNum;
            CommlogCur.Note           = "Letter sent: " + letterCur.Description + ". ";
            CommlogCur.UserNum        = Security.CurUser.UserNum;
            Commlogs.Insert(CommlogCur);
#else
            MessageBox.Show(this, "This version of Open Dental does not support Microsoft Word.");
#endif
            //this window now closes regardless of whether the user saved the comm item.
            DialogResult = DialogResult.OK;
        }
コード例 #9
0
ファイル: FormLetterMerges.cs プロジェクト: royedwards/DRDNet
        private void butPrint_Click(object sender, System.EventArgs e)
        {
#if DISABLE_MICROSOFT_OFFICE
            MessageBox.Show(this, "This version of Open Dental does not support Microsoft Word.");
            return;
#endif
            if (listLetters.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a letter first.");
                return;
            }
            LetterMerge letterCur = ListForCat[listLetters.SelectedIndex];
            letterCur.ImageFolder = comboImageCategory.SelectedTag <Def>().DefNum;
            string templateFile = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.TemplateName);
            string dataFile     = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.DataFileName);
            if (!File.Exists(templateFile))
            {
                MsgBox.Show(this, "Template file does not exist.");
                return;
            }
            PrintDocument pd = new PrintDocument();
            if (!PrinterL.SetPrinter(pd, PrintSituation.Default, PatCur.PatNum, "Letter merge " + letterCur.Description + " printed"))
            {
                return;
            }
            if (!CreateDataFile(dataFile, letterCur))
            {
                return;
            }
            Word.MailMerge wrdMailMerge;
            //Create an instance of Word.
            Word.Application WrdApp;
            try {
                WrdApp = LetterMerges.WordApp;
            }
            catch {
                MsgBox.Show(this, "Error.  Is MS Word installed?");
                return;
            }
            //Open a document.
            Object oName = templateFile;
            wrdDoc = WrdApp.Documents.Open(ref oName, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdDoc.Select();
            wrdMailMerge = wrdDoc.MailMerge;
            //Attach the data file.
            wrdDoc.MailMerge.OpenDataSource(dataFile, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
            //WrdApp.ActivePrinter=pd.PrinterSettings.PrinterName;
            //replaced with following 4 lines due to MS bug that changes computer default printer
            object   oWBasic   = WrdApp.WordBasic;
            object[] oWBValues = new object[] { pd.PrinterSettings.PrinterName, 1 };
            String[] sWBNames  = new String[] { "Printer", "DoNotSetAsSysDefault" };
            oWBasic.GetType().InvokeMember("FilePrintSetup", BindingFlags.InvokeMethod, null, oWBasic, oWBValues, null, null, sWBNames);
            wrdMailMerge.Execute(ref oFalse);
            if (letterCur.ImageFolder != 0)           //if image folder exist for this letter, save to AtoZ folder
            {
                try {
                    wrdDoc.Select();
                    wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
                    wrdMailMerge.Execute(ref oFalse);
                    WrdApp.Activate();
                    string tempFilePath = ODFileUtils.CreateRandomFile(Path.GetTempPath(), GetFileExtensionForWordDoc(templateFile));
                    Object oFileName    = tempFilePath;
                    WrdApp.ActiveDocument.SaveAs(oFileName);                    //save the document
                    WrdApp.ActiveDocument.Close();
                    SaveToImageFolder(tempFilePath, letterCur);
                }
                catch (Exception ex) {
                    FriendlyException.Show(Lan.g(this, "Error saving file to the Image module:") + "\r\n" + ex.Message, ex);
                }
            }
            //Close the original form document since just one record.
            wrdDoc.Saved = true;
            wrdDoc.Close(ref oFalse, ref oMissing, ref oMissing);
            //At this point, Word remains open with no documents.
            WrdApp.WindowState = Word.WdWindowState.wdWindowStateMinimize;
            wrdMailMerge       = null;
            wrdDoc             = null;
            Commlog CommlogCur = new Commlog();
            CommlogCur.CommDateTime   = DateTime.Now;
            CommlogCur.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
            CommlogCur.Mode_          = CommItemMode.Mail;
            CommlogCur.SentOrReceived = CommSentOrReceived.Sent;
            CommlogCur.PatNum         = PatCur.PatNum;
            CommlogCur.Note           = "Letter sent: " + letterCur.Description + ". ";
            CommlogCur.UserNum        = Security.CurUser.UserNum;
            Commlogs.Insert(CommlogCur);
            DialogResult = DialogResult.OK;
        }
コード例 #10
0
ファイル: ClaimConnect.cs プロジェクト: kjb7749/testImport
        public static bool Retrieve(Clearinghouse clearinghouse, IODProgressExtended progress = null)
        {
            progress = progress ?? new ODProgressExtendedNull();
            progress.UpdateProgress(Lans.g(progress.LanThis, "Contacting web server and downloading reports"), "reports", "17%", 17);
            if (progress.IsPauseOrCancel())
            {
                progress.UpdateProgress(Lans.g(progress.LanThis, "Canceled by user."));
                return(false);
            }
            Dentalxchange2016.Credentials cred = new Dentalxchange2016.Credentials();
            if (PrefC.GetBool(PrefName.CustomizedForPracticeWeb))             //even though they currently use code from a different part of the program.
            {
                cred.Client    = "Practice-Web";
                cred.ServiceID = "DCI Web Service ID: 001513";
            }
            else
            {
                cred.Client    = "OpenDental";
                cred.ServiceID = "DCI Web Service ID: 002778";
            }
            cred.Username = clearinghouse.LoginID;
            cred.Password = clearinghouse.Password;
            Dentalxchange2016.unProcessedEraRequest request = new Dentalxchange2016.unProcessedEraRequest();
            Dentalxchange2016.DwsService            service = new Dentalxchange2016.DwsService();
#if DEBUG
            service.Url = "https://prelive2.dentalxchange.com/dws/DwsService?wsdl";
#else
            service.Url = "https://webservices.dentalxchange.com/dws/DwsService?wsdl";
#endif
            ErrorMessage = "";
            List <string> listEraStrings = new List <string>();
            try {
                Dentalxchange2016.UnProcessedEraResponse response;
                do
                {
                    response = service.getUnProcessedEra(cred, request);
                    if (response.Status.code == 0 && response.ClaimPaymentAdvice.EdiContent != null)
                    {
                        listEraStrings.Add(response.ClaimPaymentAdvice.EdiContent);                        //X12 835 ERA raw content
                    }
                } while(response.Status.code == 0 && response.ClaimPaymentAdvice != null && response.ClaimPaymentAdvice.AdditionalEraExists);
                if (response.Status.code != 0)               //!=Approved
                //If the following error message changes, then also see if FormClaimReports.RetrieveReports() needs to change as well.
                {
                    ErrorMessage = "Era request unsuccessful."
                                   + "\r\nError message received directly from Claim Connect: " + response.Status.code
                                   + "\r\n\r\n" + response.Status.description;
                    return(false);
                }

                /*
                 * Code Description
                 * 0    Approved
                 * 1    Operation Failed
                 * 90   Invalid Group
                 * 100  Invalid User
                 * 110  Invalid Client
                 * 120  Service Not Allowed
                 * 130  User Not Allowed
                 * 140  Invalid PMS
                 * 150  Service Not Contracted by User
                 * 1000 Internal server error has occurred. The problem is being investigated.
                 * 2000 Generic Host Error
                 * 2001 Malformed document sent. Please insure that the format is correct and all required data is present.
                 * 2002 Deficient request - required data is missing.
                 * 2003 No insurers found for this selection.
                 * 2004 Unable to contact the payer at this time. Please try again later.
                 * 2005 Only the relationship self is supported at this time.
                 * 2007 Original request patient info reflected back
                 * 2008 Claim submission failed.
                 */
            }
            catch (Exception ex) {
                ErrorMessage = Lans.g(progress.LanThis, "If this is a new customer, this error might be due to an invalid Username or Password.  "
                                      + "Servers may need a few hours before ready to accept new user information.") + "\r\n"
                               + Lans.g(progress.LanThis, "Error message received directly from Claim Connect:") + "  " + ex.ToString();
                return(false);
            }
            progress.UpdateProgress(Lans.g(progress.LanThis, "Web server contact successful."));
            string path = clearinghouse.ResponsePath;
            progress.UpdateProgress(Lans.g(progress.LanThis, "Writing files"), "reports", "40%", 40);
            if (progress.IsPauseOrCancel())
            {
                progress.UpdateProgress(Lans.g(progress.LanThis, "Canceled by user."));
                return(false);
            }
            //write each message to a distinct file in the export path.
            listEraStrings.ForEach(x => File.WriteAllText(ODFileUtils.CreateRandomFile(path, ".txt"), x));
            progress.UpdateProgress(Lans.g(progress.LanThis, "Files written successfully."));
            progress.UpdateProgress(Lans.g(progress.LanThis, "Finalizing"), "reports", "50%", 50);
            if (progress.IsPauseOrCancel())
            {
                progress.UpdateProgress(Lans.g(progress.LanThis, "Canceled by user."));
                return(false);
            }
            return(true);
        }
コード例 #11
0
 ///<summary>Creates a new randomly named file in the given directory path with the given extension and returns the full path to the new file.</summary>
 public static string GetRandomTempFile(string ext)
 {
     return(ODFileUtils.CreateRandomFile(GetTempFolderPath(), ext));
 }