256. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:56:28 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.

256.1 Files compared

# Location File Last Modified
1 C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\BusinessDataModel\ScheduleAndAppointment Validate.cs Tue Dec 20 19:51:43 2016 UTC
2 Wed Feb 1 19:56:28 2017 UTC

256.2 Comparison summary

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

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

256.4 Active regular expressions

No regular expressions were active.

256.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //        
3   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
4   //        
5   //  Copyri ght (C) Mi crosoft Co rporation.  All right s reserved .        
6   //        
7   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
8   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
9   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
10   //        
11   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
12   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
13   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
14   //  PARTIC ULAR PURPO SE.        
15   //        
16   // ======= ========== ========== ========== ========== ========== ========== ==        
17   //<snippet Validate>        
18   using Syst em;        
19   using Syst em.Linq;        
20   using Syst em.Service Model;        
21   using Syst em.Service Model.Desc ription;        
22          
23   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
24   // found i n the SDK\ bin folder .        
25   using Micr osoft.Xrm. Sdk;        
26   using Micr osoft.Xrm. Sdk.Client ;        
27   using Micr osoft.Xrm. Sdk.Query;        
28   using Micr osoft.Xrm. Sdk.Discov ery;        
29   using Micr osoft.Xrm. Sdk.Messag es;        
30          
31   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
32   // found i n the SDK\ bin folder .        
33   using Micr osoft.Crm. Sdk.Messag es;        
34          
35   namespace  Microsoft. Crm.Sdk.Sa mples        
36   {        
37       public  class Val idate        
38       {        
39           #r egion Clas s Level Me mbers        
40          
41           // / <summary >        
42           // / Stores t he organiz ation serv ice proxy.        
43           // / </summar y>        
44           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
45          
46           //  Define th e IDs need ed for thi s sample.        
47           pr ivate Guid  _contactI d;        
48           pr ivate Guid  _appointm entId;                 
49          
50           #e ndregion C lass Level  Members        
51          
52           #r egion How  To Sample  Code        
53           // / <summary >        
54           // / Create a nd configu re the org anization  service pr oxy.        
55           // / Initiate  the metho d to creat e any data  that this  sample re quires.        
56           // / Verify w hether an  appointmen t has vali d resource s for the  appointmen t activity .                
57           // / Optional ly delete  any entity  records t hat were c reated for  this samp le.        
58           // / </summar y>        
59           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
60           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
61           // / created  entities.< /param>        
62           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt ForDelete)        
63           {        
64                try        
65                {        
66          
67                    // C onnect to  the Organi zation ser vice.         
68                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
69                    usin g (_servic eProxy = n ew Organiz ationServi ceProxy(se rverConfig .Organizat ionUri, se rverConfig .HomeRealm Uri,server Config.Cre dentials,  serverConf ig.DeviceC redentials ))        
70                    {        
71                         // This st atement is  required  to enable  early-boun d type sup port.        
72                         _servicePr oxy.Enable ProxyTypes ();        
73          
74                         // Call th e method t o create a ny data th at this sa mple requi res.        
75                         CreateRequ iredRecord s();        
76          
77                         //<snippet Validate1>                              
78                                
79                         // Retriev e the appo intment to  be valida ted        
80                         ColumnSet  cols = new  ColumnSet ("schedule dstart", " schedulede nd", "stat ecode", "s tatuscode" );        
81                         Appointmen t retrieve dAppointme nt = (Appo intment)_s erviceProx y.Retrieve (Appointme nt.EntityL ogicalName ,        
82                                                                        _appoin tmentId, c ols);        
83          
84                         // Use the  Validate  message        
85                         ValidateRe quest vali datedReq =  new Valid ateRequest ();        
86                         validatedR eq.Activit ies = new  EntityColl ection();        
87                         validatedR eq.Activit ies.Entiti es.Add(ret rievedAppo intment);        
88                         validatedR eq.Activit ies.MoreRe cords = fa lse;        
89                         validatedR eq.Activit ies.Paging Cookie = " ";        
90                         validatedR eq.Activit ies.Entity Name = App ointment.E ntityLogic alName;        
91          
92                         ValidateRe sponse val idateResp  = (Validat eResponse) _servicePr oxy.Execut e(validate dReq);        
93                                
94                         // Verify  success        
95                         if ((valid ateResp.Re sult != nu ll) && (va lidateResp .Result.Le ngth > 0))        
96                         {        
97                             Consol e.WriteLin e("Validat ed the app ointment." );                                  
98                         }        
99                         //</snippe tValidate1 >        
100          
101                         DeleteRequ iredRecord s(promptFo rDelete);        
102                    }        
103                }        
104                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
105                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
106                {        
107                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
108                    thro w;        
109                }        
110           }        
111          
112           // / <summary >        
113           // / This met hod create s any enti ty records  that this  sample re quires.        
114           // / Create a  new recur ring appoi ntment.        
115           // / </summar y>        
116           pu blic void  CreateRequ iredRecord s()        
117           {        
118                // Creat e a contac t        
119                Contact  newContact  = new Con tact        
120                {        
121                    Firs tName = "L isa",        
122                    Last Name = "An drews",        
123                    EMai lAddress1  = "lisa@co ntoso.com"        
124                };        
125                _contact Id = _serv iceProxy.C reate(newC ontact);        
126                Console. WriteLine( "Created c ontact: {0 }.", newCo ntact.Firs tName + "  " + newCon tact.LastN ame);        
127          
128                // Creat e ab activ ity party        
129                Activity Party requ iredAttend ee = new A ctivityPar ty        
130                {        
131                    Part yId = new  EntityRefe rence(Cont act.Entity LogicalNam e, _contac tId)        
132                };        
133                        
134                // Creat e an appoi ntment        
135                Appointm ent newApp ointment =  new Appoi ntment        
136                {        
137                    Subj ect = "Tes t Appointm ent",        
138                    Desc ription =  "Test Appo intment",        
139                    Sche duledStart  = DateTim e.Now.AddH ours(1),        
140                    Sche duledEnd =  DateTime. Now.AddHou rs(2),        
141                    Loca tion = "Of fice",        
142                    Requ iredAttend ees = new  ActivityPa rty[] {req uiredAtten dee}        
143                };        
144                _appoint mentId = _ servicePro xy.Create( newAppoint ment);        
145                Console. WriteLine( "Created { 0}.", newA ppointment .Subject);        
146           }        
147                   
148          
149           // / <summary >        
150           // / Deletes  any entity  records t hat were c reated for  this samp le.        
151           // / <param n ame="promp t">Indicat es whether  to prompt  the user  to delete         
152           // / the reco rds create d in this  sample.</p aram>        
153           // / </summar y>        
154           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
155           {        
156                bool del eteRecords  = true;        
157          
158                if (prom pt)        
159                {        
160                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  to be dele ted? (y/n) ");        
161                    Stri ng answer  = Console. ReadLine() ;        
162          
163                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ));        
164                }        
165          
166                if (dele teRecords)        
167                {        
168                    _ser viceProxy. Delete(App ointment.E ntityLogic alName, _a ppointment Id);        
169                    _ser viceProxy. Delete(Con tact.Entit yLogicalNa me, _conta ctId);        
170                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
171                }        
172           }        
173          
174           #e ndregion H ow To Samp le Code        
175          
176           #r egion Main        
177           // / <summary >        
178           // / Standard  Main() me thod used  by most SD K samples.        
179           // / </summar y>        
180           // / <param n ame="args" ></param>        
181           st atic publi c void Mai n(string[]  args)        
182           {        
183                try        
184                {        
185                    // O btain the  target org anization' s Web addr ess and cl ient logon          
186                    // c redentials  from the  user.        
187                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
188                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
189          
190                    Vali date app =  new Valid ate();        
191                    app. Run(config , true);        
192                }        
193          
194                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
195                {        
196                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
197                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
198                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
199                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
200                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
201                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
202                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
203                }        
204                catch (S ystem.Time outExcepti on ex)        
205                {        
206                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
207                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
208                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
209                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
210                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
211                }        
212                catch (S ystem.Exce ption ex)        
213                {        
214                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
215                    Cons ole.WriteL ine(ex.Mes sage);        
216          
217                    // D isplay the  details o f the inne r exceptio n.        
218                    if ( ex.InnerEx ception !=  null)        
219                    {        
220                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
221          
222                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e        
223                             = ex.I nnerExcept ion        
224                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
225                         if (fe !=  null)        
226                         {        
227                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
228                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
229                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
230                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
231                             Consol e.WriteLin e("Inner F ault: {0}" ,        
232                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
233                         }        
234                    }        
235                }        
236                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
237                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
238          
239                finally        
240                {        
241          
242                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
243                    Cons ole.ReadLi ne();        
244                }        
245          
246           }        
247           #e ndregion M ain        
248       }        
249   }        
250   //</snippe tValidate>