Пример #1
0
        private void butPickRxListImage_Click(object sender, EventArgs e)
        {
            if (!PrefC.AtoZfolderUsed)
            {
                MsgBox.Show(this, "This option is not supported with images stored in the database.");
                return;
            }
            FormImageSelect formIS = new FormImageSelect();

            formIS.PatNum = PatCur.PatNum;
            formIS.ShowDialog();
            if (formIS.DialogResult != DialogResult.OK)
            {
                return;
            }
            string   patFolder = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());
            Document doc       = Documents.GetByNum(formIS.SelectedDocNum);

            if (!ImageStore.HasImageExtension(doc.FileName))
            {
                MsgBox.Show(this, "The selected file is not a supported image type.");
                return;
            }
            textDocDateDesc.Text = doc.DateTStamp.ToShortDateString() + " - " + doc.Description.ToString();
            if (BitmapOriginal != null)
            {
                BitmapOriginal.Dispose();
            }
            BitmapOriginal = ImageStore.OpenImage(doc, patFolder);
            Bitmap bitmap = ImageHelper.ApplyDocumentSettingsToImage(doc, BitmapOriginal, ImageSettingFlags.ALL);

            pictBox.BackgroundImage = bitmap;
            resizePictBox();
        }
Пример #2
0
        private void butDocumentView_Click(object sender, EventArgs e)
        {
            Document doc = Documents.GetByNum(PlanCur.DocNum);

            if (doc.DocNum == 0)
            {
                MsgBox.Show(this, "Error locating document.");
                return;
            }
            if (!Documents.DocExists(doc.DocNum))
            {
                MsgBox.Show(this, "Unable to open document.");
                return;
            }
            Documents.OpenDoc(doc.DocNum);
        }
Пример #3
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Please select one completed form from the list above first.");
                return;
            }
            long     sheetNum = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());
            long     docNum   = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["DocNum"].ToString());
            Document doc      = null;

            if (docNum != 0)
            {
                doc = Documents.GetByNum(docNum);
                //Pdf importing broke with dot net 4.0 and was enver reimplemented.
                //See FormSheetImport.Load() region Acro
                //string extens=Path.GetExtension(doc.FileName);
                //if(extens.ToLower()!=".pdf") {
                //	MsgBox.Show(this,"Only pdf's and sheets can be imported into the database.");
                //	return;
                //}
            }
            Sheet sheet = null;

            if (sheetNum != 0)
            {
                sheet = Sheets.GetSheet(sheetNum);
                if (sheet.SheetType != SheetTypeEnum.PatientForm && sheet.SheetType != SheetTypeEnum.MedicalHistory)
                {
                    MsgBox.Show(this, "For now, only sheets of type 'PatientForm' and 'MedicalHistory' can be imported.");
                    return;
                }
            }
            if (sheet == null)
            {
                MsgBox.Show(this, "Only sheets can be imported into the database.");
                return;
            }
            FormSheetImport formSI = new FormSheetImport();

            formSI.SheetCur = sheet;
            formSI.DocCur   = doc;
            formSI.ShowDialog();
            //No need to refresh grid because no changes could have been made.
        }
Пример #4
0
 public void RefreshData(Patient pat, SheetField sheetField)
 {
     if (pat == null ||
         PrefC.AtoZfolderUsed == DataStorageType.InDatabase)              //Do not use patient image when A to Z folders are disabled.
     {
         return;
     }
     try{
         _docPatPicture = Documents.GetByNum(PIn.Long(sheetField.FieldValue), true);
         //GetFullImage applies cropping/transposing/etc...
         Bitmap fullImage = ImageHelper.GetFullImage(_docPatPicture, ImageStore.GetPatientFolder(pat, ImageStore.GetPreferredAtoZpath()));
         SwapPatPicture(() => ImageHelper.GetThumbnail(fullImage, Math.Min(sheetField.Width, sheetField.Height)));
         fullImage.Dispose();
     }
     catch (Exception e) {
         e.DoNothing();
         _patPicture?.Dispose();
         _patPicture = null;              //Something went wrong retrieving the image.  Default to "Patient Picture Unavailable".
     }
 }
Пример #5
0
 private void FormTreatPlanEdit_Load(object sender, System.EventArgs e)
 {
     //this window never comes up for new TP.  Always saved ahead of time.
     if (!Security.IsAuthorized(Permissions.TreatPlanEdit, PlanCur.DateTP))
     {
         butOK.Enabled                = false;
         butDelete.Enabled            = false;
         butPickResponsParty.Enabled  = false;
         butClearResponsParty.Enabled = false;
         butSigClear.Enabled          = false;
         butDocumentDetach.Enabled    = false;
         textHeading.ReadOnly         = true;
         textDateTP.ReadOnly          = true;
         textNote.ReadOnly            = true;
         if (Security.IsAuthorized(Permissions.TreatPlanSign, PlanCur.DateTP))                //User has permission to edit the heading field.
         {
             textHeading.ReadOnly = false;
             butOK.Enabled        = true;
         }
     }
     if (!Security.IsAuthorized(Permissions.TreatPlanPresenterEdit, true))
     {
         butPickPresenter.Visible = false;
     }
     if (PlanCur.UserNumPresenter > 0)
     {
         _presenterCur      = Userods.GetUser(PlanCur.UserNumPresenter);
         _presenterOld      = _presenterCur.Copy();
         textPresenter.Text = _presenterCur.UserName;
     }
     textUserEntry.Text = Userods.GetName(PlanCur.SecUserNumEntry);
     textDateTP.Text    = PlanCur.DateTP.ToShortDateString();
     textHeading.Text   = PlanCur.Heading;
     textNote.Text      = PlanCur.Note;
     if (PrefC.GetBool(PrefName.EasyHidePublicHealth))
     {
         labelResponsParty.Visible    = false;
         textResponsParty.Visible     = false;
         butPickResponsParty.Visible  = false;
         butClearResponsParty.Visible = false;
     }
     if (PlanCur.ResponsParty != 0)
     {
         textResponsParty.Text = Patients.GetLim(PlanCur.ResponsParty).GetNameLF();
     }
     if (PlanCur.Signature != "")            //Per Nathan 01 OCT 2015: In addition to invalidating signature (old behavior) we will also block editing signed TPs.
     {
         butOK.Enabled                = false;
         textHeading.ReadOnly         = true;
         textDateTP.ReadOnly          = true;
         textNote.ReadOnly            = true;
         butClearResponsParty.Enabled = false;
         butPickResponsParty.Enabled  = false;
         butSigClear.Visible          = true;
         butDocumentDetach.Enabled    = false;
     }
     else
     {
         butSigClear.Visible = false;
         butSigClear.Enabled = false;
     }
     if (PlanCur.DocNum > 0)           //Was set at some point in the past.
     {
         Document doc = Documents.GetByNum(PlanCur.DocNum);
         if (doc.DocNum == 0)
         {
             textDocument.Text       = "(" + Lan.g(this, "Missing Document") + ")";       //Invalid Fkey to document.DocNum
             butDocumentView.Enabled = false;
         }
         else
         {
             textDocument.Text = doc.Description;
             if (!Documents.DocExists(doc.DocNum))
             {
                 textDocument.Text      += " (" + Lan.g(this, "Unreachable File") + ")";            //Document points to unreachable file
                 butDocumentView.Enabled = false;
             }
         }
     }
     else              //hide document controls because there is no attached document
     {
         labelDocument.Visible     = false;
         textDocument.Visible      = false;
         butDocumentView.Visible   = false;
         butDocumentDetach.Visible = false;
     }
 }
Пример #6
0
        private void butPickRxListImage_Click(object sender, EventArgs e)
        {
            if (PrefC.AtoZfolderUsed == DataStorageType.InDatabase)
            {
                MsgBox.Show(this, "This option is not supported with images stored in the database.");
                return;
            }
            FormImageSelect formIS = new FormImageSelect();

            formIS.PatNum = PatCur.PatNum;
            formIS.ShowDialog();
            if (formIS.DialogResult != DialogResult.OK)
            {
                return;
            }
            string   patFolder = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());
            Document doc       = Documents.GetByNum(formIS.SelectedDocNum);

            if (!ImageStore.HasImageExtension(doc.FileName))
            {
                MsgBox.Show(this, "The selected file is not a supported image type.");
                return;
            }
            textDocDateDesc.Text = doc.DateTStamp.ToShortDateString() + " - " + doc.Description.ToString();
            if (BitmapOriginal != null)
            {
                BitmapOriginal.Dispose();
            }
            if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ)
            {
                BitmapOriginal = ImageStore.OpenImage(doc, patFolder);
            }
            else
            {
                FormProgress FormP = new FormProgress();
                FormP.DisplayText          = "Downloading Image...";
                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(patFolder
                                                                                          , doc.FileName
                                                                                          , new OpenDentalCloud.ProgressHandler(FormP.OnProgress));
                FormP.ShowDialog();
                if (FormP.DialogResult == DialogResult.Cancel)
                {
                    state.DoCancel = true;
                    return;
                }
                else
                {
                    using (MemoryStream ms = new MemoryStream(state.FileContent)) {
                        BitmapOriginal = new Bitmap(ms);
                    }
                }
            }
            Bitmap bitmap = ImageHelper.ApplyDocumentSettingsToImage(doc, BitmapOriginal, ImageSettingFlags.ALL);

            pictBox.BackgroundImage = bitmap;
            resizePictBox();
        }