18. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/7/2019 7:15:10 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

18.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\CRS_EFR\EFR DoDFragmentManager.cs Wed May 22 19:56:15 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\CRS_EFR\EFR DoDFragmentManager.cs Tue May 28 16:43:56 2019 UTC

18.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1012
Changed 1 2
Inserted 0 0
Removed 0 0

18.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

18.4 Active regular expressions

No regular expressions were active.

18.5 Comparison detail

  1   using Syst em;
  2   using Syst em.Collect ions.Gener ic;
  3   using Syst em.Linq;
  4   using Syst em.Data.Li nq;
  5   using Vete ransAffair s.Registri es.Busines s;
  6   using Vete ransAffair s.Registri es.Busines sManager.U tilities;
  7   using Vete ransAffair s.Registri es.Busines sManager;
  8  
  9   namespace  CRS_EFR
  10   {
  11       public  class DoD FragmentMa nager:Base BO 
  12       {
  13           //  TODO!!!
  14             private st atic strin g USER_NAM E = " DN S         \\ DN S      ASKEWD";
  15  
  16           pr ivate int  _selectFra gmentsByPa tientIdCou nt = 0;
  17           pr ivate int  _selectDoD FragmentDe tailsCount  = 0;
  18           pr ivate int  _selectDoD FragmentsR awDataByPa tientIdCou nt = 0;
  19  
  20           // / <summary >
  21           // / Select D oD_FRAGMEN T_DATA_REC EIVELOG by  patient S SN
  22           // / </summar y>
  23           // / <param n ame="ssn"> </param>
  24           // / <returns ></returns >
  25           pu blic DoD_F RAGMENT_DA TA_RECEIVE LOG Select BySSN(stri ng ssn)
  26           {
  27                using (_ db = GetDa taContext( ))
  28                {
  29                    DoD_ FRAGMENT_D ATA_RECEIV ELOG fragm ent = Sele ctBySSNLin qFilter(ss n).FirstOr Default();
  30  
  31                    retu rn fragmen t;
  32                }
  33  
  34           }
  35  
  36           pr ivate IQue ryable<DoD _FRAGMENT_ DATA_RECEI VELOG> Sel ectBySSNLi nqFilter(s tring ssn)
  37           {
  38                IQueryab le<DoD_FRA GMENT_DATA _RECEIVELO G> linqFil ter = (fro m e in _db .DoD_FRAGM ENT_DATA_R ECEIVELOGs
  39                 where e .PATIENTSN UM.Replace (" ", ""). Replace("- ", "").Equ als(ssn.Re place(" ",  "").Repla ce("-", "" ))
  40                 select  e);
  41                return l inqFilter;
  42           }
  43  
  44           pr ivate void  SetLoadWi th(Registr iesDataAcc ess db)
  45           {
  46                DataLoad Options lo  = new Dat aLoadOptio ns();
  47                lo.LoadW ith<DOD_FR AGMENT_LAB >(e => e.D OD_FRAGMEN Ts);
  48                lo.LoadW ith<DOD_FR AGMENT>(e  => e.DOD_F RAGMENT_DE TAILs);
  49  
  50                db.LoadO ptions = l o;
  51                db.Defer redLoading Enabled =  false;
  52  
  53           }
  54  
  55           pr ivate void  SetLoadWi thAnalytes (Registrie sDataAcces s db)
  56           {
  57                DataLoad Options lo  = new Dat aLoadOptio ns();
  58                lo.LoadW ith<DOD_FR AGMENT>(e  => e.DOD_F RAGMENT_DE TAILs);
  59                lo.LoadW ith<DOD_FR AGMENT_DET AIL>(e =>  e.STD_FRAG MENT_ANALY SIS_TYPE);
  60  
  61                db.LoadO ptions = l o;
  62                db.Defer redLoading Enabled =  false;
  63  
  64           }
  65  
  66           pr ivate void  SetLoadWi thFragment (Registrie sDataAcces s db)
  67           {
  68                DataLoad Options lo  = new Dat aLoadOptio ns();
  69                lo.LoadW ith<DOD_FR AGMENT>(e  => e.DOD_F RAGMENT_DE TAILs);
  70  
  71                db.LoadO ptions = l o;
  72                db.Defer redLoading Enabled =  false;
  73  
  74           }
  75           pr ivate void  SetLoadWi thFragment Detail(Reg istriesDat aAccess db )
  76           {
  77                DataLoad Options lo  = new Dat aLoadOptio ns();
  78                lo.LoadW ith<DOD_FR AGMENT_DET AIL>(e =>  e.STD_FRAG MENT_ANALY SIS_TYPE);
  79  
  80                db.LoadO ptions = l o;
  81                db.Defer redLoading Enabled =  false;
  82  
  83           }
  84  
  85           pr ivate void  SetLoadWi thDoDRawDa ta(Registr iesDataAcc ess db)
  86           {
  87                DataLoad Options lo  = new Dat aLoadOptio ns();
  88                lo.LoadW ith<DoD_FR AGMENT_DAT A_RECEIVEL OG>(e => e .DOD_FRAGM ENT_RAW_DA TA);
  89  
  90                db.LoadO ptions = l o;
  91                db.Defer redLoading Enabled =  false;
  92  
  93           }
  94  
  95           // / <summary >
  96           // / Get the  last extra ct file da te for eac h DoD lab
  97           // / </summar y>
  98           // / <returns ></returns >
  99           pu blic List< DoDFragmen tDataExtra ctByLab> G etLastExtr actDateFor AllLabs()
  100           {
  101               using (_d b = GetDat aContext() )
  102               {
  103                   retur n (from e  in _db.DOD _FRAGMENT_ RAW_DATAs 
  104                                         group  e by e.SO URCE_LAB i nto g
  105                                         selec t new DoDF ragmentDat aExtractBy Lab 
  106                                         {
  107                                             L abName = g .Key,
  108                                             L astExtract ReceivedDa te = g.Max ( e => e.C REATED)
  109                                         }).To List();
  110               }
  111           }
  112  
  113           // / <summary >
  114           // / Get the  last DoD F ragment Da ta Extract  Date
  115           // / </summar y>
  116           // / <returns ></returns >
  117           pu blic Syste m.Nullable <DateTime>  GetLastEx tractDate( string ssn )
  118           {
  119                using (_ db = GetDa taContext( ))
  120                {
  121                    Syst em.Nullabl e<DateTime > extractD ate = null ;
  122                    int  logCount =  (from e i n _db.DoD_ FRAGMENT_D ATA_RECEIV ELOGs
  123                                      where e. PATIENTSNU M.Replace( " ", "").R eplace("-" , "").Equa ls(ssn.Rep lace(" ",  "").Replac e("-", "") )
  124                                      select e ).Count();
  125                    if ( logCount >  0)
  126                    {
  127                         extractDat e = (from  e in _db.D oD_FRAGMEN T_DATA_REC EIVELOGs
  128                                         where  e.PATIENT SNUM.Repla ce(" ", "" ).Replace( "-", "").E quals(ssn. Replace("  ", "").Rep lace("-",  ""))
  129                                         selec t e.ORIGIN ALINPUTDAT E).Min();
  130                    }
  131  
  132                    retu rn extract Date;
  133                }
  134  
  135           }
  136  
  137           // / <summary >
  138           // / Select D oD Fragmen t Raw Data  by Patien t ID
  139           // / </summar y>
  140           // / <param n ame="patie ntId"></pa ram>
  141           // / <param n ame="sort" ></param>
  142           // / <param n ame="maxRo ws"></para m>
  143           // / <param n ame="start Row"></par am>
  144           // / <returns ></returns >
  145           pu blic IEnum erable<DoD _FRAGMENT_ DATA_RECEI VELOG> Sel ectDoDFrag mentsRawDa taByPatien tId(int pa tientId, s tring sort , int maxR ows, int s tartRow)
  146           {
  147                IEnumera ble<DoD_FR AGMENT_DAT A_RECEIVEL OG> result s = null;
  148  
  149                if (pati entId > 0)
  150                {
  151                    Pati entManager  patientMa nager = ne w PatientM anager();
  152                    PATI ENT patien t = patien tManager.S electByPat ientID(pat ientId);
  153  
  154                    if ( patient !=  null)
  155                    {
  156                         if (string .IsNullOrE mpty(sort) )
  157                         {
  158                             sort =  "DOD_FRAG MENT_RAW_D ATA_ID des c";
  159                         }
  160  
  161                         using (_db  = GetData Context())
  162                         {
  163                             SetLoa dWithDoDRa wData(_db) ;
  164  
  165                             result s = Select DoDFragmen tsRawDataB yPatientId LinqFilter (patient.S num).Order By(sort).T oList();
  166                             _selec tDoDFragme ntsRawData ByPatientI dCount = r esults.Cou nt();
  167                         }
  168                    }
  169                }
  170                return r esults;
  171           }
  172  
  173           // / <summary >
  174           // / Count fo r Select D oD Fragmen t Raw Data  by Patien t ID
  175           // / </summar y>
  176           // / <param n ame="patie ntId"></pa ram>
  177           // / <returns ></returns >
  178           pu blic int S electDoDFr agmentsRaw DataByPati entIdCount (int patie ntId)
  179           {
  180                return _ selectDoDF ragmentsRa wDataByPat ientIdCoun t;
  181           }
  182  
  183           // / <summary >
  184           // / Select a  record fr om DOD_FRA GMENT_RAW_ DATA table  by Raw Da ta ID
  185           // / </summar y>
  186           // / <param n ame="rawDa taId"></pa ram>
  187           // / <returns ></returns >
  188           pu blic DOD_F RAGMENT_RA W_DATA Sel ectByRawDa taId(int r awDataId)
  189           {
  190                using (_ db = GetDa taContext( ))
  191                {
  192                    DOD_ FRAGMENT_R AW_DATA ra wData = (f rom e in _ db.DOD_FRA GMENT_RAW_ DATAs
  193                             where  e.DOD_FRAG MENT_RAW_D ATA_ID ==  rawDataId 
  194                             select  e).FirstO rDefault() ;
  195  
  196                    retu rn rawData ;
  197                }
  198           }
  199           
  200           // / <summary >
  201           // / Get all  fragments  for a pati ent
  202           // / </summar y>
  203           // / <param n ame="patie ntId"></pa ram>
  204           // / <param n ame="sort" ></param>
  205           // / <param n ame="maxRo ws"></para m>
  206           // / <param n ame="start Row"></par am>
  207           // / <returns ></returns >
  208           pu blic IEnum erable<DOD _FRAGMENT_ LAB> Selec tFragments ByPatientI d(int pati entId)
  209           {
  210                IEnumera ble<DOD_FR AGMENT_LAB > results  = null;
  211  
  212                if (pati entId > 0)
  213                {
  214                    usin g (_db = G etDataCont ext())
  215                    {
  216                         results =  SelectFrag mentsByPat ientIdLinq Filter(pat ientId).Or derBy("LAB _NAME").To List();
  217                         _selectFra gmentsByPa tientIdCou nt = resul ts.Count() ;
  218                    }
  219                }
  220                return r esults;
  221           }
  222  
  223           // / <summary >
  224           // / Select f ragments b y lab ID
  225           // / </summar y>
  226           // / <param n ame="labId "></param>
  227           // / <returns ></returns >
  228           pu blic IEnum erable<DOD _FRAGMENT>  SelectFra gmentsByLa bId(int la bId)
  229           {
  230                IEnumera ble<DOD_FR AGMENT> re sults = nu ll;
  231  
  232                if (labI d > 0)
  233                {
  234                    usin g (_db = G etDataCont ext())
  235                    {
  236                         results =  SelectFrag mentsByLab IdLinqFilt er(labId). OrderBy("D OD_FRAGMEN T_ID").ToL ist();
  237                    }
  238                }
  239                return r esults;
  240           }
  241  
  242           // / <summary >
  243           // / Select f ragment an alytes by  fragment I D
  244           // / </summar y>
  245           // / <param n ame="fragm entId"></p aram>
  246           // / <returns ></returns >
  247           pu blic IEnum erable<DOD _FRAGMENT_ DETAIL> Se lectFragme ntAnalytes ByFragment Id(int fra gmentId)
  248           {
  249                IEnumera ble<DOD_FR AGMENT_DET AIL> resul ts = null;
  250  
  251                if (frag mentId > 0 )
  252                {
  253                    usin g (_db = G etDataCont ext())
  254                    {
  255                         SetLoadWit hAnalytes( _db);
  256                         results =  SelectFrag mentAnalyt esByFragme ntIdLinqFi lter(fragm entId).Ord erBy("DOD_ FRAGMENT_D ETAIL_ID") .ToList();
  257                    }
  258                }
  259                return r esults;
  260           }
  261  
  262           pr ivate IQue ryable<DOD _FRAGMENT_ LAB> Selec tFragments ByPatientI dLinqFilte r(int pati entId)
  263           {
  264                return ( from t in  _db.DOD_FR AGMENT_LAB s
  265                         where t.PA TIENT_ID = = patientI d
  266                         select t);
  267           }
  268  
  269           pr ivate IQue ryable<DOD _FRAGMENT>  SelectFra gmentsByLa bIdLinqFil ter(int la bId)
  270           {
  271                return ( from t in  _db.DOD_FR AGMENTs
  272                         where t.DO D_FRAGMENT _LAB_ID ==  labId
  273                         select t);
  274           }
  275  
  276           pr ivate IQue ryable<DOD _FRAGMENT_ DETAIL> Se lectFragme ntAnalytes ByFragment IdLinqFilt er(int fra gmentId)
  277           {
  278                return ( from t in  _db.DOD_FR AGMENT_DET AILs
  279                         where t.DO D_FRAGMENT _ID == fra gmentId
  280                         select t);
  281           }
  282  
  283           pr ivate IQue ryable<DoD _FRAGMENT_ DATA_RECEI VELOG> Sel ectDoDFrag mentsRawDa taByPatien tIdLinqFil ter(string  ssn)
  284           {
  285                IQueryab le<DoD_FRA GMENT_DATA _RECEIVELO G> fullSet  = null;
  286                IQueryab le<DoD_FRA GMENT_DATA _RECEIVELO G> grouped Set = null ;
  287  
  288                //Select  all recor ds for cur rent patie nt
  289                fullSet  = from t i n _db.DoD_ FRAGMENT_D ATA_RECEIV ELOGs
  290                           where t. PATIENTSNU M.Replace( " ", "").R eplace("-" , "").Equa ls(ssn.Rep lace(" ",  "").Replac e("-", "") )
  291                           select t ;
  292  
  293                if (full Set != nul l)
  294                {
  295                    //Gr oup by raw  data file
  296                    grou pedSet = f rom n in f ullSet
  297                                  g roup n by  n.DOD_FRAG MENT_RAW_D ATA_ID int o g
  298                                  s elect g.Or derByDesce nding(t =>  t.LAB_REP ORT_DATE). FirstOrDef ault();
  299                }
  300  
  301                return g roupedSet;
  302  
  303           }
  304  
  305           // / <summary >
  306           // / Get the  count all  fragments  for a pati ent
  307           // / </summar y>
  308           // / <param n ame="patie ntId"></pa ram>
  309           pu blic int S electFragm entsByPati entIdCount (int patie ntId)
  310           {
  311                return _ selectFrag mentsByPat ientIdCoun t;
  312           }
  313  
  314           // / <summary >
  315           // / Select D oD_Fragmen t_DETAIL b y DoD Frag ment ID
  316           // / </summar y>
  317           // / <param n ame="dodFr agmentId"> </param>
  318           // / <param n ame="sort" ></param>
  319           // / <param n ame="maxRo ws"></para m>
  320           // / <param n ame="start Row"></par am>
  321           // / <returns ></returns >
  322           pu blic IEnum erable<DOD _FRAGMENT_ DETAIL> Se lectDoDFra gmentDetai ls(int dod FragmentId , string s ort, int m axRows, in t startRow )
  323           {
  324                IEnumera ble<DOD_FR AGMENT_DET AIL> resul ts = null;
  325  
  326                using (_ db = GetDa taContext( ))
  327                {
  328                    if ( string.IsN ullOrEmpty (sort))
  329                    {
  330                         sort = "DO D_FRAGMENT _DETAIL_ID  desc";
  331                    }
  332                    if ( maxRows ==  0)
  333                    {
  334                         maxRows =  9999;
  335                    }
  336  
  337                    resu lts = Sele ctDoDFragm entDetails LinqFilter (dodFragme ntId).Orde rBy(sort). Skip(start Row).Take( maxRows).T oList();
  338                    _sel ectDoDFrag mentDetail sCount = r esults.Cou nt();
  339                }
  340                
  341                return r esults;
  342           }
  343  
  344           pr ivate IQue ryable<DOD _FRAGMENT_ DETAIL> Se lectDoDFra gmentDetai lsLinqFilt er(int dod FragmentId )
  345           {
  346                var linq Filter = f rom t in _ db.DOD_FRA GMENT_DETA ILs
  347                                  w here t.DOD _FRAGMENT_ ID == dodF ragmentId
  348                                  s elect t;
  349  
  350                return l inqFilter;
  351           }
  352           
  353           pu blic int S electDoDFr agmentDeta ilsCount(i nt dodFrag mentId)
  354           {
  355                return _ selectDoDF ragmentDet ailsCount;
  356           }
  357  
  358  
  359           // / <summary >
  360           // / Get DoD  Fragment r ecord by D oD fragmen t ID
  361           // / </summar y>
  362           // / <param n ame="dodFr agmentId"> </param>
  363           // / <returns ></returns >
  364           pu blic DOD_F RAGMENT Ge tDoDFragme ntById(int  dodFragme ntId)
  365           {
  366                using (_ db = GetDa taContext( ))
  367                {
  368                    SetL oadWithFra gment(_db) ;
  369  
  370                    retu rn (from f  in _db.DO D_FRAGMENT s
  371                             where  f.DOD_FRAG MENT_ID ==  dodFragme ntId
  372                             select  f).FirstO rDefault() ;
  373                }
  374                
  375           }
  376  
  377  
  378           // / <summary >
  379           // / Get a Do D fragment  analyte b y analyte  ID
  380           // / </summar y>
  381           // / <param n ame="analy teId"></pa ram>
  382           // / <returns ></returns >
  383           pu blic DOD_F RAGMENT_DE TAIL GetFr agmentAnal yteById(in t analyteI d)
  384           {
  385                using (_ db = GetDa taContext( ))
  386                {
  387                    SetL oadWithFra gmentDetai l(_db);
  388  
  389                    retu rn (from f  in _db.DO D_FRAGMENT _DETAILs
  390                             where  f.DOD_FRAG MENT_DETAI L_ID == an alyteId
  391                             select  f).FirstO rDefault() ;
  392                }
  393  
  394           }
  395  
  396  
  397           // / <summary >
  398           // / Get DoD  fragment l ab by ID
  399           // / </summar y>
  400           // / <param n ame="labId "></param>
  401           // / <returns ></returns >
  402           pu blic DOD_F RAGMENT_LA B GetDoDFr agmentLabB yId(int la bId)
  403           {
  404                using (_ db = GetDa taContext( ))
  405                {
  406                    SetL oadWith(_d b);
  407                    retu rn (from f  in _db.DO D_FRAGMENT _LABs
  408                             where  f.DOD_FRAG MENT_LAB_I D == labId
  409                             select  f).FirstO rDefault() ;
  410                }
  411           }
  412  
  413           // / <summary >
  414           // / Update D OD_FRAGMEN T_LAB reco rd
  415           // / </summar y>
  416           // / <param n ame="lab"> </param>
  417           // / <returns ></returns >
  418           pu blic DOD_F RAGMENT_LA B Update(D OD_FRAGMEN T_LAB lab)
  419           {
  420                using (_ db = GetDa taContext( ))
  421                {
  422                    _db. DeferredLo adingEnabl ed = false ;
  423  
  424                    lab. Synchronis eWithDataC ontext(_db ); //this  line trave rses all e ntities, a ttaching a ll of them  as approp riate to t he data co ntext.
  425  
  426                    try
  427                    {
  428                         _db.Submit Changes(Co nflictMode .ContinueO nConflict) ;
  429  
  430                    }
  431                    catc h (ChangeC onflictExc eption)
  432                    {
  433                         _db.Change Conflicts. ResolveAll (RefreshMo de.KeepCha nges);
  434                    }
  435  
  436                }
  437  
  438                return l ab;
  439           }
  440  
  441  
  442           // / <summary >
  443           // / Update D OD_FRAGMEN T record
  444           // / </summar y>
  445           // / <param n ame="lab"> </param>
  446           // / <returns ></returns >
  447           pu blic DOD_F RAGMENT Up date(DOD_F RAGMENT fr agment)
  448           {
  449                using (_ db = GetDa taContext( ))
  450                {
  451                    _db. DeferredLo adingEnabl ed = false ;
  452  
  453                    frag ment.Synch roniseWith DataContex t(_db); // this line  traverses  all entiti es, attach ing all of  them as a ppropriate  to the da ta context .
  454  
  455                    try
  456                    {
  457                         _db.Submit Changes(Co nflictMode .ContinueO nConflict) ;
  458  
  459                    }
  460                    catc h (ChangeC onflictExc eption)
  461                    {
  462                         _db.Change Conflicts. ResolveAll (RefreshMo de.KeepCha nges);
  463                    }
  464  
  465                }
  466  
  467                return f ragment;
  468           }
  469  
  470           // / <summary >
  471           // / Update D OD_FRAGMEN T_DETAIL r ecord
  472           // / </summar y>
  473           // / <param n ame="fragm entAnalyte "></param>
  474           // / <returns ></returns >
  475           pu blic DOD_F RAGMENT_DE TAIL Updat e(DOD_FRAG MENT_DETAI L fragment Analyte)
  476           {
  477                using (_ db = GetDa taContext( ))
  478                {
  479                    _db. DeferredLo adingEnabl ed = false ;
  480  
  481                    frag mentAnalyt e.Synchron iseWithDat aContext(_ db); //thi s line tra verses all  entities,  attaching  all of th em as appr opriate to  the data  context.
  482  
  483                    try
  484                    {
  485                         _db.Submit Changes(Co nflictMode .ContinueO nConflict) ;
  486  
  487                    }
  488                    catc h (ChangeC onflictExc eption)
  489                    {
  490                         _db.Change Conflicts. ResolveAll (RefreshMo de.KeepCha nges);
  491                    }
  492  
  493                }
  494  
  495                return f ragmentAna lyte;
  496           }
  497       }
  498  
  499  
  500  
  501       public  class DoD FragmentDa taExtractB yLab
  502       {
  503           pu blic strin g LabName  { get; set ; }
  504           pu blic DateT ime LastEx tractRecei vedDate {  get; set;  }
  505       }       
  506  
  507   }