Example #1
0
 public static void Build(JObject jsonResult, DistributionLogCollection distributionLogCollection)
 {
     if (jsonResult["result"]["results"] != null)
     {
         for (int i = 0; i < jsonResult["result"]["results"].Count(); i++)
         {
             DistributionLog distributionLog = new DistributionLog();
             distributionLog.FromSql((JObject)jsonResult["result"]["results"][i]);
             distributionLogCollection.Add(distributionLog);
         }
     }
 }
Example #2
0
 private void DoCategoryTypeSearch()
 {
     if (this.m_CategorySearchType == "Not Acknowledged")
     {
         MethodResult methodResult = DistributionLogCollection.GetByNotAcknowledged();
         if (methodResult.Success == true)
         {
             this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
             this.NotifyPropertyChanged(string.Empty);
         }
         else
         {
             methodResult.ShowMethodResult();
         }
     }
     else if (this.m_CategorySearchType == "Recent Cases")
     {
         MethodResult methodResult = DistributionLogCollection.GetByRecentCases();
         if (methodResult.Success == true)
         {
             this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
             this.NotifyPropertyChanged(string.Empty);
         }
         else
         {
             methodResult.ShowMethodResult();
         }
     }
     else if (this.m_CategorySearchType == "Detected COVID Cases")
     {
         MethodResult methodResult = DistributionLogCollection.GetByDetectedCOVIDCases();
         if (methodResult.Success == true)
         {
             this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
             this.NotifyPropertyChanged(string.Empty);
         }
         else
         {
             methodResult.ShowMethodResult();
         }
     }
 }
Example #3
0
 private void DoDateOfBirthSearch()
 {
     if (this.m_DateOfBirthSearch.HasValue == true)
     {
         MethodResult methodResult = DistributionLogCollection.GetByDateOfBirth(this.m_DateOfBirthSearch.Value);
         if (methodResult.Success == true)
         {
             this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
             this.NotifyPropertyChanged(string.Empty);
         }
         else
         {
             methodResult.ShowMethodResult();
         }
     }
     else
     {
         MessageBox.Show("Please enter a valide Date Of Birth.");
     }
 }
Example #4
0
        private void MenuItemAcknowledge_Click(object sender, RoutedEventArgs e)
        {
            if (this.ListViewReportDistributionLog.SelectedItems.Count > 0)
            {
                JArray idList = new JArray();
                foreach (DistributionLog distributionLog in this.ListViewReportDistributionLog.SelectedItems)
                {
                    idList.Add(distributionLog.TestOrderReportDistributionId);
                }

                JObject   jsonRequest = APIRequestHelper.GetAcknowledgeDistributionsMessage(idList);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

                MethodResult methodResult = DistributionLogCollection.GetByNotAcknowledged();
                if (methodResult.Success == true)
                {
                    this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
                    this.NotifyPropertyChanged(string.Empty);
                }
            }
        }
Example #5
0
        public static MethodResult GetByPatientName(PatientName patientName)
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += "where tord.ClientId in (" + clientIdList + ") ";

            if (patientName.LastName != null && patientName.FirstName != null)
            {
                commandText = commandText + "and PLastName like '" + patientName.LastName + "%' and pFirstName like '" + patientName.FirstName + "%' order by ao.AccessionDate desc";
            }

            if (patientName.LastName != null && patientName.FirstName == null)
            {
                commandText = $"{commandText} and PLastName like '{patientName.LastName}%' order by ao.AccessionDate desc;";
            }

            if (patientName.LastName != null)
            {
                JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);
                DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

                MethodResult methodResult = new MethodResult();
                methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
                return(methodResult);
            }
            else
            {
                MethodResult methodResult = new MethodResult();
                methodResult.Success = false;
                methodResult.Messages.Add("Invalid patient name.");
                return(methodResult);
            }
        }
Example #6
0
        public static MethodResult GetByNotAcknowledged()
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += "where tord.ClientId in (" + clientIdList + ") and tord.DistributionType = 'Web Service' and tord.Distributed = 1 and tord.Acknowledged = 0 limit 500;";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
            return(methodResult);
        }
Example #7
0
        public static MethodResult GetByDateOfBirth(DateTime dateOfBirth)
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += "where tord.ClientId in (" + clientIdList + ") and ao.PBirthDate = '" + dateOfBirth.ToString("yyyyMMdd") + "';";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
            return(methodResult);
        }
Example #8
0
        private void DoPatientNameSearch()
        {
            PatientName patientName = null;
            bool        result      = PatientName.TryParse(this.m_PatientNameSearch, out patientName);

            if (result)
            {
                MethodResult methodResult = DistributionLogCollection.GetByPatientName(patientName);
                if (methodResult.Success == true)
                {
                    this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
                    this.NotifyPropertyChanged(string.Empty);
                }
                else
                {
                    methodResult.ShowMethodResult();
                }
            }
            else
            {
                MessageBox.Show("Must have at least 2 characters for a patient name search.");
            }
        }
Example #9
0
        public static MethodResult GetByRecentPostedCases()
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += $"where tord.ClientId in ({clientIdList}) and tord.Distributed = 1 ";
            commandText += "and tord.DistributionType = 'Web Service' ";
            commandText += $"and tord.timeOfLastDistribution >= '{DateTime.Today.AddDays(-45).ToString("yyyy-MM-dd")}' order by tord.timeOfLastDistribution desc;";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
            return(methodResult);
        }