25. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 1/19/2019 1:19:08 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.

25.1 Files compared

# Location File Last Modified
1 VIRP_Build_6_Dec_2018_CG.zip\Registries VIRP Web Site\Common NoteTemplatePreview.aspx.cs Thu Jan 17 17:39:58 2019 UTC
2 VIRP_Build_6_Dec_2018_CG.zip\Registries VIRP Web Site\Common NoteTemplatePreview.aspx.cs Sat Jan 19 18:02:24 2019 UTC

25.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 1802
Changed 2 4
Inserted 0 0
Removed 0 0

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

25.4 Active regular expressions

No regular expressions were active.

25.5 Comparison detail

  1   using Syst em;
  2   using Syst em.Collect ions.Gener ic;
  3   using Syst em.Linq;
  4   using Syst em.Text;
  5   using Syst em.Web;
  6   using Syst em.Web.UI;
  7   using Syst em.Web.UI. WebControl s;
  8   using VIRP _WEB.SoaSe rvices;
  9   using VIRP _WEB.BaseC ode;
  10   using Anti XssEnc = M icrosoft.S ecurity.Ap plication;
  11   using VIA  = VIRP_WEB .ViaServic es;
  12  
  13   namespace  VIRP_WEB.C ommon
  14   {
  15       public  partial c lass NoteT emplatePre view : Bas ePage
  16       {
  17           pr otected bo ol isconsu ltnotetitl e = false;
  18           pr ivate Note sManager n otesManage r;
  19  
  20           pr ivate SURV EYS SURVEY
  21           {
  22                get
  23                {
  24                    SURV EYS survey  = null;
  25  
  26                    if ( ViewState[ "SURVEY"]  != null)
  27                    {
  28                         survey = V iewState[" SURVEY"] a s SURVEYS;
  29                    }
  30                    else
  31                    {
  32                         int survey sId = 0;
  33  
  34                         if (!strin g.IsNullOr Empty(hide SurveyId.V alue))
  35                             int.Tr yParse(hid eSurveyId. Value.ToSt ring(), ou t surveysI d);
  36                         else
  37                         {
  38                             survey sId = User Session.Cu rrentSurve yId;
  39                             hideSu rveyId.Val ue = UserS ession.Cur rentSurvey Id.ToStrin g();
  40                         }
  41  
  42                         if (survey sId > 0)
  43                             survey  = Service InterfaceM anager.SUR VEYS_GET_F OR_SURVEY( HttpContex t.Current. User.Ident ity.Name,  UserSessio n.CurrentR egistryId,  surveysId );
  44  
  45                         ViewState[ "SURVEY"]  = survey;
  46                    }
  47  
  48                    retu rn survey;
  49                }
  50                  // D N S  - unused  method
  51                //set
  52                //{
  53                //    Vi ewState["S URVEY"] =  value;
  54                //}
  55           }
  56  
  57           pr ivate List <SURVEY_RE SULTS> RES ULTS
  58           {
  59                get
  60                {
  61                    List <SURVEY_RE SULTS> res ults = nul l;
  62  
  63                    if ( ViewState[ "RESULTS"]  != null)
  64                    {
  65                         results =  ViewState[ "RESULTS"]  as List<S URVEY_RESU LTS>;
  66                    }
  67                    else
  68                    {
  69                         int survey sId = 0;
  70  
  71                         if (!strin g.IsNullOr Empty(hide SurveyId.V alue))
  72                             int.Tr yParse(hid eSurveyId. Value.ToSt ring(), ou t surveysI d);
  73                         else
  74                         {
  75                             survey sId = User Session.Cu rrentSurve yId;
  76                             hideSu rveyId.Val ue = UserS ession.Cur rentSurvey Id.ToStrin g();
  77                         }
  78  
  79                         if (survey sId > 0)
  80                             result s = Servic eInterface Manager.SU RVEY_RESUL TS_GET_ALL _BY_SURVEY (HttpConte xt.Current .User.Iden tity.Name,  UserSessi on.Current RegistryId , surveysI d);
  81  
  82                         ViewState[ "RESULTS"]  = results ;
  83                    }
  84  
  85                    retu rn results ;
  86                }
  87                  // D N S  - unused  method
  88                //set
  89                //{
  90                //    Vi ewState["R ESULTS"] =  value;
  91                //}
  92           }
  93  
  94           pr otected ov erride voi d Page_Loa d(object s ender, Eve ntArgs e)
  95           {
  96                notesMan ager = new  NotesMana ger();
  97  
  98                if (!Pag e.IsPostBa ck)
  99                    Serv iceInterfa ceManager. LogInforma tion("PAGE _LOAD", St ring.Forma t("{0}.{1} ", System. Reflection .MethodBas e.GetCurre ntMethod() .Declaring Type.FullN ame, Syste m.Reflecti on.MethodB ase.GetCur rentMethod ().Name),  HttpContex t.Current. User.Ident ity.Name,  UserSessio n.CurrentR egistryId) ;
  100  
  101                try
  102                {
  103                    base .Page_Load (sender, e );
  104  
  105                    lblR esult.Text  = string. Empty;
  106  
  107                    if ( UserSessio n == null  || UserSes sion.Curre ntRegistry Id <= 0)
  108                    {
  109                         Response.R edirect("~ /Default.a spx", fals e);
  110                    }
  111                    else  if (UserS ession.Cur rentSurvey Id <= 0)
  112                    {
  113                         Response.R edirect("~ /Common/Su rveys.aspx ", false);
  114                    }
  115                    else
  116                    {
  117                         if (Servic eInterface Manager.US ER_ROLES_G ET_BY_REGI STRYID_USE RNAME_SET_ READONLY(H ttpContext .Current.U ser.Identi ty.Name, U serSession .CurrentRe gistryId))
  118                         {
  119                             SetRea dOnly();
  120                         }
  121                         if (!Page. IsPostBack )
  122                         {
  123                             //Buil dCommonMen u();
  124  
  125                             SetupF orm();
  126                         }
  127  
  128                         notesManag er.Patient CprsLoad() ;
  129                         SetupNoteS elections( );
  130                    }
  131                }
  132                catch (E xception e x)
  133                {
  134                    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, UserSes sion.Curre ntRegistry Id);
  135                    thro w ex;
  136                }
  137           }
  138  
  139           pr ivate void  SetReadOn ly()
  140           {
  141                lblResul t.Text = " You are no t able to  edit infor mation on  this page. <br /><br  />";
  142                ButtonCo ntinue.Vis ible = fal se;
  143           }
  144  
  145           pr otected vo id BtnCanc el_Click(o bject send er, EventA rgs e)
  146           {
  147                ServiceI nterfaceMa nager.LogI nformation ("POSTBACK _EVENT", S tring.Form at("{0}.{1 }", System .Reflectio n.MethodBa se.GetCurr entMethod( ).Declarin gType.Full Name, Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Name),  HttpConte xt.Current .User.Iden tity.Name,  UserSessi on.Current RegistryId );
  148  
  149                try
  150                {
  151                    User Session.Cu rrentSurve yId = 0;
  152                    Resp onse.Redir ect("~/Com mon/Survey s.aspx", f alse);
  153                }
  154                catch (E xception e x)
  155                {
  156                    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, UserSes sion.Curre ntRegistry Id);
  157                    thro w ex;
  158                }
  159           }
  160  
  161           pr ivate void  SetupNote Selections ()
  162           {
  163                ErrorPan el.Visible  = false;
  164  
  165                if (note sManager.V iaData !=  null)
  166                {
  167                    PATI ENT p = Se rviceInter faceManage r.PATIENT_ GET(HttpCo ntext.Curr ent.User.I dentity.Na me, UserSe ssion.Curr entRegistr yId, UserS ession.Cur rentPatien tId);
  168                    if ( p != null)
  169                    {
  170                         if (notesM anager.Via Data.Patie ntICN != p .PatientIC N)
  171                         {
  172                             PanelO bjectConte nt.Visible  = false;
  173                             pnlPat ientNoMatc h.Visible  = true;
  174                             pnlPat ientMatch. Visible =  false;
  175                             return ;
  176                         }
  177                         else
  178                         {
  179                             pnlPat ientNoMatc h.Visible  = false;
  180                             pnlPat ientMatch. Visible =  true;
  181                         }
  182                    }
  183                }
  184  
  185                if (!IsP ostBack)
  186                {
  187                    Radi oButtonLis tEncounter Type.Selec tedIndex =  -1;
  188                    Tabl eRowClinic Appointmen t.Visible  = false;
  189                    Tabl eRowHospit alAdmissio n.Visible  = false;
  190                    Tabl eRowUnsche duledNewVi sitLocatio n.Visible  = false;
  191                    Tabl eRowCosign er.Visible  = false;
  192  
  193                    //po pulate con sult drop  down list 
  194                    stri ng errorMe ssage = "" ;
  195  
  196                    try
  197                    {
  198                         //populate  note titl e drop dow n list
  199                         List<VIA.S tringKeyVa luePair> t itles = nu ll;
  200                         if (notesM anager !=  null)
  201                         {
  202                             if (tx tNoteSearc hFilter.Te xt == "")
  203                             {
  204                                 ti tles = not esManager. GetNoteTit lesFromVIA ("", "", o ut errorMe ssage);
  205                             }
  206                             else
  207                             {
  208                                 ti tles = not esManager. GetNoteTit lesFromVIA ("" + txtN oteSearchF ilter.Text  + "", "",  out error Message);
  209                                 tx tNoteSearc hFilter.Te xt = "";
  210                             }
  211  
  212                             if (er rorMessage  == "SUCCE SS")
  213                             {
  214                                 er rorMessage  = null;
  215                             }
  216  
  217                             if (St ring.IsNul lOrEmpty(e rrorMessag e))
  218                             {
  219                                 Dr opDownList NoteTitleI d.DataSour ce = title s;
  220                                 Dr opDownList NoteTitleI d.DataBind ();
  221                             }
  222                             else
  223                             {
  224                                 Pa nelObjectC ontent.Vis ible = fal se;
  225                                 Er rorPanel.V isible = t rue;
  226  
  227                                 Ca llError.Te xt = AntiX ssEnc.Enco der.HtmlEn code(error Message);
  228                                 re turn;
  229                             }
  230                         }
  231                         else
  232                         {
  233                             titles  = null;
  234                         }
  235  
  236                         int consul tCount = 0 ;
  237                         List<VIA.S tringKeyVa luePair> c onsults;
  238                         if (notesM anager !=  null)
  239                         {
  240                             consul ts = notes Manager.Ge tConsultsF romVIA(out  errorMess age); //tr y passing  noteid as  paramter
  241                                                                                                          //_con sultCount  = _notesMa nager.getC onsultsFro mVIA(out e rrorMessag e).Count;
  242  
  243                             if (co nsults !=  null) { co nsultCount  = consult s.Count; }
  244  
  245                             if (er rorMessage  == "SUCCE SS")
  246                             {
  247                                 er rorMessage  = null;
  248                             }
  249  
  250                             if (St ring.IsNul lOrEmpty(e rrorMessag e))
  251                             {
  252                                 Dr opDownList Consult.Da taSource =  consults;
  253                                 Dr opDownList Consult.Da taBind();
  254                             }
  255                             else
  256                             {
  257                                 // display er ror messag e and stop  processin g
  258                                 Pa nelObjectC ontent.Vis ible = fal se;
  259                                 Er rorPanel.V isible = t rue;
  260  
  261                                 re turn;
  262                             }
  263  
  264                             if (co nsultCount  == 0)
  265                             {
  266                                 La belforDrop DownListCo nsult.Visi ble = fals e;
  267                                 Dr opDownList Consult.Vi sible = fa lse;
  268                                 Re quiredFiel dValidator DropDownLi stConsult. Enabled =  false;
  269                             }
  270                             else
  271                             {
  272                                 La belforDrop DownListCo nsult.Visi ble = true ;
  273                                 Dr opDownList Consult.Vi sible = tr ue;
  274                                 Re quiredFiel dValidator DropDownLi stConsult. Enabled =  true;
  275                                 La belforDrop DownListCo nsult.Text  = "Link t o Consult: ";
  276                                 La belforDrop DownListCo nsult.Font .Bold = tr ue;
  277                             }
  278                         }
  279                         else
  280                         {
  281                             consul ts = null;
  282                         }
  283                    }
  284                    catc h (Excepti on ex)
  285                    {
  286                         PanelObjec tContent.V isible = f alse;
  287                         ErrorPanel .Visible =  true;
  288                         ServiceInt erfaceMana ger.LogErr or(ex.Mess age, Strin g.Format(" {0}.{1}",  System.Ref lection.Me thodBase.G etCurrentM ethod().De claringTyp e.FullName , System.R eflection. MethodBase .GetCurren tMethod(). Name), Htt pContext.C urrent.Use r.Identity .Name, Use rSession.C urrentRegi stryId);
  289                    }
  290                }
  291  
  292                if (note sManager.V iaData !=  null)
  293                {
  294                    Labe lPatient.T ext = Anti XssEnc.Enc oder.HtmlE ncode(note sManager.V iaData.Pat ientName);
  295                }
  296           }
  297  
  298           pr ivate void  SetupForm ()
  299           {
  300                tblForm. Visible =  false;
  301  
  302                viewPati ent.LoadFo rm(UserSes sion.Curre ntPatientI d);
  303  
  304                SURVEYS  survey = S URVEY;
  305                if (surv ey != null )
  306                {
  307                    tblF orm.Visibl e = true;
  308  
  309                    if ( survey.STD _SURVEY_TY PE != null )
  310                    {
  311                         lblPageTit le.Text =  AntiXssEnc .Encoder.H tmlEncode( survey.STD _SURVEY_TY PE.NAME);
  312                         txtNoteTem plate.Text  += lblPag eTitle.Tex t + Enviro nment.NewL ine + Envi ronment.Ne wLine;
  313                    }
  314  
  315                    List <SURVEY_RE SULTS> res ults = RES ULTS;
  316                    if ( results !=  null)
  317                    {
  318                         //Select d istinct qu estion ids
  319                         List<Int32 > question Ids = resu lts.Select (data => d ata.STD_QU ESTION_ID) .Distinct( ).ToList() ;
  320                         if (questi onIds != n ull && que stionIds.C ount > 0)
  321                         {
  322                             bool s howComment Box = fals e;
  323                             bool s howSeparat or = true;
  324  
  325                             foreac h (Int32 q uestionId  in questio nIds)
  326                             {
  327                                 Li st<SURVEY_ RESULTS> q uestions =  results.W here(data  => data.ST D_QUESTION _ID == que stionId).T oList();
  328                                 if  (question s != null  && questio ns.Count >  0)
  329                                 {
  330                                      Label lb l = new La bel();
  331  
  332                                      //Add qu estion num ber and te xt to tabl e
  333                                      STD_QUES TION stdQu estion = q uestions.F irst().STD _QUESTION;
  334                                      if (stdQ uestion !=  null)
  335                                      {
  336                                          if ( stdQuestio n.STD_QUES TION_TYPE_ ID == (int )SurveyQue stionTypes .MultipleC hoice)
  337                                          {
  338                                               //Multiple  Choice
  339                                               showCommen tBox = tru e;
  340                                               showSepara tor = true ;
  341  
  342                                               var contro l = (Contr ols.Survey .SurveyQue stionMulti pleChoice) LoadContro l("~/Contr ols/Survey /SurveyQue stionMulti pleChoice. ascx");
  343                                               control.Qu estions =  questions;
  344                                               string not e = contro l.BuildNot eTemplate( );
  345                                               txtNoteTem plate.Text  += note;
  346                                          }
  347                                          else  if (stdQu estion.STD _QUESTION_ TYPE_ID ==  (int)Surv eyQuestion Types.Scal e)
  348                                          {
  349                                               showCommen tBox = tru e;
  350                                               showSepara tor = true ;
  351  
  352                                               var contro l = (Contr ols.Survey .SurveyQue stionScale )LoadContr ol("~/Cont rols/Surve y/SurveyQu estionScal e.ascx");
  353                                               control.Qu estions =  questions;
  354                                               string not e = contro l.BuildNot eTemplate( );
  355                                               txtNoteTem plate.Text  += note;
  356                                          }
  357                                          else  if (stdQu estion.STD _QUESTION_ TYPE_ID ==  (int)Surv eyQuestion Types.Desc ription)
  358                                          {
  359                                               //Descript ion
  360                                               showCommen tBox = fal se;
  361                                               showSepara tor = fals e;
  362  
  363                                               var contro l = (Contr ols.Survey .SurveyQue stionDescr iption)Loa dControl(" ~/Controls /Survey/Su rveyQuesti onDescript ion.ascx") ;
  364                                               control.Qu estions =  questions;
  365                                               string not e = contro l.BuildNot eTemplate( );
  366                                               txtNoteTem plate.Text  += note;
  367                                          }
  368                                          else  if (stdQu estion.STD _QUESTION_ TYPE_ID ==  (int)Surv eyQuestion Types.Free Text)
  369                                          {
  370                                               //Free Tex t
  371                                               showCommen tBox = tru e;
  372                                               showSepara tor = true ;
  373  
  374                                               var contro l = (Contr ols.Survey .SurveyQue stionFreeT ext)LoadCo ntrol("~/C ontrols/Su rvey/Surve yQuestionF reeText.as cx");
  375                                               control.Qu estions =  questions;
  376                                               string not e = contro l.BuildNot eTemplate( );
  377  
  378                                               txtNoteTem plate.Text  += note;
  379                                          }
  380                                          else  if (stdQu estion.STD _QUESTION_ TYPE_ID ==  (int)Surv eyQuestion Types.Calc ulation)
  381                                          {
  382                                               showCommen tBox = fal se;
  383                                               showSepara tor = true ;
  384  
  385                                               var contro l = (Contr ols.Survey .SurveyQue stionCalcu lation)Loa dControl(" ~/Controls /Survey/Su rveyQuesti onCalculat ion.ascx") ;
  386                                               control.Qu estions =  questions;
  387                                               string not e = contro l.BuildNot eTemplate( );
  388  
  389                                               txtNoteTem plate.Text  += note;
  390                                          }
  391  
  392                                          #reg ion Add Co mment Text Box
  393                                          if ( showCommen tBox)
  394                                          {
  395                                               StringBuil der sbNote  = new Str ingBuilder ();
  396                                               string str Comment =  questions[ 0].COMMENT S_TEXT;
  397                                               if (!strin g.IsNullOr WhiteSpace (strCommen t))
  398                                               {
  399                                                   sbNote .AppendLin e("Comment s: " + str Comment);
  400                                                   txtNot eTemplate. Text += sb Note.ToStr ing();
  401                                               }
  402                                          }
  403                                          #end region
  404  
  405                                          if ( showSepara tor)
  406                                          {
  407                                               txtNoteTem plate.Text  += Enviro nment.NewL ine;
  408                                          }
  409                                      }
  410                                 }
  411                             }
  412                         }
  413                    }
  414                }
  415           }
  416  
  417           pr ivate void  FilterAnd BindVisits ()
  418           {
  419                //popula te Appoint ments drop  down list
  420                DateTime  toDate =  new DateTi me();
  421                DateTime  fromDate  = new Date Time();
  422                string e rrorMessag e = "";
  423  
  424                if (Text BoxAppoint mentSearch DateStart. Text != "" )
  425                {
  426                    from Date = Dat eTime.Pars e(TextBoxA ppointment SearchDate Start.Text );
  427                }
  428                else
  429                {
  430                    //if  user does  not enter  a date th en default  to 30 day s prior
  431                    if ( TextBoxApp ointmentSe archDateEn d.Text ==  "")
  432                    {
  433                         fromDate =  System.Da teTime.Now .AddDays(- 30);
  434                    }
  435                    else
  436                    {
  437                         fromDate =  DateTime. Parse(Text BoxAppoint mentSearch DateEnd.Te xt).AddDay s(-30);
  438                    }
  439                }
  440  
  441                if (Text BoxAppoint mentSearch DateEnd.Te xt != "")
  442                {
  443                    toDa te = DateT ime.Parse( TextBoxApp ointmentSe archDateEn d.Text);
  444                }
  445                else
  446                {
  447                    //if  user does  not enter  a date th en default  to 30 in  future
  448                    if ( TextBoxApp ointmentSe archDateSt art.Text = = "")
  449                    {
  450                         toDate = S ystem.Date Time.Now.A ddDays(30) ;
  451                    }
  452                    else
  453                    {
  454                         toDate = D ateTime.Pa rse(TextBo xAppointme ntSearchDa teStart.Te xt).AddDay s(30);
  455                    }
  456                }
  457  
  458                try
  459                {
  460                    var  visits = n ew List<VI A.StringKe yValuePair >();
  461  
  462                    visi ts = notes Manager.Ge tVisitsFro mVIA(fromD ate, toDat e, out err orMessage) ;
  463  
  464                    if ( errorMessa ge == "SUC CESS")
  465                    {
  466                         errorMessa ge = null;
  467                    }
  468  
  469                    if ( String.IsN ullOrEmpty (errorMess age))
  470                    {
  471                         DropDownLi stSchedule dClinicApp ointment.C learSelect ion();
  472                         DropDownLi stSchedule dClinicApp ointment.I tems.Clear ();
  473                         DropDownLi stSchedule dClinicApp ointment.I tems.Add(n ew ListIte m("-- Sele ct a Value  --", "0") );
  474  
  475                         //DropDown ListSchedu ledClinicA ppointment .DataSourc e = _notes Manager.ge tVisits(fr omDate.Get ValueOrDef ault(), to Date.GetVa lueOrDefau lt());
  476                         DropDownLi stSchedule dClinicApp ointment.D ataSource  = visits;
  477  
  478                         DropDownLi stSchedule dClinicApp ointment.D ataBind();
  479                    }
  480                    else
  481                    {
  482                         PanelObjec tContent.V isible = f alse;
  483                         ErrorPanel .Visible =  true;
  484  
  485                         return;
  486                    }
  487                }
  488                catch (E xception e x)
  489                {
  490                    Pane lObjectCon tent.Visib le = false ;
  491                    Erro rPanel.Vis ible = tru e;
  492                    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, UserSes sion.Curre ntRegistry Id);
  493                }
  494           }
  495  
  496           pr ivate void  FilterAnd BindLocati ons()
  497           {
  498                //popula te locatio n drop dow n list
  499                //DropDo wnListUnsc heduleNewV isitLocati on.DataSou rce = _not esManager. getLocatio ns(TextBox LocationSe archString .Text, "",  "1");
  500                string e rrorMessag e = "";
  501  
  502                var loca tions = ne w List<VIA .StringKey ValuePair> ();
  503  
  504                location s = notesM anager.Get LocationsF romVIA(Tex tBoxLocati onSearchSt ring.Text,  "1", out  errorMessa ge);
  505  
  506                try
  507                {
  508                    if ( errorMessa ge == "SUC CESS")
  509                    {
  510                         errorMessa ge = null;
  511                    }
  512  
  513                    if ( String.IsN ullOrEmpty (errorMess age))
  514                    {
  515                         DropDownLi stUnschedu leNewVisit Location.C learSelect ion();
  516                         DropDownLi stUnschedu leNewVisit Location.I tems.Clear ();
  517                         DropDownLi stUnschedu leNewVisit Location.I tems.Add(n ew ListIte m("-- Sele ct a Value  --", "0") );
  518  
  519                         DropDownLi stUnschedu leNewVisit Location.D ataSource  = location s;
  520                         DropDownLi stUnschedu leNewVisit Location.D ataBind();
  521                    }
  522                    else
  523                    {
  524                         PanelObjec tContent.V isible = f alse;
  525                         ErrorPanel .Visible =  true;
  526  
  527                         return;
  528                    }
  529                }
  530                catch (E xception e x)
  531                {
  532                    Pane lObjectCon tent.Visib le = false ;
  533                    Erro rPanel.Vis ible = tru e;
  534                    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, UserSes sion.Curre ntRegistry Id);
  535                    Call Error.Text  = ex.Mess age;
  536                }
  537           }
  538  
  539           pr otected vo id RadioBu ttonListEn counterTyp e_Selected IndexChang ed(object  sender, Ev entArgs e)
  540           {
  541                ButtonCo ntinue.Vis ible = fal se;
  542  
  543                TableRow ClinicAppo intment.Vi sible = fa lse;
  544                TableRow HospitalAd mission.Vi sible = fa lse;
  545                TableRow Unschedule dNewVisitL ocation.Vi sible = fa lse;
  546  
  547                int enco unterTypeS elected =
  548                Helpers. GetIntFrom String(Rad ioButtonLi stEncounte rType.Sele ctedValue) ;
  549  
  550                string e rrorMessag e = "";
  551  
  552                if (enco unterTypeS elected !=  (int)Note TypeEnum.S cheduledCl inicAppoin tment)
  553                {
  554                    Text BoxAppoint mentSearch DateStart. Text = "";
  555                    Text BoxAppoint mentSearch DateEnd.Te xt = "";
  556                }
  557  
  558                switch ( encounterT ypeSelecte d)
  559                {
  560                    case  (int)Note TypeEnum.S cheduledCl inicAppoin tment:  // Scheduled  Clinic App ointment
  561                         TableRowCl inicAppoin tment.Visi ble = true ;
  562  
  563                         FilterAndB indVisits( );
  564  
  565                         break;
  566  
  567                    case  (int)Note TypeEnum.H ospitalAdm ission:  / /Hospital  Admission
  568                         TableRowHo spitalAdmi ssion.Visi ble = true ;
  569  
  570                         //populate  hospital  admission  drop down  list
  571                         try
  572                         {
  573                             var ad missions =  new List< VIA.String KeyValuePa ir>();
  574  
  575                             admiss ions = not esManager. GetHospita lAdmission sFromVIA(o ut errorMe ssage);
  576  
  577                             if (er rorMessage  == "SUCCE SS")
  578                             {
  579                                 er rorMessage  = null;
  580                             }
  581  
  582                             if (St ring.IsNul lOrEmpty(e rrorMessag e))
  583                             {
  584                                 Dr opDownList HospitalAd mission.Da taSource =  admission s;
  585                                 Dr opDownList HospitalAd mission.Da taBind();
  586                             }
  587                             else
  588                             {
  589                                 Pa nelObjectC ontent.Vis ible = fal se;
  590                                 Er rorPanel.V isible = t rue;
  591  
  592                                 Ca llError.Te xt = AntiX ssEnc.Enco der.HtmlEn code(error Message);
  593                                 re turn;
  594                             }
  595                         }
  596                         catch (Exc eption ex)
  597                         {
  598                             PanelO bjectConte nt.Visible  = false;
  599                             ErrorP anel.Visib le = true;
  600                             Servic eInterface Manager.Lo gError(ex. Message, S tring.Form at("{0}.{1 }", System .Reflectio n.MethodBa se.GetCurr entMethod( ).Declarin gType.Full Name, Syst em.Reflect ion.Method Base.GetCu rrentMetho d().Name),  HttpConte xt.Current .User.Iden tity.Name,  UserSessi on.Current RegistryId );
  601  
  602                             CallEr ror.Text =  ex.Messag e;
  603                         }
  604                         break;
  605  
  606                    case  (int)Note TypeEnum.C urrentStay :  //Curre nt Stay
  607  
  608                         if (string .IsNullOrE mpty(notes Manager.Vi aData.Pati entLocatio nId) || st ring.IsNul lOrEmpty(n otesManage r.ViaData. PatientAdm itTimeStam p))
  609                         {
  610                             ErrorP anel.Visib le = true;
  611                             CallEr ror.Text =  "This pat ient does  not have a  current s tay availa ble, pleas e select a  different  Encounter  Type";
  612                             RadioB uttonListE ncounterTy pe.ClearSe lection();
  613                         }
  614  
  615                         break;
  616  
  617                    case  (int)Note TypeEnum.U nscheduled OrNewVisit : //Unsche duled or N ew Visit
  618                         TableRowUn scheduledN ewVisitLoc ation.Visi ble = true ;
  619  
  620                         FilterAndB indLocatio ns();
  621  
  622                         break;
  623                }
  624  
  625                ButtonCo ntinue.Vis ible = tru e;
  626           }
  627  
  628           pr otected vo id Filter_ NoteSearch (object se nder, Even tArgs e)
  629           {
  630                //Get th e text fro m text box
  631  
  632                //Previe w the text  and show  it in Div
  633                string e rrorMessag e = "";
  634                try
  635                {
  636                    if ( IsPostBack )
  637                    {
  638                         object tit les = null ;
  639  
  640                         string fil ter_text =  null;
  641                         if (notesM anager !=  null)
  642                         {
  643                             //filt er_text =  ((TextBox) sender).Te xt;
  644                             filter _text = tx tNoteSearc hFilter.Te xt;
  645                             if (fi lter_text  != null)
  646                             {
  647                                 if  (DropDown ListNoteTi tleId.Item s.Count >  0)
  648                                 {
  649                                      DropDown ListNoteTi tleId.Item s.Clear();
  650                                      DropDown ListNoteTi tleId.Item s.Add(new  ListItem(" -- Select  a Value -- ", "0"));
  651                                 }
  652  
  653                                 ti tles = not esManager. GetNoteTit lesFromVIA ("" + filt er_text +  "", "", ou t errorMes sage);
  654  
  655                                 if  (errorMes sage == "S UCCESS")
  656                                 {
  657                                      errorMes sage = nul l;
  658                                 }
  659  
  660                                 if  (String.I sNullOrEmp ty(errorMe ssage))
  661                                 {
  662                                      DropDown ListNoteTi tleId.Data Source = t itles;
  663                                      DropDown ListNoteTi tleId.Data Bind();
  664                                 }
  665                                 el se
  666                                 {
  667                                      PanelObj ectContent .Visible =  false;
  668                                      ErrorPan el.Visible  = true;
  669  
  670                                      CallErro r.Text = A ntiXssEnc. Encoder.Ht mlEncode(e rrorMessag e);
  671                                      return;
  672                                 }
  673                             }
  674                         }
  675                         else
  676                         {
  677                             titles  = null;
  678                         }
  679                    }
  680                }
  681                catch (E xception e x)
  682                {
  683                    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, UserSes sion.Curre ntRegistry Id);
  684                    thro w ex;
  685                }
  686           }
  687  
  688           pr otected vo id DropDow nListNoteT itleId_Sel ectedIndex Changed(ob ject sende r, EventAr gs e)
  689           {
  690                string e rrorMessag e = "";
  691                string n otetitle =  "";
  692  
  693                try
  694                {
  695                    if ( DropDownLi stNoteTitl eId.Select edValue !=  "0")
  696                    {
  697                         notesManag er.ViaData .SelectedN oteTitleId  = DropDow nListNoteT itleId.Sel ectedValue ;
  698  
  699                         bool needC osigner =  false;
  700  
  701                         //if (getC urrentServ iceToUse()  == "VIA")
  702                         //{
  703                         //    need Cosigner =  _notesMan ager.isCos ignerRequi redVIA(_no tesManager .TbiServic eTo, out e rrorMessag e);
  704                         //}
  705                         //else
  706                         //{
  707                         //    need Cosigner =  _notesMan ager.isCos ignerRequi red(_notes Manager.Tb iServiceTo , out erro rMessage);
  708                         //}
  709  
  710                         if (errorM essage ==  "SUCCESS")
  711                         {
  712                             errorM essage = n ull;
  713                         }
  714  
  715                         if (String .IsNullOrE mpty(error Message))
  716                         {
  717                             if (Dr opDownList NoteTitleI d.Selected Item != nu ll)
  718                             {
  719                                 no tetitle =  DropDownLi stNoteTitl eId.Select edItem.Tex t.ToString ().ToUpper ();
  720  
  721                                 is consultnot etitle = n otetitle.C ontains("C ONSULT");
  722                             }
  723  
  724                             if (ne edCosigner )
  725                             {
  726                                 Bu ttonContin ue.Visible  = false;
  727  
  728                                 Ta bleRowCosi gner.Visib le = true;
  729  
  730                                 // FilterAndB indCosigne rs();
  731  
  732                                 Bu ttonContin ue.Visible  = true;
  733                             }
  734                             else
  735                             {
  736                                 Ta bleRowCosi gner.Visib le = false ;
  737                             }
  738  
  739                             if (is consultnot etitle ==  true)
  740                             {
  741                                 La belforDrop DownListCo nsult.Visi ble = true ;
  742                                 Dr opDownList Consult.Vi sible = tr ue;
  743                                 La belforDrop DownListCo nsult.Text  = "Link t o Consult  *:";
  744                                 La belforDrop DownListCo nsult.Font .Bold = tr ue;
  745                                 Dr opDownList Consult.Se lectedInde x = 0;
  746                                 Re quiredFiel dValidator DropDownLi stConsult. Enabled =  true;
  747                             }
  748                             else
  749                             {
  750                                 La belforDrop DownListCo nsult.Visi ble = fals e;
  751                                 Dr opDownList Consult.Vi sible = fa lse;
  752                                 Re quiredFiel dValidator DropDownLi stConsult. Enabled =  false;
  753                             }
  754                         }
  755                         else
  756                         {
  757                             PanelO bjectConte nt.Visible  = false;
  758                             ErrorP anel.Visib le = true;
  759  
  760                             CallEr ror.Text =  errorMess age;
  761                         }
  762                    }
  763                    else
  764                    {
  765                         TableRowCo signer.Vis ible = fal se;
  766                    }
  767                }
  768                catch (E xception e x)
  769                {
  770                    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, UserSes sion.Curre ntRegistry Id);
  771                    thro w ex;
  772                }
  773           }
  774  
  775           pr otected vo id ButtonF ilterAppoi ntments_Cl ick(object  sender, E ventArgs e )
  776           {
  777                FilterAn dBindVisit s();
  778           }
  779  
  780           pr otected vo id ButtonG etLocation s_Click(ob ject sende r, EventAr gs e)
  781           {
  782                FilterAn dBindLocat ions();
  783           }
  784  
  785           pr otected vo id ButtonG etCPRSUser s_Click(ob ject sende r, EventAr gs e)
  786           {
  787                //Filter AndBindCos igners();
  788           }
  789  
  790           pr otected vo id ButtonC ontinue_Cl ick(object  sender, E ventArgs e )
  791           {
  792                try
  793                {
  794                    if ( DropDownLi stCosigner .SelectedV alue != "0 ")
  795                    {
  796                         notesManag er.ViaData .SelectedC osignerID  = DropDown ListCosign er.Selecte dValue;
  797                    }
  798  
  799                    if ( DropDownLi stNoteTitl eId.Select edValue !=  "0")
  800                    {
  801                         notesManag er.ViaData .SelectedN oteTitleId  = DropDow nListNoteT itleId.Sel ectedValue ;
  802                    }
  803  
  804                    if ( DropDownLi stConsult. SelectedVa lue != "0" )
  805                    {
  806                         notesManag er.ViaData .SelectedC onsultId =  DropDownL istConsult .SelectedV alue;
  807                    }
  808  
  809                    if ( DropDownLi stSchedule dClinicApp ointment.S electedVal ue != "0")
  810                    {
  811                         notesManag er.ViaData .SelectedV isitId = D ropDownLis tScheduled ClinicAppo intment.Se lectedValu e;
  812                    }
  813  
  814                    if ( DropDownLi stHospital Admission. SelectedVa lue != "0" )
  815                    {
  816                         notesManag er.ViaData .SelectedH ospitalAdm issionId =  DropDownL istHospita lAdmission .SelectedV alue;
  817                    }
  818  
  819                    if ( DropDownLi stUnschedu leNewVisit Location.S electedVal ue != "0")
  820                    {
  821                         notesManag er.ViaData .SelectedL ocationID  = DropDown ListUnsche duleNewVis itLocation .SelectedV alue;
  822                    }
  823  
  824                    note sManager.V iaData.IsH istorical  = CheckBox Unschedule dNewVisitH istorical. Checked;
  825  
  826                    if ( RadioButto nListEncou nterType.S electedInd ex != -1)
  827                    {
  828                         NoteType s electedNot eType = ne w NoteType ();
  829                         selectedNo teType.Id  = RadioBut tonListEnc ounterType .SelectedI ndex;
  830  
  831                         notesManag er.ViaData .SelectedN oteType =  selectedNo teType;
  832                    }
  833  
  834                    //no tesManager .AddToSess ionViaData (notesMana ger.ViaDat a);
  835                    //// ViaService Data viaDa ta = notes Manager.Ge tViaDataFr omSession( );
  836                    //Vi aServiceDa ta viaData  = notesMa nager.ViaD ata;
  837                    //no tesManager .AddToSess ionViaData (viaData);
  838  
  839                    note sManager.V iaData.Not eText = tx tNoteTempl ate.Text;
  840  
  841                    if ( notesManag er.ViaData  != null)
  842                    {
  843                         //Logging. WriteLogTo File("VIA  submission -Text: " +  viaData.N oteText);
  844  
  845                         // VIA
  846  
  847                         //notesMan ager.LoadV iaData(via Data);
  848                         notesManag er.LoadVia Data();
  849  
  850                         //VIA.note ResultTO r esult = nu ll;
  851                         //result =  notesMana ger.WriteN oteWithVIA (viaData);
  852                         //result =  notesMana ger.WriteN oteWithVIA ();
  853                         notesManag er.WriteNo teWithVIA( );
  854  
  855                         lblResult. Text = "No te has bee n successf ully uploa ded to CPR S.";
  856  
  857                         //if (_res ult.fault  == null)
  858                         //{
  859                         //    surv ey = Sessi on["survey "] as SURV EY;
  860                         //    if ( survey !=  null)
  861                         //    {
  862                         //         survey.Set AsChangeTr ackingRoot ();
  863                         //         survey.SUR VEY_STATUS  = "comple ted";
  864  
  865                         //         SURVEY_NOT E note = n ew SURVEY_ NOTE();
  866  
  867                         //         note.NOTES _TEXT = vi aData.Note Text;
  868                         //         note.ENTRY _DATE = Da teTime.Tod ay;
  869                         //         note.NOTE_ DATE = Dat eTime.Toda y;
  870                         //         note.STD_I NSTITUTION _ID = 1000 001;
  871                         //         survey.SUR VEY_NOTEs. Add(note);
  872  
  873                         //         _notesMana ger.Update (survey);
  874                         //         //SubmitNo teButton.E nabled = f alse;
  875                         //    }
  876  
  877                         //    Sess ion.Remove ("survey") ;
  878  
  879                         //    Logg ing.WriteL ogToFile(" Completed  note submi ssion and  writing su rvey data" );
  880  
  881                         //    stri ng script  = "<script  language= \"javascri pt\"  type =\"text/ja vascript\" >window.op en('','_se lf','');wi ndow.close ();</scrip t>";
  882                         //    Scri ptManager. RegisterSt artupScrip t(Page, th is.GetType (), "close Page", scr ipt, false );
  883                         //}
  884                         //else
  885                         //{
  886  
  887                         //    Logg ing.WriteL ogToFile(" Error subm itting not e: " + _re sult.fault .message);
  888  
  889                         //    Surv eyNoteErro r.Text = " Error: " +  _result.f ault.messa ge;
  890                         //    Erro rPanel.Vis ible = tru e;
  891                         //    //Bu ttonsPanel .Visible =  false;
  892                         //    //Su rveyNoteHT ML.Visible  = false;
  893                         //}
  894                    }
  895                    //}
  896                }
  897                catch (E xception e x)
  898                {
  899                    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, UserSes sion.Curre ntRegistry Id);
  900                }
  901           }
  902       }
  903   }