23. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/7/2019 7:15:11 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.

23.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\CRS_EFR LabKitOrderManager.cs Wed May 22 19:56:18 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\CRS_EFR LabKitOrderManager.cs Mon Jun 3 13:15:34 2019 UTC

23.2 Comparison summary

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

23.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

23.4 Active regular expressions

No regular expressions were active.

23.5 Comparison detail

  1   using Syst em;
  2   using Syst em.Collect ions.Gener ic;
  3   using Syst em.Linq;
  4   using Syst em.Linq.Ex pressions;  
  5   using Syst em.Data.Li nq;
  6   using Vete ransAffair s.Registri es.Busines s;
  7   using Vete ransAffair s.Registri es.Busines sManager.U tilities;
  8   using Vete ransAffair s.Registri es.Busines sManager;
  9  
  10   namespace  CRS_EFR
  11   {
  12       public  enum StdS hipmentSta tus
  13       {
  14           Ki tLost=2,
  15           Pa tientRefus ed=3,
  16           Ot her =6
  17       }
  18  
  19       public  class Lab KitOrderMa nager : Ba seBO
  20       {
  21           //  TODO!!!
  22           pr ivate stat ic int REG ISTRY_ID =  1;
  23             private st atic strin g USER_NAM E = " DN S         \\
D NS     ";
  24  
  25           pr ivate IEnu merable<WK F_CASE_ACT IVITY> Com pletedKitO rders;
  26           pr ivate int  KitOrdersC ount;
  27           pr ivate int  NewKitOrde rsCount;
  28           pr ivate stri ng QueueDe faultSort;
  29  
  30          pub lic LabKit OrderManag er() 
  31           {
  32                _default SortField  = "Facilit y";
  33                QueueDef aultSort =  "WkfCaseI d desc";
  34           }
  35  
  36          #re gion Kit o rders grou p
  37  
  38           // / <summary >
  39           // / Gets pat ient list  for new ki t orders
  40           // / </summar y>
  41           // / <returns ></returns >
  42          pub lic List<L abKitOrder Group> Get PatientsFo rNewKitOrd ers(string  lastName,  string fa cilityId,  int startR ow, string  sort, int  maxRows)
  43           {
  44                if (stri ng.IsNullO rEmpty(sor t)) sort =  _defaultS ortField;
  45                using (_ db = GetDa taContext( ))
  46                {
  47                    SetL oadWith(_d b);
  48  
  49  
  50  
  51                    stri ng fieldSe arch = "LA ST_NAME";
  52  
  53                    var  param = Ex pression.P arameter(t ypeof(WKF_ CASE), "PA TIENT");
  54  
  55                    // e  => e.WKF_ CASE.PATIE NT.LAST_NA ME.Contain s()
  56                    var  name = Exp ression.Pr opertyOrFi eld(Expres sion.Prope rtyOrField (param, "P ATIENT"),  fieldSearc h);
  57                    var  search = E xpression. Constant(l astName, t ypeof(stri ng));
  58  
  59                    var  body = Exp ression.Ca ll(name, " Contains",  null, sea rch);
  60  
  61                    Expr ession<Fun c<WKF_CASE , bool>> l ambda;
  62                    if ( String.IsN ullOrEmpty (lastName) )
  63                    {
  64                         lambda = x  => true;
  65                    }
  66                    else
  67                    {
  68                         lambda = E xpression. Lambda<Fun c<WKF_CASE , bool>>(b ody, param );
  69                    }
  70  
  71                    List <LabKitOrd erGroup> K itOrders =  new List< LabKitOrde rGroup>();
  72                    //Ge t New orde rs. New or ders do no t have lab  kit order  activity  in activit y table. B ut display  patients  who bypass ed kit ord ers and we nt on with  the later  steps? (l ook at let ..) 
  73                    IEnu merable<WK F_CASE> Ca ses = (fro m t in _db .WKF_CASEs .Where(lam bda)
  74                                    let orders Placed = ( from r in  _db.WKF_CA SE_ACTIVIT ies where   r.STD_WKF ACTIVITYTY PE_ID == C onvert.ToI nt16(WorkF lowActivit yTypes.Lab Kit) selec t r.WKF_CA SE_ID).Dis tinct().To Array()
  75                                    where !(or dersPlaced .Contains( t.WKF_CASE _ID))
  76                                    && t.STD_W KFCASESTS_ ID == Conv ert.ToInt1 6(WorkFlow CaseStatus .InProcess ) // TODO  - If statu s is new,  there shou ld not be  any activi ty in wkfa ctivity. S o for orde rsPlaced l ist, add I nProcess
  77                                    && t.REFER RAL.STD_RE FERRALSTS_ ID == Conv ert.ToInt1 6(Referral Status.InP rocess)
  78                                    && (t.STD_ WKFCASETYP E_ID == Co nvert.ToIn t16(WorkFl owTypes.Bi omonitorin g) || t.ST D_WKFCASET YPE_ID ==  Convert.To Int16(Work FlowTypes. FragmentAn alysis)) s elect t).T oList();
  79  
  80                    if ( !string.Is NullOrEmpt y(facility Id))
  81                    {
  82                         int instit utionId =  0;
  83                         if (int.Tr yParse(fac ilityId, o ut institu tionId))
  84                         {
  85                             if (in stitutionI d > 0)
  86                             {
  87                                 Ca ses = (fro m c in Cas es
  88                                           whe re c.REFER RAL.STD_IN STITUTION_ ID == inst itutionId
  89                                           sel ect c);
  90                             }
  91                         }
  92                    }
  93  
  94                    Look up<string,  string> F irstLookUp s = (Looku p<string,  string>)Ca ses.ToLook up(p => p. REFERRAL.S TD_INSTITU TION_ID +  "%" + p.RE FERRAL.STD _INSTITUTI ON.NAME +  "%" + p.ST D_WKFCASET YPE.ID + " %" + p.STD _WKFCASETY PE.CODE +  "%" + p.RE FERRAL.STD _INSTITUTI ON.STATION NUMBER, p  => p.REFER RAL.PATIEN T.FullName  + " - Wor kflow ID:  " + p.WKF_ CASE_ID);
  95  
  96                    fore ach (IGrou ping<strin g, string>  FirstLook Up in Firs tLookUps)
  97                    {
  98                         string[] G roupings =  FirstLook Up.Key.Spl it(new Cha r[] { '%'  });
  99                         LabKitOrde rGroup Sin gleOrder =  new LabKi tOrderGrou p { Instit utionId =  Convert.To Int32(Grou pings[0]),  StationNu mber = Gro upings[4]  ,Facility  = Grouping s[1], KitT ypeID = Co nvert.ToIn t32(Groupi ngs[2]), K itTypeCd =  Groupings [3], Order Type = 0 } ;
  100                         SingleOrde r.Patient  = FirstLoo kUp.Select (e => e).T oList();
  101                         KitOrders. Add(Single Order);
  102                         SingleOrde r.Count =  SingleOrde r.Patient. Count();
  103                    }
  104                    IEnu merable<La bKitOrderG roup> Orde rByList =  KitOrders;
  105                    KitO rdersCount  = OrderBy List.Count ();
  106                    retu rn OrderBy List.Order By(sort).S kip(startR ow).Take(m axRows).To List();
  107                }
  108           }
  109          pub lic int Ge tKitsCount (string la stName, st ring facil ityId)
  110          {
  111               return Ki tOrdersCou nt;
  112          }
  113  
  114          pub lic int Ge tPatientsF orNewKitOr ders(strin g lastName , string f acilityId)
  115          {
  116               return Ki tOrdersCou nt;
  117          }
  118  
  119           #e ndregion
  120  
  121          #re gion Updat es
  122  
  123          pub lic void I nsertActiv ities(List <WKF_CASE_ ACTIVITY>  activities )
  124           {
  125                using(_d b=GetDataC ontext())
  126                {
  127                    _db. WKF_CASE_A CTIVITies. InsertAllO nSubmit<WK F_CASE_ACT IVITY>(act ivities);
  128                    _db. SubmitChan ges();
  129                }
  130           }
  131  
  132          pub lic void U pdateActiv ities(List <WKF_CASE_ ACTIVITY>  activities )
  133          {
  134               using (_d b = GetDat aContext() )
  135               {
  136                   _db.W KF_CASE_AC TIVITies.A ttachAll(a ctivities, true);
  137                   try
  138                   {
  139                       _ db.SubmitC hanges(Con flictMode. ContinueOn Conflict);
  140                   }
  141                   catch
  142                   {
  143                       _ db.ChangeC onflicts.R esolveAll( RefreshMod e.KeepChan ges);
  144                   }
  145               }
  146          }
  147          
  148          pub lic void U pdateKitAc tivity(WKF _CASE wCas e, Func<bo ol> checkD ups)
  149          {
  150               //Initiat e New acti vity for Q uestionnai re
  151               if (wCase .WKF_CASE_ ACTIVITies [0].SHIPPI NG_DETAILs  != null)
  152                   if (w Case.WKF_C ASE_ACTIVI Ties[0].SH IPPING_DET AILs[0].SU RVEY_RECEI VED_FLAG = = true &&  !ActivityE xists(wCas e.WKF_CASE _ID, WorkF lowActivit yTypes.Que stionnaire ) && check Dups())
  153                       I nitiateAct ivity(wCas e, WorkFlo wActivityT ypes.Quest ionnaire);
  154               //Initiat e New acti vity for L ab order
  155               if (wCase .WKF_CASE_ ACTIVITies [0].SHIPPI NG_DETAILs  != null)
  156                   if (w Case.WKF_C ASE_ACTIVI Ties[0].SH IPPING_DET AILs[0].RE CEIVED_DAT E != null  && !Activi tyExists(w Case.WKF_C ASE_ID, Wo rkFlowActi vityTypes. LabOrder)  && checkDu ps())
  157                       I nitiateAct ivity(wCas e, WorkFlo wActivityT ypes.LabOr der);
  158               
  159               using (_d b = GetDat aContext() )
  160               {
  161                   _db.D eferredLoa dingEnable d = false;
  162                   wCase .Synchroni seWithData Context(_d b, true);
  163                   try
  164                   {
  165                       _ db.SubmitC hanges();
  166  
  167                       / /create an  instance  of the cus tom eventA rgs in ord er to popu late the i d selected
  168                       B OSaveSucce ssEventArg s eventArg s = new BO SaveSucces sEventArgs ();
  169                       e ventArgs.S avedItemId  = wCase.W KF_CASE_ID ;
  170  
  171                       R aiseSaveEv ent(this,  eventArgs) ;
  172                   }
  173                   catch  (ChangeCo nflictExce ption)
  174                   {
  175                       _ db.ChangeC onflicts.R esolveAll( RefreshMod e.KeepChan ges);
  176                   }
  177               }
  178          }
  179  
  180          pri vate void  InitiateAc tivity(WKF _CASE wcas e, WorkFlo wActivityT ypes type)
  181          {
  182               WKF_CASE_ ACTIVITY A ctivity =  wcase.WKF_ CASE_ACTIV ITies[0];
  183               WKF_CASE_ ACTIVITY N ewActivity  = new WKF _CASE_ACTI VITY();
  184               //NewActi vity.WKF_C ASE_ID = A ctivity.WK F_CASE_ID;
  185               NewActivi ty.WKF_CAS E_ID = wca se.WKF_CAS E_ID; 
  186               NewActivi ty.STD_WKF ACTIVITYTY PE_ID = Co nvert.ToIn t16(type);
  187               NewActivi ty.STD_WKF ACTIVITYST S_ID = Con vert.ToInt 16(Workflo wCaseActiv ityStatus. New);
  188               NewActivi ty.REPRESE NTATIVE_NA ME = Activ ity.REPRES ENTATIVE_N AME;
  189               NewActivi ty.CONTACT _NAME = Ac tivity.CON TACT_NAME;
  190               wcase.WKF _CASE_ACTI VITies.Add (NewActivi ty);
  191               NewActivi ty.SetAsCh angeTracki ngRoot(Ent ityState.N ew, true);
  192               NewActivi ty.SetAsIn sertOnSubm it();
  193          }
  194  
  195          #en dregion
  196  
  197          #re gion Retri eve Kit or ders and d etails
  198          pri vate void  SetLoadWit h(Registri esDataAcce ss db)
  199          {
  200               DataLoadO ptions lo  = new Data LoadOption s();
  201               lo.LoadWi th<REFERRA L>(e => e. PATIENT);
  202               lo.LoadWi th<REFERRA L>(e => e. STD_INSTIT UTION);
  203               lo.LoadWi th<WKF_CAS E>(e => e. STD_WKFCAS ETYPE);
  204               //lo.Load With<WKF_C ASE>(e =>  e.WKF_CASE _ACTIVITie s);
  205               lo.LoadWi th<WKF_CAS E>(e => e. REFERRAL);
  206               db.LoadOp tions = lo ;
  207               db.Deferr edLoadingE nabled = f alse;
  208  
  209          }
  210  
  211          pri vate void  SetLoadWit hActivitie s(Registri esDataAcce ss db, boo l addShipp ing)
  212          {
  213               DataLoadO ptions lo  = new Data LoadOption s();
  214               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.W KF_CASE);
  215               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.S TD_WKFACTI VITYTYPE);
  216               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.S TD_WKFACTI VITYST);
  217               lo.LoadWi th<WKF_CAS E>(e => e. REFERRAL);
  218               lo.LoadWi th<WKF_CAS E>(e => e. STD_WKFCAS ETYPE);
  219               lo.LoadWi th<REFERRA L>(e => e. PATIENT);
  220               lo.LoadWi th<REFERRA L>(e => e. STD_INSTIT UTION);
  221               if (addSh ipping)
  222               {
  223                   lo.Lo adWith<WKF _CASE_ACTI VITY>(e =>  e.SHIPPIN G_DETAILs) ;
  224                   lo.Lo adWith<SHI PPING_DETA IL>(e => e .STD_SHIPM ENTST);
  225               }
  226               db.LoadOp tions = lo ;
  227               db.Deferr edLoadingE nabled = f alse;
  228  
  229          }
  230  
  231          pub lic List<L abKitOrder PatientsBO > GetNewLa bKitOrders (int instI d, int kit TypeId, in t startRow , string s ort, int m axRows)
  232          {
  233               if (strin g.IsNullOr Empty(sort )) sort =  "WkfCaseId  desc";
  234  
  235               CityState Manager ad dressManag er = new C ityStateMa nager();
  236  
  237               using (_d b = GetDat aContext() )
  238               {
  239                   SetLo adWith(_db );
  240  
  241                   List< WKF_CASE>  cases = (f rom t in _ db.WKF_CAS Es
  242                                             l et ordersP laced = (f rom r in _ db.WKF_CAS E_ACTIVITi es
  243                                                                   w here r.STD _WKFACTIVI TYTYPE_ID  == Convert .ToInt16(W orkFlowAct ivityTypes .LabKit)
  244                                                                   s elect r.WK F_CASE_ID) .Distinct( ).ToArray( )
  245                                             w here !(ord ersPlaced. Contains(t .WKF_CASE_ ID))
  246                                                  && t.ST D_WKFCASES TS_ID == C onvert.ToI nt16(WorkF lowCaseSta tus.InProc ess)
  247                                                  && t.RE FERRAL.STD _INSTITUTI ON_ID == i nstId
  248                                                  && t.RE FERRAL.STD _REFERRALS TS_ID == C onvert.ToI nt16(Refer ralStatus. InProcess)
  249                                                  && t.ST D_WKFCASET YPE_ID ==  kitTypeId
  250                                             s elect t).T oList();
  251  
  252                   List< LabKitOrde rPatientsB O> NewLabK itOrders =  new List< LabKitOrde rPatientsB O>();
  253                   forea ch (WKF_CA SE item in  cases)
  254                   {
  255                       L abKitOrder PatientsBO  labOrderK it = new L abKitOrder PatientsBO ();
  256  
  257                       l abOrderKit .WkfCaseId  = item.WK F_CASE_ID;
  258                       l abOrderKit .County =  item.REFER RAL.COUNTY ;
  259                       l abOrderKit .VAMCConta ctNm = ite m.REFERRAL .VAMC_CONT ACT_NAME;
  260                       l abOrderKit .VAMCConta ctPh = ite m.REFERRAL .VAMC_CONT ACT_PHONE;
  261                       l abOrderKit .KitOrdere dDate = Da teTime.Tod ay;
  262                       l abOrderKit .PatientNa me = item. REFERRAL.P ATIENT.Ful lName;
  263                       l abOrderKit .ZipPlus4  = item.REF ERRAL.ZIP_ PLUS_4;
  264                       l abOrderKit .TEFSCRep  = USER_NAM E;
  265                       l abOrderKit .KitType =  item.STD_ WKFCASETYP E.CODE;
  266                       l abOrderKit .InstName  = item.REF ERRAL.STD_ INSTITUTIO N.NAME;
  267  
  268                       i f (!string .IsNullOrE mpty(item. REFERRAL.A DDRESS_LIN E1))
  269                       {
  270                            labOrde rKit.Addre ssLine1 =  item.REFER RAL.ADDRES S_LINE1;
  271                            labOrde rKit.Addre ssLine2 =  item.REFER RAL.ADDRES S_LINE2;
  272                            labOrde rKit.Addre ssLine3 =  item.REFER RAL.ADDRES S_LINE3;
  273                            labOrde rKit.City  = item.REF ERRAL.CITY ;
  274                            labOrde rKit.State  = item.RE FERRAL.STA TE;
  275                            labOrde rKit.Posta lCode = it em.REFERRA L.POSTAL_C ODE;
  276                            labOrde rKit.Count ry = item. REFERRAL.C OUNTRY;
  277                       }
  278                       e lse if (it em.REFERRA L.STD_INST ITUTION !=  null)
  279                       {
  280  
  281                            if (str ing.IsNull OrEmpty(it em.REFERRA L.STD_INST ITUTION.MA ILINGADDRE SSLINE1))
  282                            {
  283                                lab OrderKit.A ddressLine 1 = item.R EFERRAL.ST D_INSTITUT ION.STREET ADDRESSLIN E1;
  284                                lab OrderKit.A ddressLine 2 = item.R EFERRAL.ST D_INSTITUT ION.STREET ADDRESSLIN E2;
  285                                lab OrderKit.A ddressLine 3 = item.R EFERRAL.ST D_INSTITUT ION.STREET ADDRESSLIN E3;
  286                                lab OrderKit.C ity = item .REFERRAL. STD_INSTIT UTION.STRE ETCITY;
  287                                lab OrderKit.P ostalCode  = item.REF ERRAL.STD_ INSTITUTIO N.STREETPO STALCODE;
  288                                if  (item.REFE RRAL.STD_I NSTITUTION .STREETSTA TE_ID.HasV alue)
  289                                {
  290                                     labOrderK it.State =  addressMa nager.GetS tateByID(
  291                                         (int) item.REFER RAL.STD_IN STITUTION. STREETSTAT E_ID);
  292                                }
  293                                if  (item.REFE RRAL.STD_I NSTITUTION .STREETCOU NTRY_ID.Ha sValue)
  294                                {
  295                                     labOrderK it.Country  = address Manager.Ge tCountryBy ID(
  296                                         (int) item.REFER RAL.STD_IN STITUTION. STREETCOUN TRY_ID);
  297                                }
  298                            }
  299                            else
  300                            {
  301                                lab OrderKit.A ddressLine 1 = item.R EFERRAL.ST D_INSTITUT ION.MAILIN GADDRESSLI NE1;
  302                                lab OrderKit.A ddressLine 2 = item.R EFERRAL.ST D_INSTITUT ION.MAILIN GADDRESSLI NE2;
  303                                lab OrderKit.A ddressLine 3 = item.R EFERRAL.ST D_INSTITUT ION.MAILIN GADDRESSLI NE3;
  304                                lab OrderKit.C ity = item .REFERRAL. STD_INSTIT UTION.MAIL INGCITY;
  305                                lab OrderKit.P ostalCode  = item.REF ERRAL.STD_ INSTITUTIO N.MAILINGP OSTALCODE;
  306                                if  (item.REFE RRAL.STD_I NSTITUTION .MAILINGST ATE_ID.Has Value)
  307                                {
  308                                     labOrderK it.State =  addressMa nager.GetS tateByID(
  309                                         (int) item.REFER RAL.STD_IN STITUTION. MAILINGSTA TE_ID);
  310                                }
  311                                if  (item.REFE RRAL.STD_I NSTITUTION .MAILINGCO UNTRY_ID.H asValue)
  312                                {
  313                                     labOrderK it.Country  = address Manager.Ge tCountryBy ID(
  314                                         (int) item.REFER RAL.STD_IN STITUTION. MAILINGCOU NTRY_ID);
  315                                }
  316                            }
  317                       }
  318  
  319                       N ewLabKitOr ders.Add(l abOrderKit );
  320                   }
  321  
  322                   NewKi tOrdersCou nt = NewLa bKitOrders .Count();
  323                   retur n NewLabKi tOrders.Sk ip(startRo w).Take(ma xRows).ToL ist();
  324               }
  325          }
  326  
  327          pub lic int Ge tNewLabKit OrdersCoun t(int inst Id, int ki tTypeId)
  328          {
  329               return Ne wKitOrders Count;
  330          }
  331          pub lic IEnume rable<WKF_ CASE_ACTIV ITY> GetCo mpletedLab KitOrdersG raph()
  332          {
  333               return Co mpletedKit Orders;
  334          }
  335  
  336          pub lic List<L abKitOrder PatientsBO > GetCompl etedLabKit Orders(int  instId, i nt kitType Id)
  337          {
  338               using (_d b = GetDat aContext() )
  339               {
  340                   SetLo adWith(_db );
  341                   IQuer yable<WKF_ CASE_ACTIV ITY> LinqA ctivities  = (from a  in _db.WKF _CASE_ACTI VITies
  342                                                                        where a .WKF_CASE. REFERRAL.S TD_INSTITU TION_ID ==  instId
  343                                                                        && a.WK F_CASE.STD _WKFCASETY PE_ID == k itTypeId / /Below fil ters appli ed in the  list scree n and does  not chang e - TODO
  344                                                                        //&& a. WKF_CASE.S TD_WKFCASE STS_ID ==  Convert.To Int16(Work FlowCaseSt atus.InPro cess)
  345                                                                        //&& a. WKF_CASE.R EFERRAL.ST D_REFERRAL STS_ID ==  Convert.To Int16(Refe rralStatus .InProcess )
  346                                                                        select  a);
  347                   Compl etedKitOrd ers = Linq Activities .ToList();
  348  
  349                   CityS tateManage r addressM anager = n ew CitySta teManager( );
  350                   forea ch (WKF_CA SE_ACTIVIT Y activity  in LinqAc tivities)
  351                   {
  352                       i f (string. IsNullOrEm pty(activi ty.ADDRESS _LINE1))
  353                       {
  354                            if (act ivity.WKF_ CASE.REFER RAL.STD_IN STITUTION  !=null)
  355                            {
  356                                if  (string.Is NullOrEmpt y(activity .WKF_CASE. REFERRAL.S TD_INSTITU TION.MAILI NGADDRESSL INE1))
  357                                {
  358                                     activity. ADDRESS_LI NE1 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.S TREETADDRE SSLINE1;
  359                                     activity. ADDRESS_LI NE2 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.S TREETADDRE SSLINE2;
  360                                     activity. ADDRESS_LI NE3 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.S TREETADDRE SSLINE3;
  361                                     activity. CITY = act ivity.WKF_ CASE.REFER RAL.STD_IN STITUTION. STREETCITY ;
  362                                     activity. ZIP_PLUS_4  = activit y.WKF_CASE .REFERRAL. STD_INSTIT UTION.STRE ETPOSTALCO DE;
  363                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.ST REETSTATE_ ID.HasValu e)
  364                                          acti vity.STATE  = address Manager.Ge tStateByID ((int)acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.S TREETSTATE _ID);
  365                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.ST REETCOUNTR Y_ID.HasVa lue)
  366                                          acti vity.COUNT RY = addre ssManager. GetCountry ByID((int) activity.W KF_CASE.RE FERRAL.STD _INSTITUTI ON.STREETC OUNTRY_ID) ;
  367                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.ST REETCOUNTY _ID.HasVal ue)
  368                                          acti vity.COUNT Y = addres sManager.G etCountyBy ID((int)ac tivity.WKF _CASE.REFE RRAL.STD_I NSTITUTION .STREETCOU NTY_ID);
  369                                }
  370                                els e
  371                                {
  372                                     activity. ADDRESS_LI NE1 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.M AILINGADDR ESSLINE1;
  373                                     activity. ADDRESS_LI NE2 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.M AILINGADDR ESSLINE2;
  374                                     activity. ADDRESS_LI NE3 = acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.M AILINGADDR ESSLINE3;
  375                                     activity. CITY = act ivity.WKF_ CASE.REFER RAL.STD_IN STITUTION. MAILINGCIT Y;
  376                                     activity. ZIP_PLUS_4  = activit y.WKF_CASE .REFERRAL. STD_INSTIT UTION.MAIL INGPOSTALC ODE;
  377                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.MA ILINGSTATE _ID.HasVal ue)
  378                                          acti vity.STATE  = address Manager.Ge tStateByID ((int)acti vity.WKF_C ASE.REFERR AL.STD_INS TITUTION.M AILINGSTAT E_ID);
  379                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.MA ILINGCOUNT RY_ID.HasV alue)
  380                                          acti vity.COUNT RY = addre ssManager. GetCountry ByID((int) activity.W KF_CASE.RE FERRAL.STD _INSTITUTI ON.MAILING COUNTRY_ID );
  381                                     if (activ ity.WKF_CA SE.REFERRA L.STD_INST ITUTION.MA ILINGCOUNT Y_ID.HasVa lue)
  382                                          acti vity.COUNT Y = addres sManager.G etCountyBy ID((int)ac tivity.WKF _CASE.REFE RRAL.STD_I NSTITUTION .MAILINGCO UNTY_ID);
  383                               }
  384                            }
  385                       }
  386                   }
  387  
  388                   retur n (from a  in LinqAct ivities
  389                            select  new LabKit OrderPatie ntsBO
  390                            {
  391                                Wkf CaseId = a .WKF_CASE_ ID,
  392                                Add ressLine1  = a.ADDRES S_LINE1,
  393                                Add ressLine2  = a.ADDRES S_LINE2,
  394                                Add ressLine3  = a.ADDRES S_LINE3,
  395                                Cit y = a.CITY ,
  396                                Cou ntry = a.C OUNTRY,
  397                                Cou nty = a.CO UNTY,
  398                                VAM CContactNm  = a.CONTA CT_NAME,
  399                                //K itOrderdDa te = a.KIT _ORDER_DAT E,
  400                                Kit OrderedDat e =  a.KIT _ORDER_DAT E,                             
  401                                Pat ientName =  a.WKF_CAS E.REFERRAL .PATIENT.F ullName,
  402                                Pos talCode =  a.POSTAL_C ODE,
  403                                Sta te = a.STA TE,
  404                                Zip Plus4 = a. ZIP_PLUS_4 ,
  405                                TEF SCRep = a. REPRESENTA TIVE_NAME,
  406                                VAM CContactPh  = a.CONTA CT_PHONE,
  407                                Kit Type = a.W KF_CASE.ST D_WKFCASET YPE.CODE,
  408                                Ins tName = a. WKF_CASE.R EFERRAL.ST D_INSTITUT ION.NAME
  409                            }).ToLi st();
  410  
  411               }
  412          }
  413  
  414          pri vate IQuer yable<WKF_ CASE_ACTIV ITY> GetLi nqInProces sKitOrders (string la stName, st ring facil ityId, Reg istriesDat aAccess db , bool inc ludeShipDe tails)
  415          {
  416               SetLoadWi thActiviti es(db, inc ludeShipDe tails);
  417  
  418               string fi eldSearch  = "LAST_NA ME";
  419  
  420               var param  = Express ion.Parame ter(typeof (WKF_CASE_ ACTIVITY),  "PATIENT" );
  421  
  422               // e => e .WKF_CASE. PATIENT.LA ST_NAME.Co ntains()
  423               var name  = Expressi on.Propert yOrField(E xpression. PropertyOr Field(Expr ession.Pro pertyOrFie ld(param,  "WKF_CASE" ), "PATIEN T"), field Search);
  424               var searc h = Expres sion.Const ant(lastNa me, typeof (string));
  425  
  426               var body  = Expressi on.Call(na me, "Conta ins", null , search);
  427  
  428               Expressio n<Func<WKF _CASE_ACTI VITY, bool >> lambda;
  429               if (Strin g.IsNullOr Empty(last Name))
  430               {
  431                   lambd a = x => t rue;
  432               }
  433               else
  434               {
  435                   lambd a = Expres sion.Lambd a<Func<WKF _CASE_ACTI VITY, bool >>(body, p aram);
  436               }
  437  
  438               IQueryabl e<WKF_CASE _ACTIVITY>  kitOrders  = (from a  in _db.WK F_CASE_ACT IVITies.Wh ere(lambda )
  439                       w here (a.WK F_CASE.STD _WKFCASETY PE_ID == C onvert.ToI nt16(WorkF lowTypes.B iomonitori ng)
  440                       | | a.WKF_CA SE.STD_WKF CASETYPE_I D == Conve rt.ToInt16 (WorkFlowT ypes.Fragm entAnalysi s))
  441                       & & a.WKF_CA SE.REFERRA L.STD_REGI STRY_ID ==  REGISTRY_ ID
  442                       & & a.STD_WK FACTIVITYT YPE_ID ==  Convert.To Int16(Work FlowActivi tyTypes.La bKit)
  443                       s elect a);
  444  
  445               if (!stri ng.IsNullO rEmpty(fac ilityId))
  446               {
  447                   int i nstitution Id = 0;
  448                   if (i nt.TryPars e(facility Id, out in stitutionI d))
  449                   {
  450                       i f (institu tionId > 0 )
  451                       {
  452                            kitOrde rs = (from  c in kitO rders
  453                                      where c. WKF_CASE.R EFERRAL.ST D_INSTITUT ION_ID ==  institutio nId
  454                                      select c );
  455                       }
  456                   }
  457               }
  458               
  459               return ki tOrders;
  460          }
  461  
  462           // / <summary >
  463           // / Get all  the comple ted kit or ders (Kit  orders sen t and wait ing for th em to be r eturned to  TEFSC.)
  464           // / </summar y>
  465          ///  <returns> WKF_CASE_A CTIVITY</r eturns>
  466          pub lic IEnume rable<LabI nProcessKi tDetails>  GetOrdered KitOrders( string las tName, str ing facili tyId, int  maxRows, i nt startRo w, string  sort)
  467          {
  468               if (strin g.IsNullOr Empty(sort )) sort =  QueueDefau ltSort;
  469               using (_d b = GetDat aContext() )
  470               {
  471                   IEnum erable<Lab InProcessK itDetails>
  472                       O rderedKitO rders = (f rom t in G etLinqInPr ocessKitOr ders(lastN ame, facil ityId, _db , false)
  473                                             w here t.STD _WKFACTIVI TYSTS_ID = = 4
  474                                             s elect new  LabInProce ssKitDetai ls
  475                                             {
  476                                                  Activit yId = t.WK F_CASE_ACT IVITY_ID,
  477                                                  WkfCase Id = t.WKF _CASE_ID,
  478                                                  FromSto ck = t.KIT _USE_STOCK _FLAG != n ull ? (boo l)t.KIT_US E_STOCK_FL AG : false ,
  479                                                  Patient Name = t.W KF_CASE.RE FERRAL.PAT IENT.FullN ame,
  480                                                  InstNam e = t.WKF_ CASE.REFER RAL.STD_IN STITUTION. NAME,
  481                                                  Station Number = t .WKF_CASE. REFERRAL.S TD_INSTITU TION.STATI ONNUMBER,
  482                                                  //City  = t.CITY,
  483                                                  City =  t.CITY !=  null ? t.C ITY : (t.W KF_CASE.RE FERRAL.STD _INSTITUTI ON.MAILING CITY != nu ll ? t.WKF _CASE.REFE RRAL.STD_I NSTITUTION .MAILINGCI TY : t.WKF _CASE.REFE RRAL.STD_I NSTITUTION .STREETCIT Y),
  484                                                  VAMCCon tactNm = t .CONTACT_N AME,
  485                                                  KitType  = t.WKF_C ASE.STD_WK FCASETYPE. CODE,
  486                                                  //KitOr derdDate =  t.CREATED ,
  487                                                  KitOrde redDate =  t.KIT_ORDE R_DATE, 
  488                                                  Receive dDate = t. RECEIVED_D ATE,
  489                                                  Status  = t.STD_WK FACTIVITYS T.NAME
  490                                             } ).OrderBy( sort).Skip (startRow) .Take(maxR ows).ToLis t();
  491  
  492  
  493  
  494                   retur n OrderedK itOrders.D istinct(ne w Workflow CaseActivi tyComparer ());
  495               }
  496          }
  497  
  498          pub lic int Ge tOrderedKi tOrdersCou nt(string  lastName,  string fac ilityId)
  499          {
  500               using (_d b = GetDat aContext() )
  501               {
  502                   retur n  (from t  in GetLin qInProcess KitOrders( lastName,  facilityId , _db, fal se)
  503                                       where t .STD_WKFAC TIVITYSTS_ ID == 4
  504                                       select  t).Count() ;
  505               }
  506          }
  507          pub lic IEnume rable<WKF_ CASE_ACTIV ITY> GetOr deredKitOr ders(strin g lastName , string f acilityId)
  508          {
  509               using (_d b = GetDat aContext() )
  510               {
  511                   retur n (from t  in GetLinq InProcessK itOrders(l astName, f acilityId, _db, false )
  512                            let shi ps = (from  s in _db. SHIPPING_D ETAILs whe re (s.RECE IVED_DATE  != null ||  s.STD_SHI PMENTSTS_I D != null)  select s. WKF_CASE_A CTIVITY_ID ).Distinct ().ToArray ()
  513                            where ! (ships.Con tains(t.WK F_CASE_ACT IVITY_ID))
  514                            //order by t.WKF_C ASE.REFERR AL.STD_INS TITUTION.N AME, t.CIT Y, t.CONTA CT_NAME, t .WKF_CASE. STD_WKFCAS ETYPE.CODE  descendin g
  515                            //order by t.WKF_C ASE.WKF_CA SE_ID desc ending
  516                            select  t).OrderBy ("WKF_CASE _ID").ToLi st();
  517               }
  518          }
  519  
  520          pri vate IQuer yable<WKF_ CASE_ACTIV ITY> GetLi nqLabKitsR eturned(st ring lastN ame, strin g facility Id, Regist riesDataAc cess db)
  521          {
  522                   IQuer yable<WKF_ CASE_ACTIV ITY> LinqQ ry = GetLi nqInProces sKitOrders (lastName,  facilityI d, db, tru e);
  523                   retur n (from a  in LinqQry  
  524                            where a .STD_WKFAC TIVITYSTS_ ID == 5
  525                            select  a);
  526          }
  527  
  528          pri vate IQuer yable<WKF_ CASE_ACTIV ITY> GetLi nqLabKitsC anceled(st ring lastN ame, strin g facility Id, Regist riesDataAc cess db)
  529          {
  530               IQueryabl e<WKF_CASE _ACTIVITY>  LinqQry =  GetLinqIn ProcessKit Orders(las tName, fac ilityId, d b, true);
  531               return  ( from a in  LinqQry
  532                       w here a.STD _WKFACTIVI TYSTS_ID = = 3
  533                       s elect a);
  534  
  535          }
  536           // / <summary >
  537           // / Gets all  the lab k its return ed from pa tients.
  538           // / </summar y>
  539          ///  <returns> WKF_CASE_A CTIVITY</r eturns>
  540          pub lic IEnume rable<LabI nProcessKi tDetails>  GetLabKits Returned(s tring last Name, stri ng facilit yId, strin g sort, in t maxRows,  int start Row)
  541          {
  542               if (strin g.IsNullOr Empty(sort )) sort =  QueueDefau ltSort;
  543               using (_d b = GetDat aContext() )
  544               {
  545                   IEnum erable<Lab InProcessK itDetails>  LabKitsRe turned = 
  546                       ( from t in  GetLinqLab KitsReturn ed(lastNam e, facilit yId, _db)
  547                             select  new LabIn ProcessKit Details
  548                             {
  549                                 Ac tivityId =  t.WKF_CAS E_ACTIVITY _ID,
  550                                 Wk fCaseId =  t.WKF_CASE _ID,
  551                                 Fr omStock =  t.KIT_USE_ STOCK_FLAG  != null ?  (bool)t.K IT_USE_STO CK_FLAG :  false,
  552                                 Pa tientName  = t.WKF_CA SE.REFERRA L.PATIENT. FullName,
  553                                 In stName = t .WKF_CASE. REFERRAL.S TD_INSTITU TION.NAME,
  554                                 St ationNumbe r = t.WKF_ CASE.REFER RAL.STD_IN STITUTION. STATIONNUM BER,
  555                                 Ci ty = t.CIT Y,
  556                                 VA MCContactN m = t.CONT ACT_NAME,
  557                                 Ki tType = t. WKF_CASE.S TD_WKFCASE TYPE.CODE,
  558                                 // KitOrderdD ate = t.CR EATED,
  559                                 Ki tOrderedDa te = t.KIT _ORDER_DAT E, 
  560                                 Re ceivedDate  = t.RECEI VED_DATE,
  561                                 St atus = t.S TD_WKFACTI VITYST.NAM E
  562                             }).Ord erBy(sort) .Skip(star tRow).Take (maxRows). ToList();
  563  
  564                   retur n LabKitsR eturned; 
  565               }
  566          }
  567  
  568          pub lic int Ge tLabKitsRe turnedCoun t(string l astName, s tring faci lityId)
  569          {
  570               using (_d b = GetDat aContext() )
  571               {
  572                   retur n (from t  in GetLinq LabKitsRet urned(last Name, faci lityId, _d b)
  573                                       select  t).Count() ;
  574               }
  575          }
  576  
  577          ///  <summary>
  578          ///  Gets all  the lab ki ts cncelle d by patie nts.
  579          ///  </summary >
  580          ///  <returns> WKF_CASE_A CTIVITY</r eturns>
  581          pub lic IEnume rable<LabI nProcessKi tDetails>  GetLabKits Canceled(s tring last Name, stri ng facilit yId, strin g sort, in t maxRows,  int start Row)
  582          {
  583               if (strin g.IsNullOr Empty(sort )) sort =  QueueDefau ltSort;
  584               using (_d b = GetDat aContext() )
  585               {
  586                   IEnum erable<Lab InProcessK itDetails>  LabKitsCa nceled = 
  587                       ( from t in  GetLinqLab KitsCancel ed(lastNam e, facilit yId, _db)
  588                              selec t new LabI nProcessKi tDetails
  589                              {
  590                                  A ctivityId  = t.WKF_CA SE_ACTIVIT Y_ID,
  591                                  W kfCaseId =  t.WKF_CAS E_ID,
  592                                  F romStock =  t.KIT_USE _STOCK_FLA G != null  ? (bool)t. KIT_USE_ST OCK_FLAG :  false,
  593                                  P atientName  = t.WKF_C ASE.REFERR AL.PATIENT .FullName,
  594                                  I nstName =  t.WKF_CASE .REFERRAL. STD_INSTIT UTION.NAME ,
  595                                  S tationNumb er = t.WKF _CASE.REFE RRAL.STD_I NSTITUTION .STATIONNU MBER,
  596                                  C ity = t.CI TY,
  597                                  V AMCContact Nm = t.CON TACT_NAME,
  598                                  K itType = t .WKF_CASE. STD_WKFCAS ETYPE.CODE ,
  599                                  / /KitOrderd Date = t.C REATED,
  600                                  K itOrderedD ate = t.KI T_ORDER_DA TE, 
  601                                  R eceivedDat e = t.RECE IVED_DATE,
  602                                  S tatus = t. STD_WKFACT IVITYST.NA ME
  603                              }).Or derBy(sort ).Skip(sta rtRow).Tak e(maxRows) .ToList();
  604  
  605                   retur n LabKitsC anceled; 
  606               }
  607          }
  608  
  609          pub lic int Ge tLabKitsCa nceledCoun t(string l astName, s tring faci lityId)
  610          {
  611               using (_d b = GetDat aContext() )
  612               {
  613                   retur n (from t  in GetLinq LabKitsCan celed(last Name, faci lityId, _d b)
  614                                       select  t).Count() ;
  615               }
  616          }
  617  
  618          pri vate void  SetLoadWit hForInitia lizeOtherA ctivities( Registries DataAccess  db, int a ctivityId)
  619          {
  620               DataLoadO ptions lo  = new Data LoadOption s();
  621  
  622               lo.LoadWi th<WKF_CAS E>(e => e. REFERRAL);
  623               lo.LoadWi th<WKF_CAS E>(e => e. STD_WKFCAS ETYPE);
  624               lo.LoadWi th<REFERRA L>(e => e. PATIENT);
  625               lo.LoadWi th<REFERRA L>(e => e. STD_INSTIT UTION);
  626               lo.LoadWi th<WKF_CAS E>(e => e. WKF_CASE_A CTIVITies) ;
  627               lo.Associ ateWith<WK F_CASE>(e  => e.WKF_C ASE_ACTIVI Ties.Where (a => a.WK F_CASE_ACT IVITY_ID = = activity Id));
  628               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.S TD_WKFACTI VITYTYPE);
  629               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.S TD_WKFACTI VITYST);
  630               lo.LoadWi th<WKF_CAS E_ACTIVITY >(e => e.S HIPPING_DE TAILs);
  631               lo.Associ ateWith<WK F_CASE_ACT IVITY>(e = > e.SHIPPI NG_DETAILs .Where(s=> s.WKF_CASE _ACTIVITY_ ID==activi tyId));
  632               lo.LoadWi th<SHIPPIN G_DETAIL>( e => e.STD _SHIPMENTS T);
  633               db.LoadOp tions = lo ;
  634               db.Deferr edLoadingE nabled = f alse;
  635  
  636          }
  637           
  638           // / <summary >
  639           // / Gets the  Kit order  and the o btain (ret urned) kit  details ( if any)
  640           // / </summar y>
  641           // / <param n ame="activ ityId"></p aram>
  642          ///  <returns> WKF_CASE_A CTIVITY</r eturns>
  643          pub lic WKF_CA SE KitOrde rDetails(i nt activit yId)
  644          {
  645               using (_d b = GetDat aContext() )
  646               {
  647                   SetLo adWithForI nitializeO therActivi ties(_db,  activityId );
  648                   //ret urn _db.WK F_CASEs.Fi rstOrDefau lt();
  649                   //Add ing where  criteria i n the firs t query     
  650                   retur n     (fro m t in _db .WKF_CASEs  join acti vity in _d b.WKF_CASE _ACTIVITie s on t.WKF _CASE_ID e quals acti vity.WKF_C ASE_ID
  651                                                      whe re activit y.WKF_CASE _ACTIVITY_ ID == acti vityId sel ect t).Fir stOrDefaul t();
  652               }
  653          }
  654  
  655          #en dregion
  656  
  657          #re gion Selec t by Id
  658          pub lic STD_WK FACTIVITYS T GetWorkf lowStatus( int workFl owId)
  659          {
  660               using (_d b = GetDat aContext() )
  661               {
  662                   DataL oadOptions  lo = new  DataLoadOp tions();
  663                   lo.Lo adWith<WKF _CASE_ACTI VITY>(e=>e .STD_WKFAC TIVITYST);
  664                   _db.L oadOptions  = lo;
  665                   retur n (_db.WKF _CASE_ACTI VITies.Whe re(e=>e.WK F_CASE_ACT IVITY_ID = = workFlow Id).Select (t=>t.STD_ WKFACTIVIT YST).First OrDefault( ));
  666               }
  667          }
  668  
  669          pub lic bool A ctivityExi sts(int wk fId, WorkF lowActivit yTypes typ e)
  670          {
  671               using (_d b = GetDat aContext() )
  672               {
  673                   //ret urn (_db.W KF_CASE_AC TIVITies.W here(e =>  e.WKF_CASE _ID == wkf Id && e.ST D_WKFACTIV ITYTYPE_ID == Convert .ToInt16(t ype)).Sele ct(t => t. WKF_CASE_A CTIVITY_ID ).Any());
  674                   retur n (_db.WKF _CASE_ACTI VITies.Whe re(e => e. WKF_CASE_I D == wkfId  && e.STD_ WKFACTIVIT YTYPE_ID = = Convert. ToInt16(ty pe)).Count () > 0);
  675               }
  676          }
  677  
  678          pub lic void S imulateLab Results(in t caseId)
  679          {
  680               using (_d b = GetDat aContext() )
  681               {
  682                   _db.s p_LoadBioL abResults( caseId);
  683               }
  684  
  685          }
  686          #en dregion
  687       }
  688  
  689       public  class Wor kflowCaseA ctivityCom parer : IE qualityCom parer<LabI nProcessKi tDetails >
  690       {
  691           pu blic bool  Equals(Lab InProcessK itDetails  x, LabInPr ocessKitDe tails y)
  692           {
  693                return ( x.Activity Id == y.Ac tivityId);
  694  
  695           }
  696  
  697           pu blic int G etHashCode (LabInProc essKitDeta ils obj)
  698           {
  699  
  700                return o bj.Activit yId.GetHas hCode();
  701  
  702           }
  703       } 
  704  
  705       #regio n Kit orde r objects
  706       public  class Lab KitOrderGr oup
  707       {
  708           pu blic int?  Institutio nId { get;  set; }
  709           pu blic strin g Facility  { get; se t; }
  710           pu blic strin g StationN umber { ge t; set; }
  711           pu blic strin g KitTypeC d { get; s et; }
  712           pu blic int O rderType {  get; set;  } //0 - f or New, 1  - for Comp leted
  713           pu blic int K itTypeID {  get; set;  }
  714           pu blic int C ount { get ; set; }
  715           pu blic List< string> Pa tient { ge t; set; }
  716           // public IEn umerable<i nt> WkfCas es { get;  set; }
  717       }
  718       public  class Lab KitOrderPa tientsBO
  719       {
  720           pu blic int W kfCaseId {  get; set;  }
  721           pu blic bool  FromStock  { get; set ; }
  722           pu blic bool  Ordered {  get; set;  }
  723           pu blic strin g KitType  { get; set ; }
  724           pu blic strin g PatientN ame{ get;  set; }
  725           pu blic strin g AddressL ine1{ get;  set; }
  726           pu blic strin g AddressL ine2{ get;  set; }
  727           pu blic strin g AddressL ine3 { get ; set; }
  728           pu blic strin g City { g et; set; }
  729           pu blic strin g County {  get; set;  }
  730           pu blic strin g State {  get; set;  }
  731           pu blic strin g Country  { get; set ; }
  732           pu blic strin g PostalCo de { get;  set; }
  733           pu blic strin g ZipPlus4  { get; se t; }
  734           pu blic strin g TEFSCRep  { get; se t; }
  735           // public Dat eTime? Kit OrderdDate  { get; se t; }
  736           pu blic DateT ime? KitOr deredDate  { get; set ; }
  737           pu blic strin g VAMCCont actNm { ge t; set; }
  738           pu blic strin g VAMCCont actPh { ge t; set; }
  739           pu blic strin g InstName  { get; se t; }
  740           pu blic strin g StationN umber { ge t; set; }
  741       }
  742  
  743       /// <s ummary>
  744       /// Us ed to stor e ordered/ received k its inform ation
  745       /// </ summary>
  746       public  class Lab KitOrdered AndReceive dBO : LabK itOrderPat ientsBO
  747       {
  748           pu blic strin g Receivin gFacility  { get; set ; }
  749           pu blic strin g Status {  get; set;  }
  750           pu blic DateT ime? Recei vedDate {  get; set;  }
  751       }
  752  
  753       public  class Lab InProcessK itDetails  : LabKitOr deredAndRe ceivedBO
  754       {
  755           pu blic int A ctivityId  { get; set ; }
  756       }
  757       #endre gion
  758   }