613. Araxis Merge File Comparison Report

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

613.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\Process\Dialogs CRUDDialog.cs Tue Dec 20 19:51:45 2016 UTC
2 Wed Feb 1 19:56:53 2017 UTC

613.2 Comparison summary

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

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

613.4 Active regular expressions

No regular expressions were active.

613.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M 2011 SDK  code samp les.        
3   //        
4   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
5   //        
6   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
7   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
8   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
9   //        
10   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
11   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
12   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
13   //  PARTIC ULAR PURPO SE.        
14   // ======= ========== ========== ========== ========== ========== ========== ==        
15          
16   //<snippet CRUDDialog >        
17   using Syst em;        
18   using Syst em.IO;        
19   using Syst em.Service Model;        
20   using Syst em.Service Model.Desc ription;        
21          
22   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
23   // located  in the SD K\bin fold er of the  SDK downlo ad.        
24   using Micr osoft.Xrm. Sdk;        
25   using Micr osoft.Xrm. Sdk.Query;        
26   using Micr osoft.Xrm. Sdk.Client ;        
27          
28   // This na mespace is  found in  the Micros oft.Crm.Sd k.Proxy.dl l assembly        
29   // located  in the SD K\bin fold er.        
30   using Micr osoft.Crm. Sdk.Messag es;        
31          
32   namespace  Microsoft. Crm.Sdk.Sa mples        
33   {        
34       /// <s ummary>        
35       /// De monstrates  how to cr eate, retr ieve, upda te, and de lete.        
36       /// a  dialog pro cess.</sum mary>        
37       /// <r emarks>        
38       /// At  run-time,  you will  be given t he option  to delete  all the        
39       /// da tabase rec ords creat ed by this  program.< /remarks>        
40       public  class CRU DDialog        
41       {        
42           #r egion Clas s Level Me mbers        
43          
44           pr ivate Guid  _dialogId ;                
45           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
46          
47           // / <summary >        
48           // / TODO: Ch ange the l ocation an d file nam e of the s ample XAML  file        
49           // / containi ng the dia log defini tion.        
50           // / e.g. Use  the sampl e xml file  located i n the SDK\ SampleCode \CS\Dialog s folder.        
51           // / </summar y>        
52           St ring pathT oXAML = Pa th.Combine (Environme nt.Current Directory,  @"CallCat egorizatio n.xml");        
53                   
54           #e ndregion C lass Level  Members        
55          
56           #r egion How- To Sample  Code        
57           // / <summary >        
58           // / This met hod first  connects t o the Orga nization s ervice. Af terwards,        
59           // / create,  retrieve,  update, an d delete o perations  are perfor med on a          
60           // / dialog p rocess.        
61           // / </summar y>        
62           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
63           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
64           // / created  entities.< /param>        
65           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt forDelete)        
66           {        
67                try        
68                {        
69                    //<s nippetCRUD Dialog1>        
70                    // C onnect to  the Organi zation ser vice.         
71                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
72                    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 ))        
73                    {        
74                         // This st atement is  required  to enable  early-boun d type sup port.        
75                         _servicePr oxy.Enable ProxyTypes ();        
76          
77                         CreateRequ iredRecord s();        
78                                
79                         // Define  an anonymo us type to  define th e possible  values fo        
80                         // workflo w category        
81                         var Workfl owCategory  = new        
82                         {        
83                             Workfl ow = 0,        
84                             Dialog  = 1        
85                         };        
86                                
87                         // Instant iate a Wor kflow obje ct.        
88                         // See the  Entity Me tadata top ic in the  SDK docume ntation to  determine          
89                         // which a ttributes  must be se t for each  entity.        
90                         Workflow s ampleDialo g = new Wo rkflow        
91                         {        
92                             Catego ry = new O ptionSetVa lue((int)W orkflowCat egory.Dial og),        
93                             Name =  "Sample D ialog: Cal l Categori zation",        
94                             Primar yEntity =  PhoneCall. EntityLogi calName,        
95          
96                             //Lang uage code  for U.S. E nglish        
97                             Langua geCode = 1 033,        
98                             Xaml =  File.Read AllText(pa thToXAML)        
99                         };        
100          
101                         // Create  a dialog r ecord.        
102                         _dialogId  = _service Proxy.Crea te(sampleD ialog);        
103                         Console.Wr ite("{0} c reated,",  sampleDial og.Name);        
104          
105                         // Activat e the dial og.        
106                         SetStateRe quest acti vateReques t = new Se tStateRequ est        
107                         {        
108                             Entity Moniker =  new Entity Reference( Workflow.E ntityLogic alName, _d ialogId),        
109                             State  = new Opti onSetValue ((int)Work flowState. Activated) ,        
110                             Status  = new Opt ionSetValu e(2)        
111                         };        
112                         _servicePr oxy.Execut e(activate Request);        
113                         Console.Wr iteLine("  and activa ted.");        
114          
115                         // Retriev e the dial og contain ing severa l of its a ttributes.        
116                         ColumnSet  cols = new  ColumnSet ("name", " statecode" , "statusc ode");        
117          
118                         Workflow r etrievedDi alog = (Wo rkflow)_se rviceProxy .Retrieve( Workflow.E ntityLogic alName, _d ialogId, c ols);        
119                         Console.Wr ite("Retri eved,");        
120          
121                         // Update  the dialog .        
122                         // Deactiv ate the di alog befor e you can  update it.        
123                         SetStateRe quest deac tivateRequ est = new  SetStateRe quest        
124                         {        
125                             Entity Moniker =  new Entity Reference( Workflow.E ntityLogic alName, _d ialogId),        
126                             State  = new Opti onSetValue ((int)Work flowState. Draft),        
127                             Status  = new Opt ionSetValu e(1)        
128          
129                         };        
130                         _servicePr oxy.Execut e(deactiva teRequest) ;        
131          
132                         // Retriev e the dial og record  again to g et the unp ublished         
133                         // instanc e in order  to update .        
134                         Workflow r etrievedDi alogDeacti vated = (W orkflow)_s erviceProx y.Retrieve (Workflow. EntityLogi calName, _ dialogId,  cols);        
135          
136                         // Update  the dialog .        
137                         retrievedD ialogDeact ivated.Nam e = "Updat ed Dialog:  Call Cate gorization ";        
138                         _servicePr oxy.Update (retrieved DialogDeac tivated);        
139          
140                         Console.Wr ite(" upda ted,");        
141          
142                         // Activat e the dial og.        
143                         SetStateRe quest upda teActivate Request =  new SetSta teRequest        
144                         {        
145                             Entity Moniker =  new Entity Reference( Workflow.E ntityLogic alName, _d ialogId),        
146                             State  = new Opti onSetValue ((int)Work flowState. Activated) ,        
147                             Status  = new Opt ionSetValu e(2)        
148                         };        
149                         _servicePr oxy.Execut e(updateAc tivateRequ est);        
150                         Console.Wr iteLine("  and activa ted again. ");        
151          
152                         DeleteRequ iredRecord s(promptfo rDelete);        
153                    }        
154                    //</ snippetCRU DDialog1>        
155                }        
156          
157                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
158                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
159                {        
160                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
161                    thro w;        
162                }        
163           }        
164          
165           // / <summary >        
166           // / Creates  any entity  records t hat this s ample requ ires.        
167           // / </summar y>        
168           pu blic void  CreateRequ iredRecord s()        
169           {        
170                // For t his sample , all requ ired entit ies are cr eated in t he Run() m ethod.        
171           }        
172          
173           // / <summary >        
174           // / Deletes  any entity  records t hat were c reated for  this samp le.        
175           // / <param n ame="promp t">Indicat es whether  to prompt  the user         
176           // / to delet e the reco rds create d in this  sample.</p aram>        
177           // / </summar y>        
178           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
179           {        
180                bool del eteRecords  = true;        
181          
182                if (prom pt)        
183                {        
184                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
185                    Stri ng answer  = Console. ReadLine() ;        
186          
187                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
188                }        
189          
190                if (dele teRecords)        
191                {        
192                    // D eactivate  the dialog , and then  delete it .        
193                    SetS tateReques t deactiva teRequest  = new SetS tateReques t        
194                    {        
195                         EntityMoni ker = new  EntityRefe rence(Work flow.Entit yLogicalNa me, _dialo gId),        
196                         State = ne w OptionSe tValue((in t)Workflow State.Draf t),        
197                         Status = n ew OptionS etValue(1) ,        
198                    };        
199                    _ser viceProxy. Execute(de activateRe quest);        
200                    _ser viceProxy. Delete(Wor kflow.Enti tyLogicalN ame, _dial ogId);        
201                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;        
202                }        
203           }        
204          
205           #e ndregion H ow-To Samp le Code        
206          
207           #r egion Main  method        
208          
209           // / <summary >        
210           // / Standard  Main() me thod used  by most SD K samples.        
211           // / </summar y>        
212           // / <param n ame="args" ></param>        
213           st atic publi c void Mai n(string[]  args)        
214           {        
215                try        
216                {        
217                    // O btain the  target org anization' s Web addr ess and cl ient logon          
218                    // c redentials  from the  user.        
219                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
220                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
221          
222                    CRUD Dialog app  = new CRU DDialog();        
223                    app. Run(config , true);        
224                }        
225                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
226                {        
227                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
228                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
229                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
230                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
231                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
232                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
233                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
234                }        
235                catch (S ystem.Time outExcepti on ex)        
236                {        
237                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
238                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
239                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
240                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
241                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
242                }        
243                catch (S ystem.Exce ption ex)        
244                {        
245                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
246                    Cons ole.WriteL ine(ex.Mes sage);        
247          
248                    // D isplay the  details o f the inne r exceptio n.        
249                    if ( ex.InnerEx ception !=  null)        
250                    {        
251                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
252          
253                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
254                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
255                         if (fe !=  null)        
256                         {        
257                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
258                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
259                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
260                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
261                             Consol e.WriteLin e("Inner F ault: {0}" ,        
262                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
263                         }        
264                    }        
265                }        
266                finally        
267                {        
268                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
269                    Cons ole.ReadLi ne();        
270                }        
271           }        
272           #e ndregion M ain method        
273       }        
274   }        
275   //</snippe tCRUDDialo g>