gov.va.medora.mdws.MhvLib.getChemHemReportsByReportDateFromSite C# (CSharp) Method

getChemHemReportsByReportDateFromSite() public method

public getChemHemReportsByReportDateFromSite ( string pwd, string sitecode, string mpiPid, string fromDate, string toDate ) : TaggedChemHemRptArray
pwd string
sitecode string
mpiPid string
fromDate string
toDate string
return gov.va.medora.mdws.dto.TaggedChemHemRptArray
        public TaggedChemHemRptArray getChemHemReportsByReportDateFromSite(
            string pwd, string sitecode, string mpiPid, string fromDate, string toDate)
        {
            TaggedChemHemRptArray result = new TaggedChemHemRptArray();

            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO("Missing sitecode");
            }
            else if (mpiPid == "")
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (toDate == "")
            {
                toDate = DateTime.Now.ToString("yyyyMMdd");
            }

            AccountLib acctLib = new AccountLib(mySession);
            try
            {
                SiteArray sites = acctLib.patientVisit(pwd, sitecode, mpiPid, false);
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return result;
                }

                // Get the labs...
                ChemHemReport[] rpts = ChemHemReport.getChemHemReports(mySession.ConnectionSet.getConnection(sitecode), fromDate, toDate);
                result = new TaggedChemHemRptArray(sitecode, rpts);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                mySession.close();
            }
            return result;
        }