5. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2018 3:28:15 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.

5.1 Files compared

# Location File Last Modified
1 VSE_P2_SD5.3686_v8.zip\ClinSchd\Desktop\ClinSchd.Modules.VAR\Services VARWebServiceAPIService - DummyData.cs Thu Nov 29 20:56:04 2018 UTC
2 VSE_P2_SD5.3686_v8.zip\ClinSchd\Desktop\ClinSchd.Modules.VAR\Services VARWebServiceAPIService - DummyData.cs Wed Dec 5 16:27:07 2018 UTC

5.2 Comparison summary

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

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

5.4 Active regular expressions

No regular expressions were active.

5.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.Threadi ng.Tasks;
  6  
  7   using Clin Schd.Infra structure;
  8   using Clin Schd.Modul es.VAR.Mod els;
  9  
  10   using Syst em.Service Model;
  11   using Syst em.Securit y.Cryptogr aphy.X509C ertificate s;
  12   using VSE_ VAR_Servic e;
  13  
  14   namespace  ClinSchd.M odules.VAR .Services
  15   {
  16       intern al class W ebServiceC allingExce ption : Ex ception {  }
  17  
  18       intern al class W ebServiceR eturnedExc eption : E xception {  }
  19  
  20       intern al class P ATIENT
  21       {
  22           pu blic strin g PATIENT_ ID { get;  set; }
  23           pu blic strin g FIRST_NA ME { get;  set; }
  24           pu blic strin g LAST_NAM E { get; s et; }
  25           pu blic strin g SSN { ge t; set; }
  26           pu blic DateT ime DOB {  get; set;  }
  27           pu blic Int16  TEXT_MESS AGING_ALLO WED { get;  set; }
  28           pu blic strin g TEXT_MES SAGING_PHO NE_NUMBER  { get; set ; }
  29  
  30           pu blic PATIE NT(string  source)
  31           {
  32                string[]  parts = s ource.Spli t('^');
  33                PATIENT_ ID = parts [0];
  34                FIRST_NA ME = parts [1];
  35                LAST_NAM E = parts[ 2];
  36                SSN = pa rts[3];
  37                DOB = VA RWebServic eAPIServic e.FromExce lSerialDat e(Convert. ToInt32(pa rts[4]));
  38                TEXT_MES SAGING_ALL OWED = Con vert.ToInt 16(parts[5 ]);
  39                TEXT_MES SAGING_PHO NE_NUMBER  = parts[6] ;
  40           }
  41       }
  42  
  43       intern al class V ARWebServi ceAPIServi ce : IVARW ebServiceA PIService
  44       {
  45           pr ivate stat ic Random  _random =  new Random ();
  46           pu blic stati c DateTime  FromExcel SerialDate (int seria lDate)
  47           {
  48                if (seri alDate > 5 9)
  49                    seri alDate -=  1; //Excel /Lotus 02/ 29/1900 bu g
  50  
  51                return n ew DateTim e(1899, 12 , 31).AddD ays(serial Date);
  52           }
  53  
  54           pr ivate List <string> R equestData  = new Lis t<string>( ) {
  55                $"100^50 0^43103^43 103^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(333) 33 3-3333^1^( 333) 333-3 333^Medica l Concern^ ^Office Vi sit^BOOK_A NY_PROVIDE R^Book app ointment w ith any av ailable pr ovider^^^0 ^NULL^1^0^ 0^1^NULL",
  56                $"101^50 1^43115^43 115^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(444) 22 2-9090^0^^ Mental Hea lth^^Phone  Call^BOOK _ANY_PROVI DER^^^^0^N ULL^0^0^0^ 0^NULL",
  57                $"102^50 2^43121^43 121^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(666) 66 6-6666^1^( 666) 666-6 666^Medica l Concern^ ^Phone Cal l^BOOK_ANY _PROVIDER^ Book appoi ntment wit h any avai lable prov ider^^^0^N ULL^0^0^0^ 0^NULL",
  58                $"103^50 0^43099^43 099^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(333) 33 3-3333^1^( 333) 333-3 333^Medica l Concern^ ^Office Vi sit^BOOK_A NY_PROVIDE R^^^^0^NUL L^0^0^0^1^ NULL",
  59                $"104^50 1^43111^43 111^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(444) 22 2-9090^0^^ Mental Hea lth^^Offic e Visit^BO OK_ANY_PRO VIDER^Book  appointme nt with an y availabl e provider ^^^0^NULL^ 0^0^0^1^NU LL",
  60                $"105^50 2^43093^43 093^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(666) 66 6-6666^1^( 666) 666-6 666^Medica l Concern^ ^Phone Cal l^BOOK_ANY _PROVIDER^ Book appoi ntment wit h any avai lable prov ider^^^0^N ULL^1^0^0^ 0^NULL",
  61                $"106^50 0^43122^43 122^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(333) 33 3-3333^1^( 333) 333-3 333^Medica l Concern^ ^Office Vi sit^BOOK_A NY_PROVIDE R^^^^0^NUL L^0^0^0^1^ NULL",
  62                $"107^50 1^43125^43 125^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(444) 22 2-9090^0^^ Mental Hea lth^^Phone  Call^BOOK _ANY_PROVI DER^^^^0^N ULL^0^0^0^ 1^NULL",
  63                $"108^50 2^43130^43 130^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(666) 66 6-6666^1^( 666) 666-6 666^Medica l Concern^ ^Office Vi sit^BOOK_A NY_PROVIDE R^Book app ointment w ith any av ailable pr ovider^^^0 ^NULL^0^0^ 0^0^NULL",
  64                $"109^50 0^43102^43 102^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(333) 33 3-3333^1^( 333) 333-3 333^Medica l Concern^ ^Office Vi sit^BOOK_A NY_PROVIDE R^^^^0^NUL L^0^0^0^1^ NULL",
  65                $"110^50 1^43103^43 103^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(444) 22 2-9090^0^^ Medical Co ncern^^Off ice Visit^ BOOK_ANY_P ROVIDER^Bo ok appoint ment with  any availa ble provid er^^^0^NUL L^1^0^0^1^ NULL",
  66                $"111^50 2^43116^43 116^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(666) 66 6-6666^1^( 666) 666-6 666^Medica l Concern^ ^Phone Cal l^BOOK_ANY _PROVIDER^ Book appoi ntment wit h any avai lable prov ider^^^0^N ULL^0^0^0^ 0^NULL",
  67                $"112^50 0^43097^43 097^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(333) 33 3-3333^1^( 333) 333-3 333^Mental  Health^^O ffice Visi t^BOOK_ANY _PROVIDER^ ^^^0^NULL^ 0^0^0^0^NU LL",
  68                $"113^50 1^43107^43 107^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(444) 22 2-9090^0^^ Medical Co ncern^^Off ice Visit^ BOOK_ANY_P ROVIDER^Bo ok appoint ment with  any availa ble provid er^^^0^NUL L^0^0^0^1^ NULL",
  69                $"114^50 2^43129^43 129^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Submitted^ Primary Ca re^759^NUL L^(666) 66 6-6666^1^( 666) 666-6 666^Medica l Concern^ ^Phone Cal l^BOOK_ANY _PROVIDER^ ^^^0^NULL^ 0^0^0^0^NU LL",
  70  
  71                $"115^50 0^43102^43 102^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Booked^Pri mary Care^ 759^NULL^( 333) 333-3 333^1^(333 ) 333-3333 ^Medical C oncern^^Of fice Visit ^BOOK_ANY_ PROVIDER^^ ^^0^NULL^0 ^0^0^1^NUL L",
  72                $"116^50 2^43129^43 129^NULL^1 ^0^NULL^NU LL^{DateTi me.Today.A ddDays(_ra ndom.Next( 1, 10)).To ShortDateS tring()}^A M^{DateTim e.Today.Ad dDays(_ran dom.Next(1 , 10)).ToS hortDateSt ring()}^PM ^{DateTime .Today.Add Days(_rand om.Next(1,  10)).ToSh ortDateStr ing()}^AM^ Booked^Pri mary Care^ 759^NULL^( 666) 666-6 666^1^(666 ) 666-6666 ^Medical C oncern^^Ph one Call^B OOK_ANY_PR OVIDER^^^^ 0^NULL^0^0 ^0^0^NULL"
  73           };
  74  
  75           pr ivate List <string> B estTimesTo CallData =  new List< string>()
  76           {
  77                "100^9 A M - 11 AM" ,
  78                "100^11  AM - 1PM",
  79                "101^1 P M - 3 PM",
  80                "101^3 P M - 4 PM",
  81                "102^9 A M - 11 AM" ,
  82                "102^1 P M - 3 PM",
  83                "103^11  am - 1PM",
  84                "103^3 P M - 4 PM",
  85                "104^9 A M - 11 AM" ,
  86                "104^3 P M - 4 PM",
  87                "105^11  AM - 1PM",
  88                "105^1 P M - 3 PM",
  89  
  90                "106^9 A M - 11 AM" ,
  91                "106^11  AM - 1PM",
  92                "107^1 P M - 3 PM",
  93                "107^3 P M - 4 PM",
  94                "108^9 A M - 11 AM" ,
  95                "108^1 P M - 3 PM",
  96                "109^11  AM - 1PM",
  97                "109^3 P M - 4 PM",
  98                "110^9 A M - 11 AM" ,
  99                "110^3 P M - 4 PM",
  100                "111^11  AM - 1PM",
  101                "111^1 P M - 3 PM",
  102  
  103                "113^9 A M - 11 AM" ,
  104                "113^11  AM - 1PM",
  105                "114^1 P M - 3 PM",
  106                "114^3 P M - 4 PM"
  107           };
  108  
  109           pr ivate List <string> P atientData  = new Lis t<string>( )
  110           {
  111                "500^BRE T^SMITH^26 5482812^20 868^1^(333 ) 333-3333 ",
  112                "501^VSE ^TEST PATI ENT ELEVEN ^666663244 ^21947^0^0 ",
  113                "502^PLA CKER^KERMI T E^101271 381^4982^1 ^(666) 66- 6666"
  114           };
  115  
  116           pr ivate List <string> D etCodeData  = new Lis t<string>( )
  117           {
  118                //"DETAI L_CODE_ID^ PROVIDER_M ESSAGE^VET ERAN_MESSA GE"
  119                "DETCODE 1^Made on  requested  date^Your  appointmen t was book ed based u pon your r equest for  an appoin tment on %  s % s.Ple ase use th e Appointm ents featu re on the  previous s creen to s ee more in formation  on this an d other ap pointments  booked at  VA health care facil ities.",
  120                "DETCODE 10^Type of  Visit cha nged to Te lephone Vi sit^Your r equest for  a Video C onference  was change d to a Tel ephone Vis it.Either  the facili ty or prov ider reque sted curre ntly are n ot providi ng Video C onference  appointmen ts.",
  121                "DETCODE 11^Type of  Visit cha nged to Te lephone Vi sit.Booked  on altern ate date a fter telep hone conve rsation.^Y our reques t for a Vi deo Confer ence was c hanged to  a Telephon e Visit.Ei ther the f acility or  provider  requested  currently  are not pr oviding Vi deo Confer ence appoi ntments.Ba sed upon a  telephone  call with  you, an a ppointment  has been  booked at  a time oth er than yo ur origina l request. Please use  the Appoi ntments fe ature on t he previou s screen t o see more  informati on on this  and other  appointme nts at VA  healthcare  facilitie s.",
  122                "DETCODE 12^Booked  on alterna te date.^Y our appoin tment has  been booke d at a tim e other th an your or iginal req uest.Pleas e use the  Appointmen ts feature  on the pr evious scr een to see  more info rmation on  this and  other appo intments a t VA healt hcare faci lities.",
  123                "DETCODE 13^Type of  Visit cha nged to Te lephone Vi sit.Booked  on altern ate date.^ Your reque st for a V ideo Confe rence was  changed to  a Telepho ne Visit.E ither the  facility o r provider  requested  currently  are not p roviding V ideo Confe rence appo intments.A lso, your  appointmen t has been  booked at  a time ot her than y our origin al request .Please us e the Appo intments f eature on  the previo us screen  to see mor e informat ion on thi s and othe r appointm ents at VA  healthcar e faciliti es.",
  124                "DETCODE 2^Alternat ive date a fter calli ng Veteran ^Based upo n a teleph one call w ith you, a n appointm ent has be en booked  at a time  other than  your orig inal reque st.Please  use the Ap pointments  feature o n the prev ious scree n to see m ore inform ation on t his and ot her appoin tments at  VA healthc are facili ties.",
  125                "DETCODE 3^Unable t o meet req uest, Firs t Attempt^ We were un able to bo ok you an  appointmen t at the t imes or wi th the pro vider requ ested.",
  126                "DETCODE 4^Not book ed, unable  to contac t Veteran^ We were un able to co ntact you  at the pho ne number  provided t o discuss  your appoi ntment.We  apologize  for not be ing able t o book thi s second r equest for  an appoin tment.  Yo u can call  the facil ity to dis cuss sched uling opti ons for yo ur current  need or y ou can sta rt a new a ppointment  request u sing this  applicatio n.",
  127                "DETCODE 5^Cancelle d by Clini c^Regretta bly, the c linic had  to cancel  your appoi ntment.You  can eithe r call the  facility  to resched ule or you  can make  a new appo intment re quest thro ugh this a pp.",
  128                "DETCODE 6^Cancelle d at Veter an Request ^Based upo n your req uest durin g a teleph one call,  this appoi ntment has  been canc elled.",
  129                "DETCODE 7^Cancelle d by Veter an -VA Con firmed^Thi s message  confirms t hat VA has  received  your reque st to canc el the app ointment t hat was pr eviously b ooked.",
  130                "DETCODE 8^Cancelle d by Veter an -Pendin g^Your req uest to ca ncel this  appointmen t has been  sent.",
  131                "DETCODE 9^Unable t o meet req uest, Firs t Attempt^ This reque st is no l onger acti ve.The new  request h as been ad ded to you r list.Ple ase check  that reque st for fur ther updat es."
  132           };
  133  
  134           pr ivate List <string> M essageData  = new Lis t<string>( )
  135           {
  136                "100^100 ^500^This  is a messa ge from th e Veteran^ 43103",
  137                "101^100 ^25^This i s a messag e from a S cheduler^4 3104",
  138                "102^100 ^500^This  is a 2nd m essage fro m the Vete ran^43105" ,
  139  
  140                "103^105 ^502^This  is a messa ge from th e Veteran^ 43103",
  141                "104^105 ^25^This i s a messag e from a S cheduler^4 3104",
  142                "105^105 ^502^This  is a 2nd m essage fro m the Vete ran^43105" ,
  143  
  144                "106^110 ^501^This  is a messa ge from th e Veteran^ 43103",
  145                "107^110 ^25^This i s a messag e from a S cheduler^4 3104",
  146                "108^110 ^501^This  is a 2nd m essage fro m the Vete ran^43105"
  147           };
  148  
  149           pr ivate List <string> L ockData =  new List<s tring>()
  150           {
  151                "106^HIL LHOUSE,JOS EPH",
  152                "113^TAY LOR,JAMES"
  153           };
  154  
  155           pr ivate List <APPOINTME NT_REQUEST > RequestL ist = new  List<APPOI NTMENT_REQ UEST>();
  156           pr ivate List <PATIENT>  PatientLis t = new Li st<PATIENT >();
  157           pr ivate List <APPOINTME NT_REQUEST _MESSAGE>  RequestMes sages = ne w List<APP OINTMENT_R EQUEST_MES SAGE>();
  158  
  159  
  160           #r egion enum s
  161  
  162           pr ivate enum  webServic eMethods
  163           {
  164                GetAppoi ntmentRequ estCount,
  165                GetAppoi ntmentRequ estList,
  166                GetAppoi ntmentRequ est,
  167                GetDetai lCodeList,
  168                BookAppo intment,
  169                NotBookA ppointment ,
  170                UnlockAp pointment
  171           }
  172  
  173           #e ndregion e nums
  174  
  175           #r egion stat ic members
  176  
  177           #e ndregion s tatic memb ers
  178  
  179           #r egion priv ate fields
  180  
  181           pr ivate IVSE _Informati on _vseInf ormation =  null;
  182           pr ivate ILis t<DETAIL_C ODE> _deta ilCodeList  = new Lis t<DETAIL_C ODE>();
  183           pr ivate Exce ption _ser viceExcept ion = null ;
  184  
  185  
  186           #e ndregion p rivate fie lds
  187  
  188           #r egion cons tructor
  189  
  190           pu blic VARWe bServiceAP IService(I VSE_Inform ation vseI nformation )
  191           {
  192                _vseInfo rmation =  vseInforma tion;
  193  
  194                foreach( string mes sage in Me ssageData)
  195                {
  196                    stri ng[] messa geParts =  message.Sp lit('^');
  197  
  198                    Requ estMessage s.Add(
  199                         new APPOIN TMENT_REQU EST_MESSAG E()
  200                         {
  201                             ID = m essagePart s[0],
  202                             APPOIN TMENT_REQU EST_ID = m essagePart s[1],
  203                             SENDER _ID = mess ageParts[2 ],
  204                             MESSAG E_TEXT = m essagePart s[3],
  205                             MESSAG E_DATE_TIM E = FromEx celSerialD ate(Conver t.ToInt32( messagePar ts[4]))
  206                         }
  207                    );
  208                }
  209  
  210                foreach( string req uest in Re questData)
  211                {
  212                    stri ng[] parts  = request .Split('^' );
  213                    Date Time? null Date = nul l;
  214                    try
  215                    {
  216  
  217                         APPOINTMEN T_REQUEST  r = new AP POINTMENT_ REQUEST()
  218                         {
  219                             APPOIN TMENT_REQU EST_ID = p arts[0],
  220                             PATIEN T_ID = par ts[1],
  221                             LAST_U PDATED_DAT E = FromEx celSerialD ate(Conver t.ToInt32( parts[2])) ,
  222                             CREATE D_DATE = F romExcelSe rialDate(C onvert.ToI nt32(parts [3])),
  223                             DELETE D_DATE = ( string.IsN ullOrEmpty (parts[4])  ? nullDat e : ((part s[4] == "N ULL") ? nu llDate : F romExcelSe rialDate(C onvert.ToI nt32(parts [4])))),
  224                             ACTIVE  = Convert .ToInt16(p arts[5]),
  225                             SECOND _REQUEST =  Convert.T oInt16(par ts[6]),
  226                             APPOIN TMENT_DATE  = parts[7 ],
  227                             APPOIN TMENT_TIME  = parts[8 ],
  228                             OPTION _DATE_1 =  parts[9],
  229                             OPTION _TIME_1 =  parts[10],
  230                             OPTION _DATE_2 =  parts[11],
  231                             OPTION _TIME_2 =  parts[12],
  232                             OPTION _DATE_3 =  parts[13],
  233                             OPTION _TIME_3 =  parts[14],
  234                             STATUS  = parts[1 5],
  235                             APPOIN TMENT_TYPE  = parts[1 6],
  236                             FACILI TY_CODE =  parts[17],
  237                             EMAIL  = parts[18 ],
  238                             PHONE_ NUMBER = p arts[19],
  239                             TEXT_M ESSAGING_A LLOWED = C onvert.ToI nt16(parts [20]),
  240                             TEXT_M ESSAGING_P HONE_NUMBE R = parts[ 21],
  241                             PURPOS E_OF_VISIT  = parts[2 2],
  242                             OTHER_ PURPOSE_OF _VISIT = p arts[23],
  243                             VISIT_ TYPE = par ts[24],
  244                             PROVID ER_ID = pa rts[25],
  245                             PROVID ER_NAME =  parts[26],
  246                             PROVID ER_PERSON_ CLASS = pa rts[27],
  247                             PROVID ER_OPTION  = parts[28 ],
  248                             SECOND _REQUEST_S UBMITTED =  Convert.T oInt16(par ts[29]),
  249                             PARENT _REQUEST_I D = parts[ 30],
  250                             HAS_VE TERAN_NEW_ MESSAGE =  Convert.To Int16(part s[31]),
  251                             HAS_PR OVIDER_NEW _MESSAGE =  Convert.T oInt16(par ts[32]),
  252                             PROVID ER_SEEN_AP PT_REQ = C onvert.ToI nt16(parts [33]),
  253                             REQUES TED_PHONE_ CALL = Con vert.ToInt 16(parts[3 4]),
  254                             BOOKED _APPT_DATE TIME = (st ring.IsNul lOrEmpty(p arts[35])  ? nullDate  : ((parts [35] == "N ULL") ? nu llDate : F romExcelSe rialDate(C onvert.ToI nt32(parts [35]))))
  255                         };
  256  
  257                         r.MESSAGES  = Request Messages.W here(m =>  (m.APPOINT MENT_REQUE ST_ID == p arts[0])). ToArray();
  258                         List<strin g> filtere dBestTimes  = BestTim esToCallDa ta.Where(b t => (bt.S tartsWith( parts[0] +  "^"))).To List();
  259                         List<strin g> bestTim es = new L ist<string >();
  260  
  261                         foreach (s tring best Time in fi lteredBest Times)
  262                         {
  263                             string [] bestTim eParts = b estTime.Sp lit('^');
  264                             bestTi mes.Add(be stTimePart s[1]);
  265                         }
  266  
  267                         r.BEST_TIM ES_TO_CALL  = bestTim es.ToArray ();
  268                         RequestLis t.Add(r);
  269                    }
  270                    catc h (Excepti on ex)
  271                    {
  272                         System.Win dows.Messa geBox.Show (ex.Messag e, "Add Re quest");
  273                    }
  274                }
  275  
  276                foreach  (string pa tient in P atientData )
  277                    Pati entList.Ad d(new Serv ices.PATIE NT(patient ));
  278           }
  279  
  280           #e ndregion c onstructor
  281  
  282           #r egion publ ic IVARWeb ServiceAPI Service me mbers
  283  
  284           pu blic bool  BookAppoin tment(APPO INTMENT_RE QUEST requ est)
  285           {
  286                return t rue;
  287  
  288                //const  string met hodName =  "BookAppoi ntment";
  289                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.BookAppo intment" } ;
  290                //logIte m.MethodPa rams.Add(n ew paramIt em() { Nam e = "reque st", Value  = request , IsObject  = true }) ;
  291  
  292                //BOOKED _APPOINTME NT apptInf o = new BO OKED_APPOI NTMENT()
  293                //{
  294                //    AP POINTMENT_ REQUEST_ID  = request .APPOINTME NT_REQUEST _ID,
  295                //    BO OKED_APPT_ DATETIME =  request.B OOKED_APPT _DATETIME. Value,
  296                //    AP POINTMENT_ DATE = req uest.APPOI NTMENT_DAT E,
  297                //    AP POINTMENT_ TIME = req uest.APPOI NTMENT_TIM E,
  298                //    AP POINTMENT_ TYPE = req uest.APPOI NTMENT_TYP E,
  299                //    ME SSAGE = re quest.NewM essage,
  300                //    PR OVIDER_ID  = request. PROVIDER_I D,
  301                //    PR OVIDER_NAM E = reques t.PROVIDER _NAME,
  302                //    De tailCode =  request.D etailCode,
  303                //    ST ATUS = req uest.STATU S,
  304                //    US ER_ID = _v seInformat ion.VSE_US ER_ID
  305                //};
  306  
  307                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "BOOKED_A PPOINTMENT ", Value =  apptInfo,  IsObject  = true });
  308                //STANDA RD_RETURN  returnResu lts = (STA NDARD_RETU RN)Execute WebService Call(webSe rviceMetho ds.BookApp ointment,  apptInfo);
  309  
  310                //if (_s erviceExce ption == n ull)
  311                //{
  312                //    if  (returnRe sults != n ull)
  313                //         logItem. Results =  new paramI tem() {Nam e = method Name + " R eturn", Va lue = retu rnResults,  IsObject  = true};
  314  
  315                //    Cr eateLogEnt ry(logItem );
  316  
  317                //    if  (returnRe sults != n ull)
  318                //    {
  319                //         ProcessR eturnedErr orMessages (returnRes ults.Error Messages,  methodName );
  320                //         return r eturnResul ts.Success ;
  321                //    }
  322                //    el se
  323                //         return f alse;
  324                //}
  325                //else
  326                //{
  327                //    st ring[] err Messages =  TraceLog. FormatExce ptionMessa ge(this.Ge tType().Na me, "BookA ppointment ", _servic eException ).Split(ne w string[]  {Environm ent.NewLin e}, String SplitOptio ns.None);
  328                //    ST ANDARD_RET URN errRet urn = new  STANDARD_R ETURN(errM essages.To List());
  329                //    er rReturn.Su ccess = fa lse;
  330                //    _s erviceExce ption = nu ll;
  331                //    re turn false ;
  332                //}
  333           }
  334  
  335           pu blic async  Task<(int  count, st ring error Messages)>  GetAppoin tmentReque stCountAsy nc()
  336           {
  337                var erro rMessages  = String.E mpty;
  338                int coun t = GetApp ointmentRe questCount (out error Messages);
  339                return ( count, err orMessages );
  340  
  341                //const  string met hodName =  "GetAppoin tmentReque stCount";
  342                //int re sult = 0;
  343                //var er rorMessage s = String .Empty;
  344                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.GetAppoi ntmentRequ estCount"  };
  345                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "FACILITY _CODE", Va lue = _vse Informatio n.FACILITY _CODE });
  346  
  347                ////APPO INTMENT_RE QUEST_COUN T_RETURN r eturnResul ts = (APPO INTMENT_RE QUEST_COUN T_RETURN)E xecuteWebS erviceCall (webServic eMethods.G etAppointm entRequest Count, nul l);
  348                //var re turnResult s = new AP POINTMENT_ REQUEST_CO UNT_RETURN (0, new Li st<string> ());
  349                //try
  350                //{
  351  
  352                //    va r authenti cated = aw ait _vaosR estApiClie nt.Authent icateAsync ("access7" , "verify7 !", "523") ;
  353                //    // var authen ticated =  _vaosRestA piClient.A uthenticat e(Keys.Log gedInUserA ccessCode,  Keys.Logg edInUserVe rifyCode,  _vseInform ation.FACI LITY_CODE) ;
  354                //    if  (authenti cated)
  355                //    {
  356                //         var coun t = await  _vaosRestA piClient.G etAppointm entRequest CountAsync ("523");
  357                //         //var co unt = _vao sRestApiCl ient.GetAp pointmentR equestCoun t(_vseInfo rmation.FA CILITY_COD E);
  358                //         returnRe sults.Coun t = count;
  359                //    }
  360                //    el se
  361                //    {
  362                //         returnRe sults.Erro rMessages  = new stri ng[] { "Au thenticati on Failed. " };
  363                //    }
  364                //}
  365                //catch  (Exception  ex)
  366                //{
  367                //    re turnResult s.ErrorMes sages = ne w string[]  { ex.Mess age };
  368                //}
  369  
  370  
  371  
  372                //if (_s erviceExce ption == n ull)
  373                //{
  374                //    if  (returnRe sults != n ull)
  375                //         logItem. Results =  new paramI tem() { Na me = metho dName + "  Return", V alue = ret urnResults , IsObject  = true };
  376  
  377                //    Cr eateLogEnt ry(logItem );
  378  
  379                //    if  (returnRe sults != n ull)
  380                //    {
  381                //         if (retu rnResults. ErrorMessa ges.Count( ) > 0)
  382                //             erro rMessages  = String.J oin("\n",  returnResu lts.ErrorM essages);
  383  
  384                //         if (retu rnResults. Success)
  385                //             resu lt = retur nResults.C ount;
  386                //    }
  387                //}
  388                //else
  389                //{
  390                //    er rorMessage s = TraceL og.FormatE xceptionMe ssage(this .GetType() .Name, "Ge tAppointme ntRequestC ount", _se rviceExcep tion);
  391                //    _s erviceExce ption = nu ll;
  392                //}
  393  
  394                //return  (result,  errorMessa ges);
  395           }
  396  
  397           pu blic async  Task<ILis t<APPOINTM ENT_REQUES T_LIST_ITE M>> GetApp ointmentRe questListA sync()
  398           {
  399                IList<AP POINTMENT_ REQUEST_LI ST_ITEM> r esult = Ge tAppointme ntRequestL ist();
  400  
  401                return r esult;
  402   /*
  403                IList<AP POINTMENT_ REQUEST_LI ST_ITEM> r esult = ne w List<APP OINTMENT_R EQUEST_LIS T_ITEM>();
  404                const st ring metho dName = "G etAppointm entRequest List";
  405                LogClass  logItem =  new LogCl ass() { Me thodName =  methodNam e, APIName  = "VSE_VA R_Service. GetAppoint mentReques tList" };
  406                logItem. APIParams. Add(new pa ramItem()  { Name = " FACILITY_C ODE", Valu e = _vseIn formation. FACILITY_C ODE });
  407  
  408                //APPOIN TMENT_REQU EST_LIST_R ETURN retu rnResults  = (APPOINT MENT_REQUE ST_LIST_RE TURN)Execu teWebServi ceCall(web ServiceMet hods.GetAp pointmentR equestList , null);
  409  
  410                var retu rnResults  = new APPO INTMENT_RE QUEST_LIST _RETURN(ne w List<APP OINTMENT_R EQUEST_LIS T_ITEM>(),  new List< string>()) ;
  411                try
  412                {
  413                    var  authentica ted = awai t _vaosRes tApiClient .Authentic ateAsync(" access7",  "verify7!" , "523");
  414                    //va r authenti cated = _v aosRestApi Client.Aut henticate( Keys.Logge dInUserAcc essCode, K eys.Logged InUserVeri fyCode, _v seInformat ion.FACILI TY_CODE);
  415                    if ( authentica ted)
  416                    {
  417                         //var requ ests = _va osRestApiC lient.GetA ppointment Requests(_ vseInforma tion.FACIL ITY_CODE);
  418                         var reques ts = await  _vaosRest ApiClient. GetAppoint mentReques tsAsync("5 23");
  419                         List<APPOI NTMENT_REQ UEST_LIST_ ITEM> list  = map(req uests.Appo intmentReq uest);
  420  
  421                         //returnRe sults.Appo intment_Re quest_Item _List = li st.Where(x =>x.Status  == "Submi tted").ToA rray();
  422  
  423                         returnResu lts.Appoin tment_Requ est_Item_L ist = list .ToArray() ; //unfilt ered for d emo data a ll cancele d status
  424                    }
  425                    else
  426                    {
  427                         returnResu lts.ErrorM essages =  new string [] { "Auth entication  Failed."  };
  428                    }
  429                }
  430                catch (E xception e x)
  431                {
  432                    retu rnResults. ErrorMessa ges = new  string[] {  ex.Messag e };
  433                }
  434  
  435                if (_ser viceExcept ion == nul l)
  436                {
  437                    if ( returnResu lts != nul l)
  438                         logItem.Re sults = ne w paramIte m() { Name  = methodN ame + " Re turn", Val ue = retur nResults,  IsObject =  true };
  439  
  440                    Crea teLogEntry (logItem);
  441  
  442                    if ( returnResu lts != nul l)
  443                    {
  444                         ProcessRet urnedError Messages(r eturnResul ts.ErrorMe ssages, me thodName);
  445  
  446                         if (return Results.Su ccess)
  447                             result  = returnR esults.App ointment_R equest_Ite m_List.ToL ist();
  448                    }
  449                }
  450                else
  451                {
  452                    stri ng[] errMe ssages = T raceLog.Fo rmatExcept ionMessage (this.GetT ype().Name , "GetAppo intmentReq uestList",  _serviceE xception). Split(new  string[] {  Environme nt.NewLine  }, String SplitOptio ns.None);
  453                    Proc essReturne dErrorMess ages(errMe ssages, me thodName);
  454                    _ser viceExcept ion = null ;
  455                }
  456  
  457                return r esult;
  458   */
  459           }
  460  
  461           pu blic async  Task<APPO INTMENT_RE QUEST> Get Appointmen tRequestAs ync(string  appointme nt_request _id)
  462           // public APP OINTMENT_R EQUEST Get Appointmen tRequest(s tring appo intment_re quest_id,  out bool i sLocked)
  463           {
  464                //isLock ed = false ;
  465                const st ring metho dName = "G etAppointm entRequest ";
  466                LogClass  logItem =  new LogCl ass() { Me thodName =  methodNam e, APIName  = "VSE_VA R_Service. GetAppoint mentReques t" };
  467                logItem. MethodPara ms.Add(new  paramItem () { Name  = "appoint ment_reque st_id", Va lue = appo intment_re quest_id } );
  468                bool isL ocked;
  469                return G etAppointm entRequest (appointme nt_request _id, out i sLocked);
  470  
  471           }
  472  
  473           pu blic int G etAppointm entRequest Count(out  string err orMessages )
  474           {
  475                const st ring metho dName = "G etAppointm entRequest Count";
  476   //             int re sult = 0;
  477                int resu lt = Reque stList.Cou nt(r => (r .STATUS ==  "Submitte d"));
  478                errorMes sages = St ring.Empty ;
  479                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.GetAppoi ntmentRequ estCount"  };
  480                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "FACILITY _CODE", Va lue = _vse Informatio n.FACILITY _CODE });
  481                //APPOIN TMENT_REQU EST_COUNT_ RETURN ret urnResults  = (APPOIN TMENT_REQU EST_COUNT_ RETURN)Exe cuteWebSer viceCall(w ebServiceM ethods.Get Appointmen tRequestCo unt, null) ;
  482  
  483                //if (_s erviceExce ption == n ull)
  484                //{
  485                //    if  (returnRe sults != n ull)
  486                //         logItem. Results =  new paramI tem() {Nam e = method Name + " R eturn", Va lue = retu rnResults,  IsObject  = true};
  487  
  488                //    Cr eateLogEnt ry(logItem );
  489  
  490                //    if  (returnRe sults != n ull)
  491                //    {
  492                //         if (retu rnResults. ErrorMessa ges.Count( ) > 0)
  493                //             erro rMessages  = String.J oin("\n",  returnResu lts.ErrorM essages);
  494  
  495                //         if (retu rnResults. Success)
  496                //             resu lt = retur nResults.C ount;
  497                //    }
  498                //}
  499                //else
  500                //{
  501                //    er rorMessage s = TraceL og.FormatE xceptionMe ssage(this .GetType() .Name, "Ge tAppointme ntRequestC ount", _se rviceExcep tion);
  502                //    _s erviceExce ption = nu ll;
  503                //}
  504  
  505                return r esult;
  506           }
  507  
  508           pu blic IList <APPOINTME NT_REQUEST _LIST_ITEM > GetAppoi ntmentRequ estList()
  509           {
  510                IList<AP POINTMENT_ REQUEST_LI ST_ITEM> r esult = ne w List<APP OINTMENT_R EQUEST_LIS T_ITEM>();
  511                const st ring metho dName = "G etAppointm entRequest List";
  512  
  513                foreach( APPOINTMEN T_REQUEST  request in  RequestLi st.Where(r  => (r.STA TUS == "Su bmitted")) .ToList())
  514                {
  515                    APPO INTMENT_RE QUEST_LIST _ITEM item  = new APP OINTMENT_R EQUEST_LIS T_ITEM()
  516                    {
  517                         APPOINTMEN T_REQUEST_ ID = reque st.APPOINT MENT_REQUE ST_ID,
  518                         PATIENT_ID  = request .PATIENT_I D,
  519                         OPTION_DAT E_1 = requ est.OPTION _DATE_1,
  520                         OPTION_TIM E_1 = requ est.OPTION _TIME_1,
  521                         OPTION_DAT E_2 = requ est.OPTION _DATE_2,
  522                         OPTION_TIM E_2 = requ est.OPTION _TIME_2,
  523                         OPTION_DAT E_3 = requ est.OPTION _DATE_3,
  524                         OPTION_TIM E_3 = requ est.OPTION _TIME_3,
  525                         CREATED_DA TE = reque st.CREATED _DATE,
  526                         APPOINTMEN T_TYPE = r equest.APP OINTMENT_T YPE,
  527                         VISIT_TYPE  = request .VISIT_TYP E,
  528                         PURPOSE_OF _VISIT = r equest.PUR POSE_OF_VI SIT,
  529                         OTHER_PURP OSE_OF_VIS IT = reque st.OTHER_P URPOSE_OF_ VISIT,
  530                         REQUESTED_ PHONE_CALL  = request .REQUESTED _PHONE_CAL L,
  531                         PHONE_NUMB ER = reque st.PHONE_N UMBER,
  532                         BEST_TIME  = request. BEST_TIMES _TO_CALL,
  533                         FACILITY_C ODE = requ est.FACILI TY_CODE,
  534                         FACILITY_N AME = "MY  TEST FACIL ITY",
  535                         PROVIDER_I D = reques t.PROVIDER _ID,
  536                         PROVIDER_N AME = requ est.PROVID ER_NAME,
  537                         HasVeteran NewMessage  = (reques t.HAS_VETE RAN_NEW_ME SSAGE == 1 )
  538                    };
  539  
  540                    //Li st<APPOINT MENT_REQUE ST_MESSAGE > messages  = request .MESSAGES. Where(m =>  (m.SENDER _ID == req uest.PATIE NT_ID)).To List();
  541                    //AP POINTMENT_ REQUEST_ME SSAGE mess age = mess ages.First OrDefault( m0 => (m0. MESSAGE_DA TE_TIME ==  messages. Max(m1 =>  m1.MESSAGE _DATE_TIME )));
  542  
  543                    //if  (message  != null)
  544                    //     item.Las tMessage =  message.M ESSAGE_TEX T;
  545  
  546                    PATI ENT patien t = Patien tList.Firs tOrDefault (p => (p.P ATIENT_ID  == item.PA TIENT_ID)) ;
  547  
  548                    if ( patient !=  null)
  549                    {
  550                         item.FIRST _NAME = pa tient.FIRS T_NAME;
  551                         item.LAST_ NAME = pat ient.LAST_ NAME;
  552                         item.SSN =  patient.S SN;
  553                         item.DOB =  patient.D OB;
  554                    }
  555  
  556                    resu lt.Add(ite m);
  557                }
  558  
  559                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.GetAppoi ntmentRequ estList" } ;
  560                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "FACILITY _CODE", Va lue = _vse Informatio n.FACILITY _CODE });
  561                //APPOIN TMENT_REQU EST_LIST_R ETURN retu rnResults  = (APPOINT MENT_REQUE ST_LIST_RE TURN)Execu teWebServi ceCall(web ServiceMet hods.GetAp pointmentR equestList , null);
  562  
  563                //if (_s erviceExce ption == n ull)
  564                //{
  565                //    if  (returnRe sults != n ull)
  566                //         logItem. Results =  new paramI tem() { Na me = metho dName + "  Return", V alue = ret urnResults , IsObject  = true };
  567  
  568                //    Cr eateLogEnt ry(logItem );
  569  
  570                //    if  (returnRe sults != n ull)
  571                //    {
  572                //         ProcessR eturnedErr orMessages (returnRes ults.Error Messages,  methodName );
  573  
  574                //         if (retu rnResults. Success)
  575                //             resu lt = retur nResults.A ppointment _Request_I tem_List.T oList();
  576                //    }
  577                //}
  578                //else
  579                //{
  580                //    st ring[] err Messages =  TraceLog. FormatExce ptionMessa ge(this.Ge tType().Na me, "GetAp pointmentR equestList ", _servic eException ).Split(ne w string[]  { Environ ment.NewLi ne }, Stri ngSplitOpt ions.None) ;
  581                //    Pr ocessRetur nedErrorMe ssages(err Messages,  methodName );
  582                //    _s erviceExce ption = nu ll;
  583                //}
  584  
  585                return r esult;
  586           }
  587  
  588           pu blic APPOI NTMENT_REQ UEST GetAp pointmentR equest(str ing appoin tment_requ est_id, ou t bool isL ocked)
  589           {
  590                string l ockRecord  = LockData .FirstOrDe fault(l =>  l.StartsW ith(appoin tment_requ est_id + " ^"));
  591                isLocked  = !string .IsNullOrE mpty(lockR ecord);
  592  
  593                if (isLo cked)
  594                    retu rn null;
  595  
  596                APPOINTM ENT_REQUES T returnRe sults = Re questList. FirstOrDef ault(r =>  (r.APPOINT MENT_REQUE ST_ID == a ppointment _request_i d));
  597                LockData .Add($"{ap pointment_ request_id }^{_vseInf ormation.V SE_USER}") ;
  598                return r eturnResul ts;
  599                //isLock ed = false ;
  600                //const  string met hodName =  "GetAppoin tmentReque st";
  601                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.GetAppoi ntmentRequ est" };
  602                //logIte m.MethodPa rams.Add(n ew paramIt em() { Nam e = "appoi ntment_req uest_id",  Value = ap pointment_ request_id  });
  603  
  604                //APPT_R EQ_INPROCE SS request Info = new  APPT_REQ_ INPROCESS( )
  605                //{
  606                //    AP PT_REQ_ID  = appointm ent_reques t_id,
  607                //    US ER_ID = _v seInformat ion.VSE_US ER_ID + "- " + _vseIn formation. VistAUserI EN,
  608                //    FI RST_NAME =  _vseInfor mation.VSE _USER,
  609                //    LA ST_NAME =  _vseInform ation.VSE_ USER
  610                //};
  611  
  612                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "APPT_REQ _INPROCESS ", Value =  requestIn fo, IsObje ct = true  });
  613                //APPOIN TMENT_REQU EST_RETURN  returnRes ults = (AP POINTMENT_ REQUEST_RE TURN)Execu teWebServi ceCall(web ServiceMet hods.GetAp pointmentR equest, re questInfo) ;
  614  
  615                //if (_s erviceExce ption == n ull)
  616                //{
  617                //    //  Do loggin g
  618                //    if  (returnRe sults != n ull)
  619                //         logItem. Results =  new paramI tem() {Nam e = method Name + " R eturn", Va lue = retu rnResults,  IsObject  = true};
  620  
  621                //    Cr eateLogEnt ry(logItem );
  622  
  623                //    //  Handle re turn resul ts
  624                //    if  (returnRe sults != n ull)
  625                //    {
  626                //         // API c all failed
  627                //         if (!ret urnResults .Success)
  628                //         {
  629                //             // W as the fai lure becau se the sel ected reco rd is lock ed by anot her user ? ??
  630                //             if ( returnResu lts.ErrorM essages.Co unt() == 1 )
  631                //                  if (return Results.Er rorMessage s[0] == "L OCKED")
  632                //                  {
  633                //                      isLock ed = true;
  634                //                      return  null;
  635                //                  }
  636  
  637                //             // N ot a locke d record,  some other  error, th row the er ror
  638                //             Proc essReturne dErrorMess ages(retur nResults.E rrorMessag es, method Name);
  639                //         }
  640  
  641                //         return r eturnResul ts.Appoint ment_Reque st;
  642                //    }
  643                //    el se
  644                //         return n ull;
  645                //}
  646                //else
  647                //{
  648                //    st ring[] err Messages =  TraceLog. FormatExce ptionMessa ge(this.Ge tType().Na me, "GetAp pointmentR equest", _ serviceExc eption).Sp lit(new st ring[] { E nvironment .NewLine } , StringSp litOptions .None);
  649                //    Pr ocessRetur nedErrorMe ssages(err Messages,  methodName );
  650                //    _s erviceExce ption = nu ll;
  651                //    re turn null;
  652                //}
  653           }
  654  
  655           pu blic IList <DETAIL_CO DE> GetDet ailCodeLis t()
  656           {
  657                if (_det ailCodeLis t.Count ==  0)
  658                {
  659                    fore ach (strin g record i n DetCodeD ata)
  660                    {
  661                         string[] p arts = rec ord.Split( '^');
  662                         _detailCod eList.Add(
  663                             new DE TAIL_CODE( )
  664                             {
  665                                 DE TAIL_CODE_ ID = parts [0],
  666                                 PR OVIDER_MES SAGE = par ts[1],
  667                                 VE TERAN_MESS AGE = part s[2]
  668                             }
  669                         );
  670                    }                                   
  671  
  672                    //co nst string  methodNam e = "GetDe tailCodeLi st";
  673                    //Lo gClass log Item = new  LogClass( ) { Method Name = met hodName, A PIName = " VSE_VAR_Se rvice.GetD etailCodeL ist" };
  674                    //DE TAIL_CODE_ LIST_RETUR N returnRe sults = (D ETAIL_CODE _LIST_RETU RN)Execute WebService Call(webSe rviceMetho ds.GetDeta ilCodeList , null);
  675  
  676                    //if  (_service Exception  == null)
  677                    //{
  678                    //     if (retu rnResults  != null)
  679                    //         logI tem.Result s = new pa ramItem()  {Name = me thodName +  " Return" , Value =  returnResu lts, IsObj ect = true };
  680  
  681                    //     CreateLo gEntry(log Item);
  682  
  683                    //     if (retu rnResults  != null)
  684                    //     {
  685                    //         Proc essReturne dErrorMess ages(retur nResults.E rrorMessag es, method Name);
  686  
  687                    //         if ( returnResu lts.Succes s)
  688                    //              _detailCod eList = re turnResult s.DetailCo deList;
  689                    //     }
  690                    //}
  691                    //el se
  692                    //{
  693                    //     string[]  errMessag es = Trace Log.Format ExceptionM essage(thi s.GetType( ).Name, "G etDetailCo deList", _ serviceExc eption).Sp lit(new st ring[] { E nvironment .NewLine } , StringSp litOptions .None);
  694                    //     ProcessR eturnedErr orMessages (errMessag es, method Name);
  695                    //     _service Exception  = null;
  696                    //}
  697                }
  698  
  699                return _ detailCode List;
  700           }
  701  
  702           pu blic bool  NotBookApp ointment(A PPOINTMENT _REQUEST r equest)
  703           {
  704                return t rue;
  705                //const  string met hodName =  "NotBookAp pointment" ;
  706                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.NotBookA ppointment " };
  707                //logIte m.MethodPa rams.Add(n ew paramIt em() { Nam e = "reque st", Value  = request  });
  708  
  709                //NOT_BO OKED_APPOI NTMENT app tInfo = ne w NOT_BOOK ED_APPOINT MENT()
  710                //{
  711                //    AP POINTMENT_ REQUEST_ID  = request .APPOINTME NT_REQUEST _ID,
  712                //    ME SSAGE = re quest.NewM essage,
  713                //    US ER_ID = _v seInformat ion.VSE_US ER_ID,
  714                //    De tailCode =  request.D etailCode,
  715                //    ST ATUS = req uest.STATU S
  716                //};
  717  
  718                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "NOT_BOOK ED_APPOINT MENT", Val ue = apptI nfo, IsObj ect = true  });
  719                //STANDA RD_RETURN  returnResu lts = (STA NDARD_RETU RN)Execute WebService Call(webSe rviceMetho ds.NotBook Appointmen t, apptInf o);
  720  
  721                //if (_s erviceExce ption == n ull)
  722                //{
  723                //    if  (returnRe sults != n ull)
  724                //         logItem. Results =  new paramI tem() {Nam e = method Name + " R eturn", Va lue = retu rnResults,  IsObject  = true};
  725  
  726                //    Cr eateLogEnt ry(logItem );
  727  
  728                //    if  (returnRe sults != n ull)
  729                //    {
  730                //         ProcessR eturnedErr orMessages (returnRes ults.Error Messages,  methodName );
  731                //         return r eturnResul ts.Success ;
  732                //    }
  733                //    el se
  734                //         return f alse;
  735                //}
  736                //else
  737                //{
  738                //    st ring[] err Messages =  TraceLog. FormatExce ptionMessa ge(this.Ge tType().Na me, "NotBo okAppointm ent", _ser viceExcept ion).Split (new strin g[] { Envi ronment.Ne wLine }, S tringSplit Options.No ne);
  739                //    Pr ocessRetur nedErrorMe ssages(err Messages,  methodName );
  740                //    _s erviceExce ption = nu ll;
  741                //    re turn false ;
  742                //}
  743           }
  744  
  745           pu blic bool  UnlockAppo intmentReq uest(strin g appointm ent_reques t_id)
  746           {
  747                string i sLockedBy  = LockData .FirstOrDe fault(l =>  l.StartsW ith(appoin tment_requ est_id + " ^"));
  748  
  749                if (!str ing.IsNull OrEmpty(is LockedBy))
  750                    retu rn LockDat a.Remove(i sLockedBy) ;
  751  
  752                return f alse;
  753  
  754                //const  string met hodName =  "UnlockApp ointmentRe quest";
  755                //string  parameter  = appoint ment_reque st_id + "^ " + _vseIn formation. VSE_USER_I D + "-" +  _vseInform ation.Vist AUserIEN;
  756                //LogCla ss logItem  = new Log Class() {  MethodName  = methodN ame, APINa me = "VSE_ VAR_Servic e.UnlockAp pointmentR equest" };
  757                //logIte m.MethodPa rams.Add(n ew paramIt em() { Nam e = "appoi ntment_req uest_id",  Value = pa rameter }) ;
  758                //logIte m.APIParam s.Add(new  paramItem( ) { Name =  "appointm ent_reques t_id", Val ue = param eter });
  759                //STANDA RD_RETURN  returnResu lts = (STA NDARD_RETU RN)Execute WebService Call(webSe rviceMetho ds.UnlockA ppointment , paramete r);
  760  
  761                //if (_s erviceExce ption == n ull)
  762                //{
  763                //    if  (returnRe sults != n ull)
  764                //         logItem. Results =  new paramI tem() {Nam e = method Name + " R eturn", Va lue = retu rnResults,  IsObject  = true};
  765  
  766                //    Cr eateLogEnt ry(logItem );
  767  
  768                //    if  (returnRe sults != n ull)
  769                //    {
  770                //         ProcessR eturnedErr orMessages (returnRes ults.Error Messages,  methodName );
  771                //         return r eturnResul ts.Success ;
  772                //    }
  773                //    el se
  774                //         return f alse;
  775                //}
  776                //else
  777                //{
  778                //    st ring[] err Messages =  TraceLog. FormatExce ptionMessa ge(this.Ge tType().Na me, "Unloc kAppointme ntRequest" , _service Exception) .Split(new  string[]  { Environm ent.NewLin e }, Strin gSplitOpti ons.None);
  779                //    Pr ocessRetur nedErrorMe ssages(err Messages,  methodName );
  780                //    _s erviceExce ption = nu ll;
  781                //    re turn false ;
  782                //}
  783           }
  784  
  785           #e ndregion p ublic IVAR WebService APIService  members
  786  
  787           #r egion priv ate method s
  788  
  789           pr ivate obje ct Execute WebService Call(webSe rviceMetho ds method,  object pa rm)
  790           {
  791                object r esult = nu ll;
  792                string m ethodName  = method.T oString();
  793                _service Exception  = null;
  794  
  795                using (C hannelFact ory<IVSE_V AR_Service > serviceP roxy = new  ChannelFa ctory<IVSE _VAR_Servi ce>("VSE_V AR_Service Endpoint") )
  796                {
  797                    try
  798                    {
  799                          servicePro xy.Credent ials.Clien tCertifica te.Certifi cate = new  X509Certi ficate2(En vironment. CurrentDir ectory + " \\ DNS . URL         .pfx", "vs e_rocks");
  800                         servicePro xy.Open();
  801                         IVSE_VAR_S ervice ser vice = ser viceProxy. CreateChan nel();
  802  
  803                         switch(met hod)
  804                         {
  805                             case w ebServiceM ethods.Get Appointmen tRequestCo unt:
  806                                 re sult = ser vice.GetAp pointmentR equestCoun t(_vseInfo rmation.FA CILITY_COD E);
  807                                 br eak;
  808                             case w ebServiceM ethods.Get Appointmen tRequestLi st:
  809                                 re sult = ser vice.GetAp pointmentR equestList (_vseInfor mation.FAC ILITY_CODE );
  810                                 br eak;
  811                             case w ebServiceM ethods.Get Appointmen tRequest:
  812                                 re sult = ser vice.GetAp pointmentR equest((AP PT_REQ_INP ROCESS)par m);
  813                                 br eak;
  814                             case w ebServiceM ethods.Get DetailCode List:
  815                                 re sult = ser vice.GetDe tailCodeLi st();
  816                                 br eak;
  817                             case w ebServiceM ethods.Boo kAppointme nt:
  818                                 re sult = ser vice.BookA ppointment ((BOOKED_A PPOINTMENT )parm);
  819                                 br eak;
  820                             case w ebServiceM ethods.Not BookAppoin tment:
  821                                 re sult = ser vice.NotBo okedAppoin tment((NOT _BOOKED_AP POINTMENT) parm);
  822                                 br eak;
  823                             case w ebServiceM ethods.Unl ockAppoint ment:
  824                                 re sult = ser vice.Unloc kAppointme ntRequest( (string)pa rm);
  825                                 br eak;
  826                         }
  827  
  828                         servicePro xy.Close() ;
  829                    }
  830                    catc h (Endpoin tNotFoundE xception e )
  831                    {
  832   //                      Exceptio n exDispla y = new Ex ception(
  833                         _serviceEx ception =  new Except ion(
  834                             "Sched uler was u nable to f ind an end point list ening for  the VSE_VA R_Service  at the con figured ad dress.\n"  +
  835                             "This  is a confi guration i ssue.  Ple ase notify  your supe rvisor.\n\ n" +
  836                             "Revie w the Trac e Log for  further de tails."
  837                         );
  838                         Exception  exLog = ne w Exceptio n("Schedul er was una ble to fin d an endpo int listen ing for th e VSE_VAR_ Service at  the confi gured addr ess.", e);
  839                         TraceLog.L ogExceptio n(this.Get Type().Nam e, methodN ame + "\\E xecuteWebS erviceCall ", exLog);
  840   //                      Keys.Ale rtUserErro r(Keys.Mai nWindow, e xDisplay,  "VAR Web S ervice Not  Found Err or");
  841                         servicePro xy.Abort() ;
  842                    }
  843                    catc h (Communi cationExce ption e)
  844                    {
  845   //                      Exceptio n exDispla y = new Ex ception(
  846                         _serviceEx ception =  new Except ion(
  847                             "There  was a Com munication  problem a ccessing t he VSE_VAR _Service.\ n" +
  848                             "Wait  a minute o r so and t ry the ope ration aga in.\n" + 
  849                             "If th e problem  persists n otify your  superviso r.\n\n" +
  850                             "Revie w the Trac e Log for  details of  this issu e."
  851                         );
  852                         Exception  exLog = ne w Exceptio n("There w as a Commu nication p roblem acc essing the  VSE_VAR_S ervice.",  e);
  853                         TraceLog.L ogExceptio n(this.Get Type().Nam e, methodN ame + "\\E xecuteWebS erviceCall ", exLog);
  854   //                      Keys.Ale rtUserErro r(Keys.Mai nWindow, e xDisplay,  "VAR Web S ervice Com munication s Error");
  855                         servicePro xy.Abort() ;
  856                    }
  857                    catc h (Timeout Exception  e)
  858                    {
  859   //                      Exceptio n exDispla y = new Ex ception(
  860                         _serviceEx ception =  new Except ion(
  861                             "The a ttempt to  communicat e with the  VSE_VAR_S ervice tim ed out.\n"  +
  862                             "Wait  a minute o r so and t ry the ope ration aga in.\n" + 
  863                             "If th e problem  persists n otify your  superviso r.\n\n" +
  864                             "Revie w the Trac e Log for  details of  this issu e."
  865                         );
  866                         Exception  exLog = ne w Exceptio n("The att empt to co mmunicate  with the V SE_VAR_Ser vice timed  out.", e) ;
  867                         TraceLog.L ogExceptio n(this.Get Type().Nam e, methodN ame + "\\E xecuteWebS erviceCall ", exLog);
  868   //                      Keys.Ale rtUserErro r(Keys.Mai nWindow, e xDisplay,  "VAR Web S ervice Tim e Out Erro r");
  869                         servicePro xy.Abort() ;
  870                    }
  871                    catc h (Excepti on e)
  872                    {
  873   //                      Exceptio n exDispla y = new Ex ception(
  874                         _serviceEx ception =  new Except ion(
  875                             "The w as a probl em communi cating wit h the VSE_ VAR_Servic e.\n" +
  876                             "Wait  a minute o r so and t ry the ope ration aga in.\n" + 
  877                             "If th e problem  persists n otify your  superviso r.\n\n" +
  878                             "Revie w the Trac e Log for  details of  this issu e."
  879                         );
  880                         Exception  exLog = ne w Exceptio n("The was  a problem  communica ting with  the VSE_VA R_Service. ", e);
  881                         TraceLog.L ogExceptio n(this.Get Type().Nam e, methodN ame + "\\E xecuteWebS erviceCall ", exLog);
  882   //                      Keys.Ale rtUserErro r(Keys.Mai nWindow, e xDisplay,  "VAR Web S ervice Err or");
  883                         servicePro xy.Abort() ;
  884                    }
  885                }
  886  
  887                return r esult;
  888           }
  889  
  890           pr ivate void  ProcessRe turnedErro rMessages( string[] e rrorMessag es, string  methodNam e)
  891           {
  892                if (erro rMessages. Count() ==  0)
  893                    retu rn;
  894  
  895                Exceptio n innerExc eption = n ew Excepti on(String. Join("\n",  errorMess ages));
  896                Exceptio n exceptio n = new Ex ception(St ring.Forma t("The VSE _VAR_Servi ce returne d error me ssages whe n called f rom the {0 } method." , methodNa me));
  897                TraceLog .LogExcept ion(this.G etType().N ame, metho dName, exc eption);
  898                Keys.Ale rtUserErro r(Keys.Mai nWindow, e xception,  "VSE_VAR_S ervice Err ors");
  899           }
  900  
  901           #e ndregion p rivate met hods
  902  
  903           #r egion Trac eLog membe rs
  904  
  905           pr ivate clas s paramIte m
  906           {
  907                public s tring Name  = "";
  908                public b ool IsObje ct = false ;
  909                public b ool IsObje ctAList =  false;
  910                public s tring Valu eAsString
  911                {
  912                    get
  913                    {
  914                         if (Value  == null)
  915                             return  "";
  916  
  917                         if (Value. GetType()  == typeof( DateTime))
  918                             return  ((DateTim e)Value).T oString(Ke ys.Methods .ISO8601Da teFormat);
  919  
  920                         return Val ue.ToStrin g();
  921                    }
  922                }
  923                // If Va lue is a l ist assign  it as an  array
  924                public o bject Valu e = null;
  925           }
  926  
  927           pr ivate clas s LogClass
  928           {
  929                public s tring Meth odName = " ";
  930                public L ist<paramI tem> Metho dParams =  new List<p aramItem>( );
  931                public s tring APIN ame = "";
  932                public L ist<paramI tem> APIPa rams = new  List<para mItem>();
  933                public p aramItem R esults = n ew paramIt em();
  934           }
  935  
  936           pr ivate stat ic List<st ring> Conv ertObjectL istToStrin gList(obje ct[] objLi st, bool r eturnNames  = false)
  937           {
  938                List<str ing> resul ts = new L ist<string >();
  939  
  940                if (objL ist != nul l)
  941                {
  942                    if ( objList.Co unt() != 0 )
  943                    {
  944                         if (return Names)
  945                             result s.Add(Conv ertObjectT oLogString (objList[0 ], true));
  946  
  947                         foreach (o bject obj  in objList )
  948                             result s.Add(Conv ertObjectT oLogString (obj));
  949                    }
  950                    resu lts.Add("E mpty");
  951                }
  952                else
  953                    resu lts.Add("n ull");
  954  
  955                return r esults;
  956           }
  957  
  958           pr ivate stat ic List<st ring> Conv ertObjetTo StringList (object ob j, bool re turnNames  = false)
  959           {
  960                List<str ing> resul ts = new L ist<string >();
  961  
  962                if (obj  != null)
  963                {
  964                    fore ach (var p rop in obj .GetType() .GetProper ties())
  965                    {
  966                         string lin e = "";
  967                         if (return Names)
  968                             line =  prop.Name  + "=";
  969  
  970                         try
  971                         {
  972                             if ((p rop.Proper tyType ==  typeof(Str ing[])) ||  (prop.Pro pertyType  == typeof( System.Str ing[])))
  973                             {
  974                                 st ring[] lis t = (strin g[])prop.G etValue(ob j, null);
  975                                 st ring subLi ne = Strin g.Join("|" , list);
  976                                 li ne += subL ine;
  977                             }
  978                             else i f (prop.Pr opertyType  == typeof (int[]))
  979                             {
  980                                 in t[] list =  (int[])pr op.GetValu e(obj, nul l);
  981                                 st ring subLi ne = Strin g.Join("|" , list);
  982                                 li ne += subL ine;
  983                             }
  984                             else i f (prop.Pr opertyType  == typeof (DateTime[ ]))
  985                             {
  986                                 Da teTime[] l ist = (Dat eTime[])pr op.GetValu e(obj, nul l);
  987                                 Li st<string>  sList = n ew List<st ring>();
  988  
  989                                 fo reach (Dat eTime dt i n list)
  990                                      sList.Ad d(dt.ToStr ing(Keys.M ethods.ISO 8601DateFo rmat));
  991  
  992                                 st ring subLi ne = Strin g.Join("|" , sList.To Array());
  993                                 li ne += subL ine;
  994                             }
  995                             else i f (prop.Pr opertyType  == typeof (Decimal[] ))
  996                             {
  997                                 De cimal[] li st = (Deci mal[])prop .GetValue( obj, null) ;
  998                                 st ring subLi ne = Strin g.Join("|" , list);
  999                                 li ne += subL ine;
  1000                             }
  1001                             else i f (prop.Pr opertyType .IsArray)
  1002                             {
  1003                                 ob ject[] ite ms = (obje ct[])prop. GetValue(o bj, null);
  1004                                 Li st<string>  subItems  = new List <string>() ;
  1005  
  1006                                 fo reach (obj ect item i n items)
  1007                                 {
  1008                                      string s ubLine = S tring.Empt y;
  1009                                      List<str ing> subPr ops = Conv ertObjetTo StringList (item, tru e);
  1010  
  1011                                      if (subP rops.Count  > 0)
  1012                                          subL ine = Stri ng.Join("~ ~", subPro ps);
  1013  
  1014                                      subItems .Add(subLi ne);
  1015                                 }
  1016  
  1017                                 li ne += (Str ing.IsNull OrEmpty(li ne) ? "" :  "^") + St ring.Join( "|", subIt ems.ToArra y());
  1018                             }
  1019                             else
  1020                                 li ne += prop .GetValue( obj, null) ;
  1021                         }
  1022                         catch
  1023                         {
  1024                             line + = "Unable  to determi ne value";
  1025                         }
  1026  
  1027                         results.Ad d(line);
  1028                    }
  1029                }
  1030                else
  1031                    resu lts.Add("n ull");
  1032  
  1033                return r esults;
  1034           }
  1035  
  1036           pr ivate stat ic string  ConvertObj ectToLogSt ring(objec t obj, boo l returnNa mes = fals e)
  1037           {
  1038                string l ine = "";
  1039  
  1040                if (obj  != null)
  1041                {
  1042                    var  props = ob j.GetType( ).GetPrope rties();
  1043                    for  (int index  = 0; inde x < props. Length; in dex++)
  1044                    {
  1045                         var prop =  obj.GetTy pe().GetPr operties() [index];
  1046  
  1047                         if (return Names)
  1048                             line + = (String. IsNullOrEm pty(line)  ? "" : "^" ) + prop.N ame;
  1049                         else
  1050                         {
  1051                             try
  1052                             {
  1053                                 if  ((prop.Pr opertyType  == typeof (String[]) ) || (prop .PropertyT ype == typ eof(System .String[]) ))
  1054                                 {
  1055                                      string[]  list = (s tring[])pr op.GetValu e(obj, nul l);
  1056                                      string s ubLine = S tring.Empt y;
  1057                                      
  1058                                      if (list .Count() >  0)
  1059                                          subL ine = Stri ng.Join("| ", list);
  1060  
  1061                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + subLine;
  1062                                 }
  1063                                 el se if (pro p.Property Type == ty peof(int[] ))
  1064                                 {
  1065                                      int[] li st = (int[ ])prop.Get Value(obj,  null);
  1066                                      string s ubLine = S tring.Join ("|", list );
  1067                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + subLine;
  1068                                 }
  1069                                 el se if (pro p.Property Type == ty peof(DateT ime))
  1070                                 {
  1071                                      DateTime  val = (Da teTime)pro p.GetValue (obj, null );
  1072                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + ((val ==  null) ? " Unknown" :  ((DateTim e)val).ToS tring(Keys .Methods.I SO8601Date Format));
  1073                                 }
  1074                                 el se if (pro p.Property Type == ty peof(DateT ime[]))
  1075                                 {
  1076                                      DateTime [] list =  (DateTime[ ])prop.Get Value(obj,  null);
  1077                                      List<str ing> sList  = new Lis t<string>( );
  1078  
  1079                                      foreach  (DateTime  dt in list )
  1080                                          sLis t.Add(dt.T oString(Ke ys.Methods .ISO8601Da teFormat)) ;
  1081  
  1082                                      string s ubLine = S tring.Join ("|", sLis t.ToArray( ));
  1083                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + subLine;
  1084                                 }
  1085                                 el se if (pro p.Property Type == ty peof(Decim al[]))
  1086                                 {
  1087                                      Decimal[ ] list = ( Decimal[]) prop.GetVa lue(obj, n ull);
  1088                                      string s ubLine = S tring.Join ("|", list );
  1089                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + subLine;
  1090                                 }
  1091                                 el se if (pro p.Property Type.IsArr ay)
  1092                                 {
  1093                                      object[]  items = ( object[])p rop.GetVal ue(obj, nu ll);
  1094                                      List<str ing> subIt ems = new  List<strin g>();
  1095  
  1096                                      foreach  (object it em in item s)
  1097                                      {
  1098                                          stri ng subLine  = String. Empty;
  1099                                          List <string> s ubProps =  ConvertObj etToString List(item,  true);
  1100  
  1101                                          if ( subProps.C ount > 0)
  1102                                               subLine =  String.Joi n("~~", su bProps);
  1103  
  1104                                          subI tems.Add(s ubLine);
  1105                                      }
  1106  
  1107                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + String.J oin("|", s ubItems.To Array());
  1108                                 }
  1109                                 el se
  1110                                      line +=  (String.Is NullOrEmpt y(line) ?  "" : "^")  + prop.Get Value(obj,  null);
  1111                             }
  1112                             catch
  1113                             {
  1114                                 li ne += "Una ble to det ermine val ue";
  1115                             }
  1116                         }
  1117                    }
  1118                }
  1119                else
  1120                    line  = "null";
  1121  
  1122                return l ine;
  1123           }
  1124  
  1125           pr ivate stat ic void Cr eateLogEnt ry(LogClas s logItems )
  1126           {
  1127                StringBu ilder log  = new Stri ngBuilder( );
  1128                string l ine = logI tems.Metho dName + "( ";
  1129                List<str ing> list  = new List <string>() ;
  1130  
  1131                foreach  (paramItem  item in l ogItems.Me thodParams )
  1132                {
  1133                    if ( item.IsObj ect)
  1134                         list.Add(i tem.Name);
  1135                    else
  1136                    {
  1137                         string val  = item.Va lueAsStrin g;
  1138                         list.Add(S tring.IsNu llOrEmpty( val) ? "em pty" : val );
  1139                    }
  1140                }
  1141  
  1142                line +=  String.Joi n(", ", li st.ToArray ()) + ")";
  1143                log.Appe ndLine(lin e);
  1144  
  1145                foreach  (paramItem  item in l ogItems.Me thodParams )
  1146                    if ( item.IsObj ect)
  1147                    {
  1148                         line = "   " + item.N ame;
  1149  
  1150                         try
  1151                         {
  1152                             if (it em.Value = = null)
  1153                                 lo g.AppendLi ne(line +=  "    null ");
  1154                             else i f (item.Is ObjectALis t)
  1155                             {
  1156                                 lo g.AppendLi ne(line);
  1157                                 Li st<string>  oList = C onvertObje ctListToSt ringList(( object[])i tem.Value,  true);
  1158  
  1159                                 fo reach (str ing o in o List)
  1160                                      log.Appe ndLine(o);
  1161                             }
  1162                             else
  1163                             {
  1164                                 li ne += "     " + Conve rtObjectTo LogString( item.Value , true);
  1165                                 li ne += "     " + Conve rtObjectTo LogString( item.Value );
  1166                             }
  1167                         }
  1168                         catch
  1169                         {
  1170                             log.Ap pendLine(l ine += "     Unable t o render t he object  as a strin g of prope rty values .");
  1171                         }
  1172                    }
  1173  
  1174                log.Appe ndLine("") ;
  1175                log.Appe ndLine(new  String('- ', 80));
  1176  
  1177                log.Appe ndLine(log Items.APIN ame);
  1178                int item No = 0;
  1179  
  1180                foreach  (paramItem  item in l ogItems.AP IParams)
  1181                    if ( item.IsObj ect)
  1182                    {
  1183                         log.Append Line("  #"  + (itemNo ++).ToStri ng() + ":  " + item.N ame);
  1184  
  1185                         try
  1186                         {
  1187                             if (it em.Value = = null)
  1188                                 lo g.AppendLi ne("    nu ll");
  1189                             else i f (item.Is ObjectALis t)
  1190                             {
  1191                                 Li st<string>  oList = C onvertObje ctListToSt ringList(( object[])i tem.Value,  true);
  1192  
  1193                                 fo reach (str ing o in o List)
  1194                                      log.Appe ndLine("     " + o);
  1195                             }
  1196                             else
  1197                             {
  1198                                 Li st<string>  iList = C onvertObje tToStringL ist(item.V alue, true );
  1199  
  1200                                 fo reach (str ing i in i List)
  1201                                      log.Appe ndLine("     " + i);
  1202                             }
  1203                         }
  1204                         catch
  1205                         {
  1206                             log.Ap pendLine("     Unable  to render  the objec t as a str ing of pro perty valu es.");
  1207                         }
  1208                    }
  1209                    else
  1210                         log.Append Line("  #"  + (itemNo ++).ToStri ng() + ":  " + item.V alueAsStri ng);
  1211  
  1212  
  1213                log.Appe ndLine("") ;
  1214                log.Appe ndLine(new  String('- ', 80));
  1215  
  1216  
  1217                if (logI tems.Resul ts.IsObjec t)
  1218                {
  1219                    try
  1220                    {
  1221                         if (logIte ms.Results .IsObjectA List)
  1222                         {
  1223                             List<s tring> oLi st = Conve rtObjectLi stToString List((obje ct[])logIt ems.Result s.Value, t rue);
  1224  
  1225                             foreac h (string  o in oList )
  1226                                 lo g.AppendLi ne(o);
  1227                         }
  1228                         else
  1229                         {
  1230                             log.Ap pendLine(C onvertObje ctToLogStr ing(logIte ms.Results .Value, tr ue));
  1231                             log.Ap pendLine(C onvertObje ctToLogStr ing(logIte ms.Results .Value));
  1232                         }
  1233                    }
  1234                    catc h
  1235                    {
  1236                         log.Append Line("     Unable to  render the  object as  a string  of propert y values." );
  1237                    }
  1238                }
  1239                else
  1240                    log. AppendLine ((string)l ogItems.Re sults.Valu eAsString) ;
  1241  
  1242                TraceLog .LogInfo(" VARWebServ iceAPIServ ice", logI tems.Metho dName, log .ToString( ));
  1243  
  1244           }
  1245  
  1246           #e ndregion T raceLog me mbers
  1247       }
  1248   }