669. Araxis Merge File Comparison Report

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

669.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\VisualizationsAndDashboards CRUDDashboards.cs Tue Dec 20 19:51:43 2016 UTC
2 Wed Feb 1 19:56:55 2017 UTC

669.2 Comparison summary

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

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

669.4 Active regular expressions

No regular expressions were active.

669.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 righ ts reserve d.        
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 CRUDDashbo ards>        
18   using Syst em;        
19   using Syst em.Linq;        
20   using Syst em.Service Model;        
21   using Syst em.Service Model.Desc ription;        
22   using Syst em.Xml.Lin q;        
23          
24   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
25   // found i n the SDK\ bin folder .        
26   using Micr osoft.Xrm. Sdk;        
27   using Micr osoft.Xrm. Sdk.Client ;        
28   using Micr osoft.Xrm. Sdk.Query;        
29   using Micr osoft.Xrm. Sdk.Discov ery;        
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          
38       /// <s ummary>        
39       /// Th is sample  shows how  to perform  Create, R etrieve,         
40       /// Up date, and  Delete ope rations on  a dashboa rd.        
41       /// </ summary>        
42               
43       public  class CRU DDashboard s        
44       {        
45           #r egion Clas s Level Me mbers        
46          
47           // / <summary >        
48           // / Stores t he organiz ation serv ice proxy.        
49           // / </summar y>        
50           Or ganization ServicePro xy _servic eProxy;        
51          
52           //  Define th e IDs need ed for thi s sample.        
53           pu blic Guid  _dashboard Id;        
54          
55           #e ndregion C lass Level  Members        
56          
57           #r egion How  To Sample  Code        
58           // / <summary >        
59           // / Create a nd configu re the org anization  service pr oxy.        
60           // / Create a  dashboard .        
61           // / Retrieve  the dashb oard.        
62           // / Update t he dashboa rd.        
63           // / Delete t he dashboa rd.        
64           // / </summar y>        
65           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
66           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
67           // / created  entities.< /param>        
68          
69          pub lic void R un(ServerC onnection. Configurat ion server Config, bo ol promptF orDelete)        
70           {        
71                try        
72                {        
73                    // C onnect to  the Organi zation ser vice.         
74                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
75                    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 ))        
76                    {        
77                         // This st atement is  required  to enable  early-boun d type sup port.        
78                         _servicePr oxy.Enable ProxyTypes ();        
79          
80                         //<snippet CRUDDashbo ards1>        
81          
82                         //Grab the  default p ublic view  for oppor tunities.        
83                         QueryExpre ssion mySa vedQuery =  new Query Expression        
84                         {        
85                             Column Set = new  ColumnSet( "savedquer yid"),        
86                             Entity Name = Sav edQuery.En tityLogica lName,        
87                             Criter ia = new F ilterExpre ssion        
88                             {        
89                                 Co nditions =        
90                             {        
91                                 ne w Conditio nExpressio n        
92                                 {        
93                                      Attribut eName = "i sdefault",        
94                                      Operator  = Conditi onOperator .Equal,        
95                                      Values =  {true}        
96                                 },        
97                                 ne w Conditio nExpressio n        
98                                 {        
99                                      Attribut eName = "q uerytype",        
100                                      Operator  = Conditi onOperator .Equal,        
101                                      Values =  {0}        
102                                 },        
103                                 ne w Conditio nExpressio n        
104                                 {        
105                                      Attribut eName = "r eturnedtyp ecode",        
106                                      Operator  = Conditi onOperator .Equal,        
107                                      Values =  {Opportun ity.Entity TypeCode}        
108                                 }        
109                             }        
110                             }        
111                         };        
112          
113                         //This que ry should  return one  and only  one result .        
114                         SavedQuery  defaultOp portunityQ uery = _se rviceProxy .RetrieveM ultiple(my SavedQuery )        
115                             .Entit ies.Select (x => (Sav edQuery)x) .FirstOrDe fault();        
116          
117                         // Retriev e visualiz ations out  of the sy stem.         
118                         // This sa mple assum es that yo u have the  "Top Oppo rtunities"        
119                         // visuali zation tha t is insta lled with  Microsoft  Dynamics C RM.        
120                         QueryByAtt ribute vis ualization Query = ne w QueryByA ttribute        
121                         {        
122                             Entity Name = Sav edQueryVis ualization .EntityLog icalName,        
123                             Column Set = new  ColumnSet( "savedquer yvisualiza tionid"),        
124                             Attrib utes = { " name" },        
125                             //If y ou do not  have this  visualizat ion, you w ill need t o change        
126                             //this  line.        
127                             Values  = { "Top  Opportunit ies" }        
128                         };        
129          
130          
131                         SavedQuery Visualizat ion visual ization =  _servicePr oxy.Retrie veMultiple (visualiza tionQuery) .        
132                             Entiti es.Select( x => (Save dQueryVisu alization) x).FirstOr Default();        
133                         //<snippet CRUDDashbo ards2>        
134                         //This is  the langua ge code fo r U.S. Eng lish. If y ou are run ning this  code        
135                         //in a dif ferent loc ale, you w ill need t o modify t his value.        
136                         int langua geCode = 1 033;        
137          
138                         //We set u p our dash board and  specify th e FormXml.  Refer to  the        
139                         //FormXml  schema in  the Micros oft Dynami cs CRM SDK  for more  informatio n.        
140                         SystemForm  dashboard  = new Sys temForm        
141                         {        
142                             Name =  "Sample D ashboard",        
143                             Descri ption = "S ample orga nization-o wned dashb oard.",        
144                             FormXm l = String .Format(@" <form>        
145                                      <tabs>        
146                                          <tab  name='Tes t Dashboar d' vertica llayout='t rue'>        
147                                               <labels>        
148                                                   <label  descripti on='Sample  Dashboard ' language code='{0}'  />        
149                                               </labels>        
150                                               <columns>        
151                                                   <colum n width='1 00%'>        
152                                                       <s ections>        
153                                                            <section  name='Inf ormation S ection'        
154                                                                show label='fal se' showba r='false'        
155                                                                colu mns='111'>        
156                                                                <lab els>        
157                                                                     <label des cription=' Informatio n Section'        
158                                                                         langua gecode='{0 }' />        
159                                                                </la bels>        
160                                                                <row s>        
161                                                                     <row>        
162                                                                         <cell  colspan='1 ' rowspan= '10'         
163                                                                             sh owlabel='f alse'>        
164                                                                             <l abels>        
165                                                                                  <label d escription ='Top Oppo rtunitiess  - 1'        
166                                                                                  language code='{0}'  />        
167                                                                             </ labels>        
168                                                                             <c ontrol id= 'TopOpport unities'        
169                                                                                  classid= '{{E7A8127 8-8635-4d9 e-8D4D-594 80B391C5B} }'>        
170                                                                                  <paramet ers>        
171                                                                                      <Vie wId>{1}</V iewId>        
172                                                                                      <IsU serView>fa lse</IsUse rView>        
173                                                                                      <Rel ationshipN ame />        
174                                                                                      <Tar getEntityT ype>opport unity</Tar getEntityT ype>        
175                                                                                      <Aut oExpand>Fi xed</AutoE xpand>        
176                                                                                      <Ena bleQuickFi nd>false</ EnableQuic kFind>        
177                                                                                      <Ena bleViewPic ker>false< /EnableVie wPicker>        
178                                                                                      <Ena bleJumpBar >false</En ableJumpBa r>        
179                                                                                      <Cha rtGridMode >Chart</Ch artGridMod e>        
180                                                                                      <Vis ualization Id>{2}</Vi sualizatio nId>        
181                                                                                      <Ena bleChartPi cker>false </EnableCh artPicker>        
182                                                                                      <Rec ordsPerPag e>10</Reco rdsPerPage >        
183                                                                                  </parame ters>        
184                                                                             </ control>        
185                                                                         </cell >        
186                                                                         <cell  colspan='1 ' rowspan= '10'         
187                                                                             sh owlabel='f alse'>        
188                                                                             <l abels>        
189                                                                                  <label d escription ='Top Oppo rtunities  - 2'        
190                                                                                  language code='{0}'  />        
191                                                                             </ labels>        
192                                                                             <c ontrol id= 'TopOpport unities2'        
193                                                                                  classid= '{{E7A8127 8-8635-4d9 e-8D4D-594 80B391C5B} }'>        
194                                                                                  <paramet ers>        
195                                                                                      <Vie wId>{1}</V iewId>        
196                                                                                      <IsU serView>fa lse</IsUse rView>        
197                                                                                      <Rel ationshipN ame />        
198                                                                                      <Tar getEntityT ype>opport unity</Tar getEntityT ype>        
199                                                                                      <Aut oExpand>Fi xed</AutoE xpand>        
200                                                                                      <Ena bleQuickFi nd>false</ EnableQuic kFind>        
201                                                                                      <Ena bleViewPic ker>false< /EnableVie wPicker>        
202                                                                                      <Ena bleJumpBar >false</En ableJumpBa r>        
203                                                                                      <Cha rtGridMode >Grid</Cha rtGridMode >        
204                                                                                      <Vis ualization Id>{2}</Vi sualizatio nId>        
205                                                                                      <Ena bleChartPi cker>false </EnableCh artPicker>        
206                                                                                      <Rec ordsPerPag e>10</Reco rdsPerPage >        
207                                                                                  </parame ters>        
208                                                                             </ control>        
209                                                                         </cell >        
210                                                                     </row>        
211                                                                     <row />        
212                                                                     <row />        
213                                                                     <row />        
214                                                                     <row />        
215                                                                     <row />        
216                                                                     <row />        
217                                                                     <row />        
218                                                                     <row />        
219                                                                     <row />        
220                                                                </ro ws>        
221                                                            </sectio n>        
222                                                       </ sections>        
223                                                   </colu mn>        
224                                               </columns>        
225                                          </ta b>        
226                                      </tabs>        
227                                 </ form>",        
228                             langua geCode,        
229                             defaul tOpportuni tyQuery.Sa vedQueryId .Value.ToS tring("B") ,        
230                             visual ization.Sa vedQueryVi sualizatio nId.Value. ToString(" B")),        
231                             IsDefa ult = fals e        
232                         };        
233                         _dashboard Id = _serv iceProxy.C reate(dash board);        
234                         //</snippe tCRUDDashb oards2>        
235                         Console.Wr iteLine("C reated {0} .", dashbo ard.Name);        
236          
237                         //Now we w ill retrie ve the das hboard.        
238                         SystemForm  retrieved Dashboard  = (SystemF orm)_servi ceProxy.Re trieve(Sys temForm.En tityLogica lName, _da shboardId,  new Colum nSet(true) );        
239                         Console.Wr iteLine("R etrieved t he dashboa rd.");        
240          
241                         // Update  the retrie ved dashbo ard. Enabl e the char t picker o n the char t.                                                   
242                         XDocument  xDocument  = XDocumen t.Parse(re trievedDas hboard.For mXml);        
243          
244                         var chartP icker = (f rom contro l in xDocu ment.Desce ndants("co ntrol")        
245                                             w here contr ol.Attribu te("id").V alue == "T opOpportun ities"        
246                                             s elect cont rol.Descen dants("Ena bleChartPi cker").Fir st()        
247                                           ).F irst();        
248                         chartPicke r.Value =  "true";        
249          
250                         //Now we p lace the u pdated Xml  back into  the dashb oard, and  update it.        
251                         retrievedD ashboard.F ormXml = x Document.T oString();                              
252                         _servicePr oxy.Update (retrieved Dashboard) ;        
253          
254                         // Publish  the dashb oard chang es to the  solution.         
255                         // This is  only requ ired for o rganizatio n-owned da shboards.        
256                         PublishXml Request up dateReques t = new Pu blishXmlRe quest        
257                         {        
258                             Parame terXml = @ "<dashboar d>_dashboa rdId</dash board>"        
259                         };        
260          
261                         _servicePr oxy.Execut e(updateRe quest);        
262          
263                         Console.Wr iteLine("U pdated the  dashboard .");        
264          
265                         DeleteRequ iredRecord s(promptFo rDelete);        
266          
267                         //</snippe tCRUDDashb oards1>        
268                    }        
269                }        
270          
271                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
272                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
273                {        
274                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
275                    thro w;        
276                }        
277           }        
278           // / <summary >        
279           // / Deletes  any entity  records t hat were c reated for  this samp le.        
280           // / <param n ame='promp t'>Indicat es whether  to prompt  the user         
281           // / to delet e the reco rds create d in this  sample.</p aram>        
282           // / </summar y>        
283           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
284           {        
285                bool del eteRecords  = true;        
286          
287                if (prom pt)        
288                {        
289                    Cons ole.WriteL ine("\nDo  you want t hese entit y records  deleted? ( y/n) [y]:  ");        
290                    Stri ng answer  = Console. ReadLine() ;        
291          
292                    dele teRecords  = (answer. StartsWith ("y") || a nswer.Star tsWith("Y" ) || answe r == Strin g.Empty);        
293                }        
294          
295                if (dele teRecords)        
296                {        
297                    _ser viceProxy. Delete(Sys temForm.En tityLogica lName, _da shboardId) ;        
298                    Cons ole.WriteL ine("Entit y records  have been  deleted.") ;          
299                }         
300           }        
301           #e ndregion H ow To Samp le Code        
302          
303           #r egion Main        
304           // / <summary >        
305           // / Main. Ru ns the sam ple and pr ovides err or output.        
306           // / <param n ame="args" >Array of  arguments  to Main me thod.</par am>        
307           // / </summar y>        
308           st atic publi c void Mai n(string[]  args)        
309           {        
310                try        
311                {        
312                    // O btain the  target org anization' s Web addr ess and cl ient logon          
313                    // c redentials  from the  user.        
314                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
315                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
316          
317                    CRUD Dashboards  app = new  CRUDDashb oards();        
318                    app. Run(config , true);        
319          
320          
321                }        
322                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
323                {        
324                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
325                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
326                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
327                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
328                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
329                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
330                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
331                }        
332                catch (S ystem.Time outExcepti on ex)        
333                {        
334                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
335                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
336                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
337                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
338                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
339                }        
340                catch (S ystem.Exce ption ex)        
341                {        
342                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
343                    Cons ole.WriteL ine(ex.Mes sage);        
344          
345                    // D isplay the  details o f the inne r exceptio n.        
346                    if ( ex.InnerEx ception !=  null)        
347                    {        
348                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
349          
350                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
351                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
352                         if (fe !=  null)        
353                         {        
354                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
355                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
356                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
357                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
358                             Consol e.WriteLin e("Inner F ault: {0}" ,        
359                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
360                         }        
361                    }        
362                }        
363                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
364                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
365          
366                finally        
367                {        
368                     Con sole.Write Line("Pres s <Enter>  to exit.") ;        
369                    Cons ole.ReadLi ne();        
370                }        
371          
372           }        
373           #e ndregion M ain        
374          
375       }        
376   }        
377   //</snippe tCRUDDashb oards>