23. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 1/19/2019 1:19:07 PM Eastern Standard 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 VIRP_Build_6_Dec_2018_CG.zip\Registries VIRP Web Site\BaseCode NotesManager.cs Thu Jan 17 17:39:58 2019 UTC
2 VIRP_Build_6_Dec_2018_CG.zip\Registries VIRP Web Site\BaseCode NotesManager.cs Sat Jan 19 18:02:24 2019 UTC

23.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1628
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.Globali zation;
  4   using Syst em.Linq;
  5   using Syst em.Web;
  6   using VIA  = VIRP_WEB .ViaServic es;
  7  
  8   namespace  VIRP_WEB.B aseCode
  9   {
  10       [Seria lizable()]
  11       public  class Not esManager
  12       {
  13           pr ivate stat ic VIA.Via Services s ervices =  new VIA.Vi aServices( );
  14  
  15           pu blic stati c readonly  string Lo okupStatio nCode = "0 00";
  16  
  17           pr ivate ViaS erviceData  viaData;
  18  
  19           pu blic ViaSe rviceData  ViaData
  20           {
  21                get
  22                {
  23                    if ( this.viaDa ta == null )
  24                         this.viaDa ta = HttpC ontext.Cur rent.Sessi on["CprsSe ssion"] as  ViaServic eData;
  25  
  26                    retu rn this.vi aData;
  27                }
  28                set
  29                {
  30                    this .viaData =  value;
  31                    Http Context.Cu rrent.Sess ion["CprsS ession"] =  this.viaD ata;
  32                }
  33           }
  34  
  35           #r egion VIA  Variable D eclaration s
  36  
  37           // private Tb iServiceIn terfaceCli ent _VIASe rvice;
  38           pr ivate VIA. ViaPerson  personsTOV IA;
  39  
  40           pr otected st ring login SiteCode =  null;
  41           pr ivate stri ng userID  = String.E mpty;
  42           pr ivate stri ng tokeniz edDUZ = St ring.Empty ;
  43           pr ivate stri ng localPi d = String .Empty;
  44           pr ivate stri ng provide rName = St ring.Empty ;
  45  
  46             // D N S  - unused  field
  47           // private st ring saved ItemID = S tring.Empt y;
  48  
  49           #e ndregion
  50  
  51           pu blic Notes Manager()
  52           {
  53                if (this .viaData = = null)
  54                    this .viaData =  HttpConte xt.Current .Session[" CprsSessio n"] as Via ServiceDat a;
  55           }
  56  
  57           // public Via ServiceDat a GetViaDa ta()
  58           // {
  59           //     ViaSer viceData v iaData = n ull;
  60  
  61           //     viaDat a = this.G etViaDataF romSession ();
  62                
  63           //     return  viaData;
  64           // }
  65  
  66           // public Via ServiceDat a GetViaDa taFromSess ion()
  67           // {
  68           //     return  HttpConte xt.Current .Session[" ViaData"]  as ViaServ iceData;
  69           // }
  70  
  71           // public voi d AddToSes sionViaDat a(ViaServi ceData via Data)
  72           // {
  73           //     if (Ht tpContext. Current.Se ssion["Con firmedSSN" ] != null)
  74           //     {
  75           //         if  (HttpCont ext.Curren t.Session[ "Confirmed SSN"].ToSt ring() !=  viaData.Pa tientSnum)
  76           //         {
  77           //              //Loggin g.WriteLog ToFile("Ba seTBIInstr umentPage. AddtoSessi onTBIServi ceTo(): Wa rningRedir ect: SSN M ismatch");
  78           //              //corrup ted applic ation cont ext displa y error me ssage to u ser
  79           //              HttpCont ext.Curren t.Response .Redirect( "Warning.a spx?err=11 ");
  80           //         }
  81           //     }
  82  
  83           //     HttpCo ntext.Curr ent.Sessio n["ViaData "] = viaDa ta;
  84           // }
  85  
  86           pu blic void  PatientCpr sLoad()
  87           {
  88                this.Che ckNeedStat ionDivisio n();
  89                HttpCont ext.Curren t.Response .Cache.Set Expires(Da teTime.Now );
  90                bool isC PRSLaunced  = false;
  91  
  92                //if (_n otesManage r == null)  { _notesM anager = n ew Instrum entsManage r(); }
  93                //TBISer viceTO _tb iServiceTo  = GetTBIS erviceTo() ;
  94  
  95                if (this .viaData = = null)
  96                {
  97                    //Lo gging.Writ eLogToFile ("BaseTBII nstrumentP age.PageLo ad(): Warn ingRedirec t: _tbiSer viceTo is  null");
  98                    Http Context.Cu rrent.Resp onse.Redir ect("Warni ng.aspx?er r=2", true );
  99                }
  100  
  101                try
  102                {
  103                    isCP RSLaunced  = this.Loa dViaData(t his.viaDat a);
  104                }
  105                catch (E xception x )
  106                {
  107                    isCP RSLaunced  = false;
  108                    thro w x;
  109                }
  110                //if (!i sCPRSLaunc ed)
  111                //{
  112                //    // throw new  Exception( "CPRS need s to be la unched.");
  113                //    // Logging.Wr iteLogToFi le("BaseTB IInstrumen tPage.Page Load(): Wa rningRedir ect: VIA ! _isCPRSLau nced");
  114                //    // Response.R edirect("W arning.asp x?err=1234 5", true);
  115                //}
  116  
  117                //this.A ddToSessio nViaData(t his.viaDat a);
  118                //AddtoV iewStateTB IServiceTo (_tbiServi ceTo);
  119           }
  120           
  121           pr ivate VIA. ViaPerson  CPRSLaunch VIA(string  CURRENT_U SER, ViaSe rviceData  viaData)
  122           {
  123                //VIA.pe rsonsTO re sult = nul l;
  124                VIA.ViaP erson resu lt = null;
  125  
  126                //*** DO  NOT OVERR IDE THE lo ginSiteCod e IN THIS  METHOD
  127                try
  128                {
  129                    this .userID =  viaData.DU Z;
  130                    this .localPid  = viaData. DFN;
  131                    //Pr oviderDFN  update
  132                    //Ht tpContext. Current.Se ssion["Pro viderDFN"]  = this.lo calPid;
  133                    this .ViaData.P roviderDFN  = this.lo calPid;
  134  
  135                    // W e want to  use the va lue we sav ed in the  session UN LESS
  136                    // t he site co de has cha nged (this  happens w hen TBI ca n't determ ine the us ers
  137                    // s ite and th ey select  it from th e pick-lis t provided
  138                    //if  (HttpCont ext.Curren t.Session[ "_VIAServi ce.cprsLau nch"] == n ull ||
  139                    //     HttpCont ext.Curren t.Session[ "_loginSit eCode"] ==  null ||
  140                    //     loginSit eCode != C onvert.ToS tring(Http Context.Cu rrent.Sess ion["_logi nSiteCode" ]))
  141                    //{
  142                    resu lt = servi ces.CPRSLa unch(CURRE NT_USER, t his.userID , this.loc alPid, thi s.loginSit eCode);
  143                    //Cp rsLaunch u pdate
  144                    //Ht tpContext. Current.Se ssion["_VI AService.c prsLaunch" ] = result ;
  145                    this .ViaData.V IAServiceC prsLaunch  = result;
  146  
  147                    //Lo ginSiteCod e update
  148                    //Ht tpContext. Current.Se ssion["_lo ginSiteCod e"] = this .loginSite Code;
  149                    this .ViaData.L oginSiteCo de = this. loginSiteC ode;
  150  
  151                    //}
  152                    //el se
  153                    //{
  154                    //     result =  GetPerson TOFromSess ion();
  155                    //}
  156                }
  157                catch (E xception e x)
  158                {
  159                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  160                    thro w ex;
  161                }
  162  
  163                return r esult;
  164           }
  165  
  166           #r egion VIA  Service Me thods
  167  
  168           pu blic bool  LoadViaDat a()
  169           {
  170                try
  171                {
  172                    stri ng error =  string.Em pty;
  173                    //DO  NOT GET T HIS//textT O textSite Id = getSi teIdVIA(tb iServiceTo .ServerIP,  out error );
  174                    if ( error == " SUCCESS")  { error =  null; }
  175  
  176                    if ( !string.Is NullOrEmpt y(error))
  177                    {
  178                         return fal se;
  179                    }
  180                    else
  181                    {
  182                         if (null ! = this.via Data && !s tring.IsNu llOrEmpty( this.viaDa ta.SiteCod e))
  183                         {
  184                             if (!s tring.IsNu llOrEmpty( this.Stati onDivision ))
  185                                 th is.loginSi teCode = t his.viaDat a.SiteCode  = this.St ationDivis ion;
  186                             else
  187                                 th is.loginSi teCode = t his.viaDat a.SiteCode ;
  188                         }
  189  
  190                         this.perso nsTOVIA =  this.CPRSL aunchVIA(H ttpContext .Current.U ser.Identi ty.Name, t his.viaDat a);
  191  
  192                         if (this.p ersonsTOVI A == null  || this.pe rsonsTOVIA .Fault !=  null)
  193                         {
  194                             //Logg ing.WriteL ogToFile(" LoadViaDat a: _person sTOVIA nul l or has f ault");
  195                             this.V iaData = n ull;
  196                         }
  197  
  198                         if (this.v iaData !=  null)
  199                         {
  200                             if (th is.persons TOVIA != n ull)
  201                             {
  202                                 th is.viaData .StationNu mber = thi s.loginSit eCode;
  203                                 th is.viaData .PatientNa me = this. personsTOV IA.Patient Name;
  204                                 th is.viaData .PatientDO B = this.p ersonsTOVI A.PatientD ob;
  205                                 th is.viaData .PatientGe nder = thi s.personsT OVIA.Patie ntGender;
  206                                 th is.viaData .PatientSn um = this. personsTOV IA.Patient Snum;
  207                                 th is.viaData .PatientIC N = this.p ersonsTOVI A.MpiPid;
  208                                 th is.viaData .PatientDF N = this.p ersonsTOVI A.LocalPid ;
  209                                 th is.viaData .PatientAd mitTimeSta mp = this. personsTOV IA.AdmitTi mestamp;
  210  
  211                                 th is.viaData .STA6N = t his.person sTOVIA.Use rSiteId;
  212                                 th is.viaData .UserName  = this.per sonsTOVIA. UserName;
  213                                 th is.provide rName = th is.persons TOVIA.User Name;
  214                                 th is.tokeniz edDUZ = th is.persons TOVIA.User Duz;
  215  
  216                                 // TokenizedD UZ update
  217                                 // if (HttpCo ntext.Curr ent.Sessio n["Tokeniz edDUZ"] ==  null)
  218                                 // {
  219                                 //     HttpCo ntext.Curr ent.Sessio n["Tokeniz edDUZ"] =  this.token izedDUZ;
  220                                 // }
  221                                 if  (string.I sNullOrEmp ty(this.vi aData.Toke nizedDUZ))
  222                                 {
  223                                      this.via Data.Token izedDUZ =  this.token izedDUZ;
  224                                 }
  225  
  226                                 // ProviderNa me update
  227                                 // if (HttpCo ntext.Curr ent.Sessio n["Provide rName"] ==  null)
  228                                 // {
  229                                 //     HttpCo ntext.Curr ent.Sessio n["Provide rName"] =  this.provi derName;
  230                                 // }
  231                                 if  (string.I sNullOrEmp ty(this.vi aData.Prov iderName))
  232                                 {
  233                                      this.via Data.Provi derName =  this.provi derName;
  234                                 }
  235  
  236                                 th is.viaData .PatientLo cationId =  this.pers onsTOVIA.L ocationId;
  237  
  238                                 th is.viaData .Instituti onName = t his.person sTOVIA.Loc ationFacil ityName;
  239                             }
  240                         }
  241  
  242                         if (this.v iaData ==  null)
  243                         {
  244                             return  false;
  245                         }
  246                         else
  247                         {
  248                             return  true;
  249                         }
  250                    }
  251                }
  252                catch (E xception e x)
  253                {
  254                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  255                    retu rn false;
  256                }
  257           }
  258  
  259           pu blic bool  LoadViaDat a(ViaServi ceData via Data)
  260           {
  261                this.Via Data = via Data;
  262                return t his.LoadVi aData();
  263           }
  264  
  265           // / <summary >
  266           // / VIA: get NoteTitles FromVIA se rvice meth od
  267           // / </summar y>
  268           // / <param n ame="targe t"></param >
  269           // / <param n ame="direc tion"></pa ram>
  270           // / <param n ame="error "></param>
  271           // / <returns ></returns >
  272           pu blic List< VIA.String KeyValuePa ir> GetNot eTitlesFro mVIA(strin g target,  string dir ection, ou t string e rror)
  273           {
  274                try
  275                {
  276                    if ( !string.Is NullOrEmpt y(this.Sta tionDivisi on))
  277                         this.ViaDa ta.Station Number = t his.Statio nDivision;
  278                    this .loginSite Code = thi s.ViaData. StationNum ber;
  279                }
  280                catch (E xception e x)
  281                {
  282                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  283                    thro w;
  284                }
  285  
  286                //Provid erDFN upda te
  287                var resu lt = servi ces.GetNot eTitles(Ht tpContext. Current.Us er.Identit y.Name, ta rget, dire ction, thi s.loginSit eCode, thi s.ViaData. ProviderDF N, this.Vi aData.Toke nizedDUZ,  this.ViaDa ta.Provide rName, out  error);
  288  
  289                return r esult.ToLi st();
  290           }
  291  
  292           pu blic List< VIA.String KeyValuePa ir> GetCon sultsFromV IA(out str ing error)
  293           {
  294                try
  295                {
  296                    if ( !string.Is NullOrEmpt y(this.Sta tionDivisi on))
  297                         this.ViaDa ta.Station Number = t his.Statio nDivision;
  298                    this .loginSite Code = thi s.ViaData. StationNum ber;
  299                }
  300                catch (E xception e x)
  301                {
  302                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  303                    thro w;
  304                }
  305  
  306                //Provid erDFN upda te
  307                var resu lt2 = serv ices.GetCo nsults(Htt pContext.C urrent.Use r.Identity .Name, thi s.loginSit eCode, thi s.ViaData. ProviderDF N, this.Vi aData.Prov iderName,  this.ViaDa ta.Tokeniz edDUZ, out  error);
  308                return r esult2.ToL ist();
  309           }
  310  
  311           pu blic List< VIA.String KeyValuePa ir> GetHos pitalAdmis sionsFromV IA(out str ing error)
  312           {
  313                try
  314                {
  315                    if ( !string.Is NullOrEmpt y(this.Sta tionDivisi on))
  316                         this.ViaDa ta.Station Number = t his.Statio nDivision;
  317                    this .loginSite Code = thi s.ViaData. StationNum ber;
  318                }
  319                catch (E xception e x)
  320                {
  321                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  322                    thro w;
  323                }
  324  
  325                //Provid erDFN upda te
  326                var resu lt2 = serv ices.GetHo spitalAdmi ssions(Htt pContext.C urrent.Use r.Identity .Name, thi s.loginSit eCode, thi s.ViaData. ProviderDF N, this.Vi aData.Prov iderName,  this.ViaDa ta.Tokeniz edDUZ, thi s.ViaData. PatientICN , out erro r);
  327  
  328                return r esult2.ToL ist();
  329           }
  330  
  331           pu blic List< VIA.String KeyValuePa ir> GetVis itsFromVIA (DateTime  fromDate,  DateTime t oDate, out  string er ror)
  332           {
  333                string f ormattedFr omDate = t his.Format DateForVIA (fromDate) ;
  334                string f ormattedTo Date = thi s.FormatDa teForVIA(t oDate);
  335  
  336                try
  337                {
  338                    if ( !string.Is NullOrEmpt y(this.Sta tionDivisi on))
  339                         this.ViaDa ta.Station Number = t his.Statio nDivision;
  340                    this .loginSite Code = thi s.ViaData. StationNum ber;
  341                }
  342                catch (E xception e x)
  343                {
  344                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  345                    thro w;
  346                }
  347  
  348                //Provid erDFN upda te
  349                var resu lt2 = serv ices.GetVi sits(HttpC ontext.Cur rent.User. Identity.N ame, fromD ate, toDat e, this.lo ginSiteCod e, this.Vi aData.Prov iderDFN, t his.ViaDat a.Provider Name, this .ViaData.T okenizedDU Z, this.Vi aData.Pati entICN, ou t error);
  350  
  351                return r esult2.ToL ist();
  352           }
  353  
  354           pu blic List< VIA.String KeyValuePa ir> GetLoc ationsFrom VIA(string  searchPar ameter, st ring direc tion, out  string err or)
  355           {
  356                try
  357                {
  358                    if ( !string.Is NullOrEmpt y(this.Sta tionDivisi on))
  359                         this.ViaDa ta.Station Number = t his.Statio nDivision;
  360                    this .loginSite Code = thi s.ViaData. StationNum ber;
  361                }
  362                catch (E xception e x)
  363                {
  364                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  365                    thro w;
  366                }
  367  
  368                //Provid erDFN upda te
  369                var resu lt2 = serv ices.GetLo cations(Ht tpContext. Current.Us er.Identit y.Name, se archParame ter, direc tion, this .loginSite Code, this .ViaData.P roviderDFN , this.Via Data.Provi derName, t his.ViaDat a.Tokenize dDUZ, out  error);
  370  
  371                return r esult2.ToL ist();
  372           }
  373  
  374           pu blic void  WriteNoteW ithVIA()
  375           {
  376                //VIA.no teResultTO  writeNote Result = n ew VIA.not eResultTO( );
  377                //textTO  _closeNot eResult =  null;
  378                string t itleIEN =  "";
  379                string e ncounterSt ring = "";
  380                string n oteText =  "";
  381                string a uthorDUZ =  "";
  382                string c osignerDUZ  = "";
  383                string c onsultIEN  = "";
  384                string p rfIEN = "" ;
  385  
  386                //set th e values f or the wri teNote web  service b ased on th e noteType
  387                switch ( this.viaDa ta.Selecte dNoteType. Id)
  388                {
  389                    case  (int)Note TypeEnum.S cheduledCl inicAppoin tment:  // Scheduled  Clinic App ointment
  390                         //if the n ote is for  current v isit or pr evious vis it, call g etVisits a nd have th e user pic k one . 
  391                         //Then enc ounterStri ng = visit .location. id + ‘;’ +  visit.tim estamp + ‘ ;A’ 
  392  
  393                         //already  formated w hen list b ox data it ems are cr eated
  394                         encounterS tring = th is.viaData .SelectedV isitId;
  395                         break;
  396                    case  (int)Note TypeEnum.H ospitalAdm ission:  / /Hospital  Admission
  397                         //if the n ote is for  previous  stay, call  getAdmiss ions and h ave the us er pick on e. 
  398                         //Then enc ounterStri ng = stay. location.i d + ‘;’ +  stay.admit Timestamp  + ‘;H’ 
  399  
  400                         //already  formated w hen list b ox data it ems are cr eated
  401                         encounterS tring = th is.viaData .SelectedH ospitalAdm issionId;
  402                         break;
  403                    case  (int)Note TypeEnum.C urrentStay :  //Curre nt Stay
  404                         //if the n ote is for  current s tay, encou nterString  = patient .locationI d + ‘;’ +  patient.ad mitTimesta mp + ‘;H’  -- needs c onversion  to Fileman  date
  405                         encounterS tring = th is.viaData .PatientLo cationId +  ";" + thi s.FormatDa teForVIA2( DateTime.P arseExact( this.viaDa ta.Patient AdmitTimeS tamp, "yyy yMMdd.HHmm ss", Cultu reInfo.Inv ariantCult ure)) + "; H";
  406                         break;
  407                    case  (int)Note TypeEnum.U nscheduled OrNewVisit : //Unsche duled or N ew Visit
  408  
  409                         if (!this. viaData.Is Historical )
  410                         {
  411                             //if t he note is  for a new  visit, bu t not hiso rical, cal l getLocat ions and h ave the us er pick on e. 
  412                             //Then  encounter String = l ocation.id  + ‘;’ + 2 0080515.15 00 (today' s date) +  ‘;A’ 
  413                             encoun terString  = this.via Data.Selec tedLocatio nID + ";"  + this.For matDateFor VIA2(DateT ime.Now) +  ";A";
  414                         }
  415                         else
  416                         {
  417                             //if t he note is  for a new  visit, an d is histo rical, 
  418                             //then  previous  step but e nd with ‘; E’ instead  of ‘;A’. 
  419                             encoun terString  = this.via Data.Selec tedLocatio nID + ";"  + FormatDa teForVIA2( DateTime.N ow) + ";E" ;
  420                         }
  421                         break;
  422                }
  423  
  424                //For pr eserving l ine breaks  within a  text block  that is b eing writt en to a no te, replac e the \r\n  or \n cha racters wi th a pipe  (|).
  425                noteText  = this.vi aData.Note Text.Repla ce("<br>",  "|").Repl ace(Enviro nment.NewL ine, "|"). Replace("\ v", "|");
  426  
  427                authorDU Z = this.v iaData.DUZ ;
  428  
  429                if (!Str ing.IsNull OrEmpty(th is.viaData .SelectedC onsultId))
  430                {
  431                    cons ultIEN = t his.viaDat a.Selected ConsultId;
  432                }
  433  
  434                if (this .viaData.S electedNot eTitleId ! = "" && th is.viaData .SelectedN oteTitleId  != null)
  435                {
  436                    titl eIEN = thi s.viaData. SelectedNo teTitleId;
  437                }
  438                //titleI EN = "1572 ";
  439  
  440                if (!Str ing.IsNull OrEmpty(th is.viaData .SelectedC osignerID) )
  441                {
  442                    cosi gnerDUZ =  this.viaDa ta.Selecte dCosignerI D;
  443                }
  444  
  445                prfIEN =  "";
  446  
  447                //bool s avedFlag =  false;
  448                //Provid erDFN upda te
  449                services .WriteNote (HttpConte xt.Current .User.Iden tity.Name,  titleIEN,  encounter String, no teText, au thorDUZ, c osignerDUZ , consultI EN, prfIEN , this.log inSiteCode , this.Via Data.Provi derDFN, th is.ViaData .ProviderN ame, this. ViaData.To kenizedDUZ );
  450           }
  451  
  452           pu blic void  WriteNoteW ithVIA(Via ServiceDat a viaData)
  453           {
  454                this.Via Data = via Data;
  455                this.Wri teNoteWith VIA();
  456           }
  457  
  458           // / <summary >
  459           // / VIA: Clo seNote ser vice metho d call
  460           // / </summar y>
  461           // / <param n ame="noteI EN"></para m>
  462           // / <param n ame="consu ltIEN"></p aram>
  463           // / <returns ></returns >
  464           // private te xtTO Close NoteWithVI A(string n oteIEN, st ring consu ltIEN)
  465           // {
  466           //     textTO  result =  null;
  467  
  468           //     MDWSLo g mdwsLog  = new MDWS Log();
  469           //     MDWS_L OG _mdwsLo g = new MD WS_LOG();
  470           //     _cprsM anager.Set MDWSLogDef aults(ref  _mdwsLog);
  471           //     _mdwsL og.SERVICE _NAME = "c loseNoteVI A";
  472           //     _mdwsL og.PARAMET ERS = _cpr sManager.x mlParamete rs(new str ing[] { no teIEN, con sultIEN }) ;
  473  
  474           //     try
  475           //     {
  476           //         qu eryBean be an = new q ueryBean() ;
  477           //         pa tient pati entbean =  new patien t();
  478           //         pr ovider pro viderbean  = new prov ider();
  479           //         if  (!string. IsNullOrEm pty(Statio nDivision) )
  480           //              this.Tbi ServiceTo. StationNum ber = Stat ionDivisio n;
  481           //         lo ginSiteCod e = this.T biServiceT o.StationN umber;
  482  
  483           //         be an.request ingApp = H elpers.Get DBConfigEn try("TBISe rviceReque stingApp") ; //"TBI";
  484           //         be an.consumi ngAppToken  = Helpers .GetDBConf igEntry("T BIServiceC red1");
  485           //         be an.consumi ngAppPassw ord = Help ers.GetDBC onfigEntry ("TBIServi ceCred2");
  486           //         be an.recordS iteCode =  loginSiteC ode;
  487           //         pr oviderbean .userId =  HttpContex t.Current. Session["T okenizedDU Z"].ToStri ng();
  488           //         be an.provide r = provid erbean;
  489  
  490           //         re sult = _VI AService.c loseNote(n oteIEN, co nsultIEN,  bean);
  491  
  492           //         if  (result ! = null)
  493           //         {
  494           //              if (LogF ullVIAResp onse)
  495           //                  _mdw sLog.RETUR NED_DATA =  result.Se rialize();
  496           //              else
  497           //                  _mdw sLog.RETUR NED_DATA =  (null ==  result) ?  "No Result " : "Valid  Result";
  498  
  499           //              if (resu lt.fault ! = null)
  500           //              {
  501           //                  _mdw sLog.ERROR _LEVEL = 0 ;
  502           //              }
  503           //         }
  504           //         el se
  505           //         {
  506           //              _mdwsLog .ERROR_LEV EL = 1;
  507           //         }
  508           //     }
  509           //     catch  (Exception  exc)
  510           //     {
  511           //         He lpers.Hand leTBIExcep tion(exc,  "Instrumen tManager.c s", "", "C loseNoteWi thVIA()");
  512           //         _m dwsLog.ERR OR_LEVEL =  2;
  513           //     }
  514  
  515           //     mdwsLo g.LogMDWSC all(_mdwsL og);
  516  
  517           //     return  result;
  518           // }
  519  
  520           // /// <summa ry>
  521           // /// VIA: i sCosignerR equired se rvice meth od call
  522           // /// </summ ary>
  523           // /// <param  name="tbi ServiceTO" ></param>
  524           // /// <param  name="err Msg"></par am>
  525           // /// <retur ns></retur ns>
  526           // public boo l isCosign erRequired VIA(TBISer viceTO tbi ServiceTO,  out strin g errMsg)
  527           // {
  528           //     bool r et = false ;
  529           //     textTO  result =  null;
  530           //     string  noteDefin itionIEN =  "";
  531           //     string  authorDUZ  = "";
  532  
  533           //     errMsg  = "Servic e isCosign erRequired VIA return ed NULL va lue"; //De fault erro r message
  534  
  535           //     noteDe finitionIE N = tbiSer viceTO.Sel ectedNoteT itleId;
  536           //     author DUZ = tbiS erviceTO.D UZ;
  537           //     if (!s tring.IsNu llOrEmpty( StationDiv ision))
  538           //         tb iServiceTO .StationNu mber = Sta tionDivisi on;
  539           //     loginS iteCode =  tbiService TO.Station Number;
  540  
  541           //     MDWSLo g mdwsLog  = new MDWS Log();
  542           //     MDWS_L OG _mdwsLo g = new MD WS_LOG();
  543           //     _cprsM anager.Set MDWSLogDef aults(ref  _mdwsLog);
  544           //     _mdwsL og.SERVICE _NAME = "i sCosignerR equiredVIA ";
  545           //     _mdwsL og.PARAMET ERS = _cpr sManager.x mlParamete rs(new str ing[] { no teDefiniti onIEN, aut horDUZ });
  546  
  547           //     try
  548           //     {
  549           //         qu eryBean be an = new q ueryBean() ;
  550           //         pa tient pati entbean =  new patien t();
  551           //         pr ovider pro viderbean  = new prov ider();
  552  
  553           //         be an.itemId  = noteDefi nitionIEN;
  554           //         be an.recordS iteCode =  loginSiteC ode;
  555           //         be an.request ingApp = H elpers.Get DBConfigEn try("TBISe rviceReque stingApp") ; //"TBI";
  556           //         be an.consumi ngAppToken  = Helpers .GetDBConf igEntry("T BIServiceC red1");
  557           //         be an.consumi ngAppPassw ord = Help ers.GetDBC onfigEntry ("TBIServi ceCred2");
  558           //         pr oviderbean .name = Ht tpContext. Current.Se ssion["Pro viderName" ].ToString ();
  559           //         pr oviderbean .loginSite Code = log inSiteCode ;
  560           //         pr oviderbean .userId =  HttpContex t.Current. Session["T okenizedDU Z"].ToStri ng();
  561           //         be an.criteri a = author DUZ;
  562           //         pa tientbean. mpiPid = t biServiceT O.PatientI CN;
  563  
  564           //         be an.patient  = patient bean;
  565           //         be an.provide r = provid erbean;
  566  
  567           //         re sult = _VI AService.i sCosignerR equired(be an);
  568  
  569           //         if  (result ! = null)
  570           //         {
  571           //              if (LogF ullVIAResp onse)
  572           //                  _mdw sLog.RETUR NED_DATA =  result.Se rialize();
  573           //              else
  574           //                  _mdw sLog.RETUR NED_DATA =  (null ==  result) ?  "No Result " : "Valid  Result";
  575  
  576           //              if (resu lt.fault ! = null)
  577           //              {
  578           //                  _mdw sLog.ERROR _LEVEL = 1 ;
  579           //                  errM sg = resul t.fault.me ssage;
  580           //              }
  581           //              else
  582           //              {
  583           //                  _mdw sLog.ERROR _LEVEL = 0 ;
  584           //                  errM sg = Strin g.Empty;
  585           //              }
  586           //         }
  587           //         el se
  588           //         {
  589           //              _mdwsLog .ERROR_LEV EL = 2;
  590           //         }
  591           //     }
  592           //     catch  (Exception  exc)
  593           //     {
  594           //         He lpers.Hand leTBIExcep tion(exc,  "Instrumen tManager.c s", "", "i sCosignerR equiredVIA ()");
  595           //         _m dwsLog.ERR OR_LEVEL =  2;
  596           //     }
  597  
  598           //     mdwsLo g.LogMDWSC all(_mdwsL og);
  599  
  600           //     if (!S tring.IsNu llOrEmpty( result.tex t))
  601           //     {
  602           //         sw itch (resu lt.text.To Upper())
  603           //         {
  604           //              case "Y" :
  605           //                  ret  = true;
  606           //                  brea k;
  607           //              case "N" :
  608           //                  brea k;
  609           //              default:
  610           //                  errM sg = "VIA  Service is CosignerRe quiredVIA  returned u expected v alue " + r esult.text ;
  611           //                  brea k;
  612           //         }
  613           //     }
  614  
  615           //     return  ret;
  616           // }
  617  
  618           // public str ing Lookup SiteCodeBy Server(str ing vistaS erver, out  string er ror)
  619           // {
  620           //     if (_V IAService  == null)
  621           //     {
  622           //         _V IAService  = CreateVI AClientFro mDB();
  623           //         if  (_VIAServ ice == nul l)
  624           //              _VIAServ ice = new  TbiService InterfaceC lient("Tbi ServiceImp lPort");
  625           //     }
  626           //     textTO  temp = ge tSiteIdVIA (vistaServ er, out er ror);
  627           //     if (nu ll != temp )
  628           //         re turn temp. text;
  629           //     return  null;
  630           // }
  631  
  632           // public tex tTO getSit eIdVIA(str ing vistaS erver, out  string er ror)
  633           // {
  634           //     textTO  result =  null;
  635  
  636           //     try
  637           //     {
  638           //         // if (_notes Manager ==  null) { _ notesManag er = new I nstruments Manager();  }
  639           //         TB IServiceTO  _tbiServi ceTo = Sys tem.Web.Ht tpContext. Current.Se ssion["Via Data"] as  TBIService TO;
  640           //         if  (LoadViaD ata(_tbiSe rviceTo))
  641           //         {
  642           //              provider  providerb ean = new  provider() ;
  643           //              patient  patientbea n = new pa tient();
  644           //              queryBea n bean = n ew queryBe an();
  645  
  646           //              //_userI D = _tbiSe rviceTo.DU Z;
  647           //              _userID  = HttpCont ext.Curren t.Session[ "Tokenized DUZ"].ToSt ring();
  648  
  649           //              _localPi d = _tbiSe rviceTo.DF N;
  650           //              HttpCont ext.Curren t.Session[ "ProviderD FN"] = _lo calPid;
  651  
  652           //              bean.cri teria = "T BI_PWD";
  653           //              bean.req uestingApp  = Helpers .GetDBConf igEntry("T BIServiceR equestingA pp"); //"T BI";
  654           //              bean.con sumingAppT oken = Hel pers.GetDB ConfigEntr y("TBIServ iceCred1") ;
  655           //              bean.con sumingAppP assword =  Helpers.Ge tDBConfigE ntry("TBIS erviceCred 2");
  656           //              //patien t attribut es
  657           //              patientb ean.localS iteId = lo ginSiteCod e;
  658           //              patientb ean.localP id = HttpC ontext.Cur rent.Sessi on["Provid erDFN"].To String();
  659           //              bean.pat ient = pat ientbean;
  660           //              //provid er attribu tes
  661           //              provider bean.login SiteCode =  loginSite Code;
  662           //              provider bean.userI d = _userI D;
  663           //              bean.pro vider = pr oviderbean ;
  664  
  665           //              result =  _VIAServi ce.getSite (vistaServ er, bean);     //.get SiteId(vis taServer);
  666  
  667           //              if (resu lt != null )
  668           //              {
  669           //                  if ( LogFullVIA Response)
  670           //                       _mdwsLog.R ETURNED_DA TA = resul t.Serializ e();
  671           //                  else
  672           //                       _mdwsLog.R ETURNED_DA TA = (null  == result ) ? "No Re sult" : "V alid Resul t";
  673  
  674           //                  if ( result.fau lt != null )
  675           //                  {
  676           //                       _mdwsLog.E RROR_LEVEL  = 1;
  677           //                       error = re sult.fault .message;
  678           //                  }
  679           //                  else
  680           //                  {
  681           //                       _mdwsLog.E RROR_LEVEL  = 0;
  682           //                       error = "S UCCESS";
  683           //                  }
  684           //              }
  685           //              else
  686           //              {
  687           //                  erro r = "VIA S ervice cal l getSiteI d returned  null";
  688           //                  _mdw sLog.ERROR _LEVEL = 2 ;
  689           //              }
  690           //         }
  691           //         el se
  692           //         {
  693           //              Logging. WriteLogTo File("Load ViaData(_t biServiceT o): Failur e response ");
  694           //              error =  "LoadViaDa ta(_tbiSer viceTo): F ailure res ponse";
  695           //         }
  696           //     }
  697           //     catch  (Exception  ex)
  698           //     {
  699           //         He lpers.Hand leTBIExcep tion(ex, " Instrument Manager.cs ", "", "ge tSiteIdVIA ()");
  700           //         er ror = ex.M essage;
  701           //         _m dwsLog.ERR OR_LEVEL =  2;
  702           //     }
  703  
  704           //     mdwsLo g.LogMDWSC all(_mdwsL og);
  705  
  706           //     return  result;
  707           // }
  708  
  709           // / <summary >
  710           // / VIA: For matDateFor VIA date f ormatting
  711           // / </summar y>
  712           // / <param n ame="dateV alue"></pa ram>
  713           // / <returns ></returns >
  714           pr ivate stri ng FormatD ateForVIA( DateTime d ateValue)
  715           {
  716                // CPRS  is expecti ng date in  the follo wing forma t "2000010 1.000000";
  717                //  [yyy y -1700]MM dd.HHmmss.   For exam ple, 31307 15.163242  represents  the date  and time o f JUL 15,  2013 at 16 :32:42
  718                //return  String.Fo rmat("{0:y yyyMMdd}",  dateValue );
  719  
  720                if (date Value != n ull)
  721                {
  722                    //re turn (date Value.Year  - 1700) +  "" + date Value.ToSt ring("MM")  + dateVal ue.ToStrin g("dd") +  "." + date Value.ToSt ring("HH")  + dateVal ue.ToStrin g("mm") +  dateValue. ToString(" ss");
  723                    retu rn dateVal ue.Year +  "" + dateV alue.ToStr ing("MM")  + dateValu e.ToString ("dd");
  724                }
  725                else
  726                {
  727                    retu rn null;
  728                }
  729           }
  730  
  731           // / <summary >
  732           // / VIA: For matDateFor VIA date f ormatting
  733           // / </summar y>
  734           // / <param n ame="dateV alue"></pa ram>
  735           // / <returns ></returns >
  736           pr ivate stri ng FormatD ateForVIA2 (DateTime  dateValue)
  737           {
  738                // CPRS  is expecti ng date in  the follo wing forma t "2000010 1.000000";
  739                //  [yyy y -1700]MM dd.HHmmss.   For exam ple, 31307 15.163242  represents  the date  and time o f JUL 15,  2013 at 16 :32:42
  740                //return  String.Fo rmat("{0:y yyyMMdd}",  dateValue );
  741  
  742                if (date Value != n ull)
  743                {
  744                    retu rn (dateVa lue.Year -  1700) + " " + dateVa lue.ToStri ng("MM") +  dateValue .ToString( "dd") + ". " + dateVa lue.ToStri ng("HH") +  dateValue .ToString( "mm") + da teValue.To String("ss ");
  745                }
  746                else
  747                {
  748                    retu rn null;
  749                }
  750           }
  751  
  752           #e ndregion
  753  
  754           #r egion CCOW
  755  
  756           pr ivate void  CheckNeed StationDiv ision()
  757           {
  758                //DRL -  uncomment  this to sk ip the CCO W screen
  759                //Statio nDivision  = "442";
  760                if (stri ng.IsNullO rEmpty(thi s.StationD ivision))
  761                {
  762                    Http Context.Cu rrent.Resp onse.Redir ect("Stati onDivision Authorizat ion.aspx",  true);
  763                }
  764           }
  765  
  766           pr ivate stri ng Station Division
  767           {
  768                get
  769                {
  770                    //re turn Syste m.Web.Http Context.Cu rrent.Sess ion["Stati onDivision "] as stri ng;
  771                    retu rn this.vi aData.Site Code;
  772                }
  773           }
  774  
  775           #e ndregion C COW
  776  
  777           pu blic bool  TestVIALog in(string  CURRENT_US ER, ViaSer viceData v iaData, ou t string e rror)
  778           {
  779                error =  null;
  780                try
  781                {
  782                    //DO  NOT OVERI DE siteCod e
  783                    this .loginSite Code = via Data.SiteC ode;
  784                    this .userID =  viaData.DU Z;
  785                    this .localPid  = viaData. DFN;
  786  
  787                    var  temp = ser vices.CPRS Launch(CUR RENT_USER,  this.user ID, this.l ocalPid, t his.loginS iteCode);
  788                    if ( temp == nu ll)
  789                    {
  790                         throw new  NullRefere nceExcepti on("No res ult return ed from ca ll to VIA  service.") ;
  791                    }
  792                    if ( temp.Fault  != null & & !string. IsNullOrEm pty(temp.F ault))
  793                    {
  794                         throw new  Exception( temp.Fault );
  795                    }
  796  
  797                    retu rn true;
  798                }
  799                catch (E xception e x)
  800                {
  801                    erro r = ex.Mes sage;
  802                    Serv iceInterfa ceManager. LogError(e x.Message,  String.Fo rmat("{0}. {1}", Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Declar ingType.Fu llName, Sy stem.Refle ction.Meth odBase.Get CurrentMet hod().Name ), HttpCon text.Curre nt.User.Id entity.Nam e, 0);
  803                    retu rn false;
  804                }
  805           }
  806       }
  807  
  808       public  enum Note TypeEnum :  int
  809       {
  810           Sc heduledCli nicAppoint ment = 0,
  811           Ho spitalAdmi ssion = 1,
  812           Cu rrentStay  = 2,
  813           Un scheduledO rNewVisit  = 3
  814       }
  815   }