Ejemplo n.º 1
0
        public WCFPPSInformation[] QueryMPPS(MPPSQuery query)
        {
            List <WCFPPSInformation> mpps = new List <WCFPPSInformation>();
            ImagingServiceRequest    sr   = new ImagingServiceRequest()
            {
                AccessionNumber = query.AccessionNumber
            };
            WCFRequestedProcedure rp = new WCFRequestedProcedure()
            {
                RequestedProcedureID = query.RequestedProcedureId
            };
            WCFScheduledProcedureStep sp = new WCFScheduledProcedureStep()
            {
                ScheduledProcedureStepID = query.ScheduledProcedureId
            };

            using (MPPSDataset ds = DB.DataAccess.FindMPPS(query.PPSInfo, query.Patient, sr, rp, sp))
            {
                if (ds.PPSInformation.Rows.Count > 0)
                {
                    ds.ToPPSInformation(mpps);
                }
            }

            return(mpps.ToArray());
        }
Ejemplo n.º 2
0
        public void UpdateMPPS(string mppsSOPInstanceUID, WCFPPSInformation mpps)
        {
            PPSInformation srchMpps = new PPSInformation()
            {
                MPPSSOPInstanceUID = mppsSOPInstanceUID
            };

            Guard.ArgumentNotNullOrEmpty(mppsSOPInstanceUID, "mppsSOPInstanceUID");
            VerifyMpps(mpps);

            using (MPPSDataset ds = DB.DataAccess.FindMPPS(srchMpps))
            {
                if (ds != null && ds.PPSInformation.Rows.Count > 0)
                {
                    MPPSDataset.PPSInformationRow row = ds.PPSInformation.Rows[0] as MPPSDataset.PPSInformationRow;

                    row.Update(mpps);
                    DB.DataAccess.UpdateMPPS(ds);
                }
                else
                {
                    throw new Exception("Modality performed procedure step not found");
                }
            }
        }
Ejemplo n.º 3
0
 public void AddMPPS(WCFPPSInformation mpps)
 {
     VerifyMpps(mpps);
     using (MPPSDataset ds = new MPPSDataset())
     {
         ds.AddMPPS(mpps);
         DB.DataAccess.UpdateMPPS(ds);
     }
 }
Ejemplo n.º 4
0
        public WCFPPSInformation FindMPPS(string mppsSOPInstanceUID)
        {
            WCFPPSInformation mpps = new WCFPPSInformation()
            {
                MPPSSOPInstanceUID = mppsSOPInstanceUID
            };

            Guard.ArgumentNotNullOrEmpty(mppsSOPInstanceUID, "mppsSOPInstanceUID");
            using (MPPSDataset ds = DB.DataAccess.FindMPPS(mpps))
            {
                if (ds?.PPSInformation.Rows.Count > 0)
                {
                    return(ds.ToPPSInformation());
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        public void DeleteMPPS(string mppsSOPInstanceUID)
        {
            PPSInformation mpps = new PPSInformation()
            {
                MPPSSOPInstanceUID = mppsSOPInstanceUID
            };

            Guard.ArgumentNotNullOrEmpty(mppsSOPInstanceUID, "mppsSOPInstanceUID");
            using (MPPSDataset ds = DB.DataAccess.FindMPPS(mpps))
            {
                if (ds.PPSInformation.Rows.Count > 0)
                {
                    ds.PPSInformation.Rows[0].Delete();
                    DB.DataAccess.UpdateMPPS(ds);
                }
                else
                {
                    throw new Exception("Modality performed procedure step not found");
                }
            }
        }
Ejemplo n.º 6
0
        //private PrimitiveIODElement GetPrimitiveElementBasedOnTableColumnName
        //(
        //   TreeNode ParentElement,
        //   string strTableName,
        //   string strColumnName
        //)
        //{
        //   try
        //   {
        //      foreach ( TreeNode Node in ParentElement.Nodes )
        //      {
        //         if ( IsTreeNodeMatch ( Node, strTableName, strColumnName ) )
        //         {
        //            return ( PrimitiveIODElement ) Node ;
        //         }
        //         else
        //         {
        //            TreeNode ReturnedTreeNode ;


        //            ReturnedTreeNode = GetPrimitiveElementBasedOnTableColumnName ( Node,
        //                                                                           strTableName,
        //                                                                           strColumnName) ;

        //            if ( null != ReturnedTreeNode )
        //            {
        //               return ( PrimitiveIODElement ) ReturnedTreeNode ;
        //            }
        //         }
        //      }

        //      return null ;
        //   }
        //   catch ( Exception exception )
        //   {
        //      System.Diagnostics.Debug.Assert ( false ) ;

        //      throw exception ;
        //   }
        //}


        //private bool IsTreeNodeMatch
        //(
        //   TreeNode Node,
        //   string strTableName,
        //   string strColumnName
        //)
        //{
        //   try
        //   {
        //      if ( Node is PrimitiveIODElement )
        //      {
        //         PrimitiveIODElement InformationNode ;


        //         InformationNode = ( PrimitiveIODElement ) Node ;

        //         if ( ( InformationNode.TableName == strTableName ) &&
        //              ( InformationNode.ColumnsName == strColumnName ) )
        //         {
        //            return true ;
        //         }
        //      }

        //      return false ;
        //   }
        //   catch ( Exception exception )
        //   {
        //      System.Diagnostics.Debug.Assert ( false ) ;

        //      throw exception ;
        //   }
        //}


        private bool ValidateMPPSDataSet
        (
            MPPSDataset MPPSValidationDataSet,
            ref string strValidationMessage
        )
        {
            try
            {
                MPPSDataset.PPSInformationDataTable InformationDatatable;


                InformationDatatable = MPPSValidationDataSet.PPSInformation;

                foreach (MPPSDataset.PPSInformationRow MPPSRow in InformationDatatable.Rows)
                {
                    if (MPPSRow.RowState != DataRowState.Deleted &&
                        MPPSRow.RowState != DataRowState.Detached)
                    {
                        if (MPPSRow.GetPPSRelationshipRows( ).Length == 0)
                        {
                            strValidationMessage = Constants.ValidationMessages.Invalid_relational_Data;

                            MPPSRow.RowError = strValidationMessage;

                            return(false);
                        }

                        if (MPPSRow.PerformedProcedureStepStatus != Constants.StatusValues.InProgress)
                        {
                            if (MPPSRow.IsPerformedProcedureStepEndDateNull( ) ||
                                MPPSRow.IsPerformedProcedureStepEndTimeNull( ))
                            {
                                strValidationMessage = Constants.ValidationMessages.Invalid_PPS_Date;

                                MPPSRow.RowError = strValidationMessage;

                                return(false);
                            }

                            if (MPPSRow.GetPerformedSeriesSequenceRows( ).Length == 0)
                            {
                                strValidationMessage = Constants.ValidationMessages.Invalid_PerformedSeriesSequence;

                                MPPSRow.RowError = strValidationMessage;

                                return(false);
                            }
                        }
                    }
                }

                strValidationMessage = Constants.ValidationMessages.Success;

                return(true);
            }
            catch (System.Exception exception)
            {
                System.Diagnostics.Debug.Assert(false, exception.Message);

                throw exception;
            }
        }