Example #1
0
 ///<summary>This can add a title, subtitle, grid lines, and page nums to the report using defaults.  If the parameters are blank or false the object will not be added.
 ///Set showProgress false to hide the progress window from showing up when generating the report.</summary>
 public ReportComplex(bool hasGridLines, bool isLandscape, bool showProgress = true)
 {
     if (showProgress)
     {
         _actionCloseReportProgress = ODProgress.Show(ODEventType.ReportComplex
                                                      , typeof(ReportComplexEvent)
                                                      , startingMessage: Lan.g("ReportComplex", "Running Report Query...")
                                                      , hasHistory: PrefC.GetBool(PrefName.ReportsShowHistory));
     }
     _grfx        = Graphics.FromImage(new Bitmap(1, 1));
     _isLandscape = isLandscape;
     if (hasGridLines)
     {
         AddGridLines();
     }
     if (_sections[AreaSectionType.ReportHeader] == null)
     {
         _sections.Add(new Section(AreaSectionType.ReportHeader, 0));
     }
     if (_sections[AreaSectionType.PageHeader] == null)
     {
         _sections.Add(new Section(AreaSectionType.PageHeader, 0));
     }
     if (_sections[AreaSectionType.PageFooter] == null)
     {
         _sections.Add(new Section(AreaSectionType.PageFooter, 0));
     }
     if (_sections[AreaSectionType.ReportFooter] == null)
     {
         _sections.Add(new Section(AreaSectionType.ReportFooter, 0));
     }
 }
Example #2
0
        public void ODProgress_Show_RaceCondition()
        {
            //Show a progress window and then immediately tell it to close.  This is the quickest possible "long computation".
            Action actionClose = ODProgress.Show();

            actionClose();            //Invoking this action right away was causing progress windows to stay "stuck open".
            Assert.IsTrue(true);      //This unit test would never finish if a race condition was present.
        }
Example #3
0
 private void butTransfer_Click(object sender, EventArgs e)
 {
     if (gridPatients.ListGridRows.Count == 0)
     {
         MsgBox.Show(this, "At least one patient must be selected to transfer.");
         return;
     }
     if (gridDatabasesTo.ListGridRows.Count == 0)
     {
         MsgBox.Show(this, "At least one database must be selected to transfer.");
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "The transfer process may take a long time. Continue?"))
     {
         return;
     }
     ODProgress.ShowAction(() => RunTransfer(), startingMessage: Lans.g(this, "Transferring patient(s)..."),
                           actionException: err => this.Invoke(() => FriendlyException.Show(Lan.g(this, "Error transferring patient(s)."), err)));
 }
Example #4
0
 public void ODProgress_ShowAction_RaceCondition()
 {
     //Show a progress window and then immediately tell it to close.  This is the quickest possible "long computation".
     ODProgress.ShowAction(() => { }); //This is the quickest possible "long computation".
     Assert.IsTrue(true);              //This unit test would never finish if a race condition was present.
 }
Example #5
0
        ///<summary>Returns true if we got a URL from PDMP.
        ///If true, the response will be the URL.
        ///If false, the response will be the error.</summary>
        public static bool TrySendData(Program programCur, Patient pat, out string response)
        {
            string        result    = "";
            StringBuilder sbErrors  = new StringBuilder();
            bool          isSuccess = false;

            ODProgress.ShowAction(() => {
                if (!programCur.Enabled)
                {
                    sbErrors.AppendLine(programCur.ProgName + Lans.g("PDMP", " must be enabled in Program Links."));
                    result = sbErrors.ToString();
                    return;
                }
                if (pat == null)
                {
                    sbErrors.AppendLine(Lans.g("PDMP", "Please select a patient."));
                    result = sbErrors.ToString();
                    return;
                }
                Provider prov = Providers.GetProv(pat.PriProv);
                if (prov == null)
                {
                    sbErrors.AppendLine(Lans.g("PDMP", "Patient does not have a primary provider."));
                    result = sbErrors.ToString();
                    return;
                }
                string strDeaNum = ProviderClinics.GetDEANum(prov.ProvNum, Clinics.ClinicNum);             //If no result found, retries using clinicNum=0.
                if (string.IsNullOrWhiteSpace(strDeaNum))
                {
                    sbErrors.AppendLine(Lans.g("PDMP", "Patient's provider does not have a DEA number."));
                }
                string stateWhereLicensed = ProviderClinics.GetStateWhereLicensed(pat.PriProv, Clinics.ClinicNum);
                if (string.IsNullOrWhiteSpace(stateWhereLicensed))
                {
                    sbErrors.AppendLine(Lans.g("PDMP", "Patient's provider is not licensed for any state."));
                }
                string facilityIdPropDesc = "";
                string userNamePropDesc   = "";
                string passwordPropDesc   = "";
                try {
                    facilityIdPropDesc = GetFacilityIdPropDesc(stateWhereLicensed);
                    userNamePropDesc   = GetClientUserNamePropDesc(stateWhereLicensed);
                    passwordPropDesc   = GetClientPasswordPropDesc(stateWhereLicensed);
                }
                catch (NotImplementedException niex) {
                    sbErrors.AppendLine(niex.Message);
                }
                //Validation failed.  We gave the user as much information to fix as possible.
                if (!string.IsNullOrWhiteSpace(sbErrors.ToString()))
                {
                    result = sbErrors.ToString();
                    return;
                }
                //Validation passed and we can now call the PDMP API.
                string facilityId     = ProgramProperties.GetPropVal(programCur.ProgramNum, facilityIdPropDesc);
                string clientUsername = ProgramProperties.GetPropVal(programCur.ProgramNum, userNamePropDesc);
                string clientPassword = ProgramProperties.GetPropVal(programCur.ProgramNum, passwordPropDesc);
                try {
                    //Each state may use a different API for its PDMP services.  Implement appropriate classes to handle each state we support.
                    switch (stateWhereLicensed)
                    {
                    case "IL":
                        PDMPLogicoy pdmp = new PDMPLogicoy(clientUsername, clientPassword, pat, prov, stateWhereLicensed, strDeaNum, facilityId);
                        result           = pdmp.GetURL();
                        isSuccess        = true;
                        break;

                    default:
                        result = Lans.g("PDMP", "PDMP program link has not been implemented for state: ") + stateWhereLicensed;
                        return;
                    }
                }
                catch (Exception ex) {
                    result = ex.Message;
                    return;
                }
            }, startingMessage: Lans.g("PDMP", "Fetching data..."));
            response = result;
            return(isSuccess);
        }