206. Araxis Merge File Comparison Report

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

206.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\BusinessManagement RollupByObject.cs Tue Dec 20 19:51:44 2016 UTC
2 Wed Feb 1 19:56:24 2017 UTC

206.2 Comparison summary

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

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

206.4 Active regular expressions

No regular expressions were active.

206.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
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 RollupByOb ject>        
17   using Syst em;        
18   using Syst em.Service Model;        
19          
20   // These n amespaces  are found  in the Mic rosoft.Xrm .Sdk.dll a ssembly        
21   // found i n the SDK\ bin folder .        
22   using Micr osoft.Xrm. Sdk;        
23   using Micr osoft.Xrm. Sdk.Client ;        
24   using Micr osoft.Xrm. Sdk.Query;        
25          
26   // This na mespace is  found in  Microsoft. Crm.Sdk.Pr oxy.dll as sembly        
27   // found i n the SDK\ bin folder .        
28   using Micr osoft.Crm. Sdk.Messag es;        
29          
30   namespace  Microsoft. Crm.Sdk.Sa mples        
31   {        
32       /// <s ummary>        
33       /// De monstrates  how to ro ll up oppo rtunities  by their p arent acco unt.</summ ary>        
34       /// </ summary>        
35       public  class Rol lupByObjec t        
36       {        
37           #r egion Clas s Level Me mbers        
38          
39           pr ivate Guid  _accountI d;        
40           pr ivate Guid  _opportun ityId;        
41           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
42                   
43           #e ndregion C lass Level  Members        
44          
45           #r egion How  To Sample  Code        
46           // / <summary >        
47           // / This sam ple demons trates how  to roll u p opportun ities by t heir paren t account.        
48           // / The samp le first c reates the  Rollup Re quest. Nex t, it exec utes that  request.        
49           // / Finally,  the sampl e displays  the resul ts of the  Rollup Res ponse.        
50           // / </summar y>        
51           // / <param n ame="serve rConfig">C ontains se rver conne ction info rmation.</ param>        
52           // / <param n ame="promp tforDelete ">When Tru e, the use r will be  prompted t o delete a ll        
53           // / created  entities.< /param>        
54           pu blic void  Run(Server Connection .Configura tion serve rConfig, b ool prompt forDelete)        
55           {        
56                try        
57                {        
58                    // C onnect to  the Organi zation ser vice.         
59                    // T he using s tatement a ssures tha t the serv ice proxy  will be pr operly dis posed.        
60                    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 ))        
61                    {        
62                         // This st atement is  required  to enable  early-boun d type sup port.        
63                         _servicePr oxy.Enable ProxyTypes ();        
64          
65                         CreateRequ iredRecord s();        
66          
67                         #region Cr eate Query Expression        
68                         // Create  QueryExpre ssion        
69                         QueryExpre ssion quer y = new Qu eryExpress ion()        
70                         {        
71                             Entity Name = Opp ortunity.E ntityLogic alName,        
72                             Column Set = new  ColumnSet( "name", "a ccountid") ,        
73                             Criter ia =        
74                             {        
75                                 Fi lters =         
76                                 {        
77                                      new Filt erExpressi on        
78                                      {        
79                                          Filt erOperator  = Logical Operator.A nd,        
80                                          Cond itions =         
81                                          {        
82                                               new Condit ionExpress ion("name" , Conditio nOperator. Equal, "Op portunity  1")        
83                                          },        
84                                      }        
85                                 }        
86                             },        
87                         };        
88                         Console.Wr iteLine("C reated Que ryExpressi on.");        
89                         #endregion  Create Qu eryExpress ion        
90                                
91                         #region Cr eate Rollu pRequest        
92                         //<snippet Rollup1>        
93                         // Create  RollupRequ est        
94                         RollupRequ est rollup Request =  new Rollup Request();        
95                         rollupRequ est.Query  = query;        
96                         rollupRequ est.Target  = new Ent ityReferen ce("accoun t", _accou ntId);        
97                         rollupRequ est.Rollup Type = Rol lupType.Ex tended;        
98                         Console.Wr iteLine("C reated Rol lupRequest .");        
99                         #endregion  Create Ro llupReques t        
100          
101                         #region Ex ecute Roll upRequest        
102                         // Execute  RollupReq uest        
103                         RollupResp onse rollu pResponse  = (RollupR esponse)_s erviceProx y.Execute( rollupRequ est);        
104                         Console.Wr iteLine("E xecuted Ro llupReques t.");        
105                         //</snippe tRollup1>        
106                         #endregion  Execute R ollupReque st        
107          
108                         #region Sh ow RollupR esponse re sults        
109                         // Show Ro llupRespon se results        
110                         Console.Wr iteLine("R ollupRespo nse Result s:");        
111                         Console.Wr iteLine("- ---------- ---------- ---------- ---------- ---------" );        
112                         Console.Wr iteLine("C ount: " +  rollupResp onse.Resul ts.Count);        
113                         for (int i  = 0; i <  rollupResp onse.Resul ts.Count;  i++ )        
114                         {        
115                             Consol e.WriteLin e();        
116                             Consol e.WriteLin e("Logical Name: " +  rollupResp onse.Entit yCollectio n.Entities [i].Logica lName);        
117                             Consol e.WriteLin e("Id: " +  rollupRes ponse.Enti tyCollecti on.Entitie s[i].Id);        
118                         }        
119                         #endregion  Show Roll upResponse  results        
120          
121                         DeleteRequ iredRecord s(promptfo rDelete);        
122                    }        
123                }        
124          
125                // Catch  any servi ce fault e xceptions  that Micro soft Dynam ics CRM th rows.        
126                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault>)        
127                {        
128                    // Y ou can han dle an exc eption her e or pass  it back to  the calli ng method.        
129                    thro w;        
130                }        
131           }        
132          
133           pu blic void  CreateRequ iredRecord s()        
134           {        
135                // Creat e an accou nt        
136                Account  account =  new Accoun t        
137                {        
138                    Name  = "Fourth  Coffee"        
139                };        
140                _account Id = _serv iceProxy.C reate(acco unt);        
141          
142                // Creat e an oppor tunity        
143                Opportun ity newOpp ortunity =  new Oppor tunity        
144                {        
145                    Name  = "Opport unity 1",        
146                    Cust omerId = n ew EntityR eference        
147                    {        
148                         Id = _acco untId,        
149                         LogicalNam e = accoun t.LogicalN ame        
150                    }                          
151                };        
152                _opportu nityId = _ servicePro xy.Create( newOpportu nity);        
153           }        
154          
155           pu blic void  DeleteRequ iredRecord s(bool pro mpt)        
156           {        
157                bool toB eDeleted =  true;        
158          
159                if (prom pt)        
160                {        
161                    // A sk the use r if the c reated ent ities shou ld be dele ted.        
162                    Cons ole.Write( "\nDo you  want these  entity re cords dele ted? (y/n)  [y]: ");        
163                    Stri ng answer  = Console. ReadLine() ;        
164                    if ( answer.Sta rtsWith("y ") ||        
165                         answer.Sta rtsWith("Y ") ||        
166                         answer ==  String.Emp ty)        
167                    {        
168                         toBeDelete d = true;        
169                    }        
170                    else        
171                    {        
172                         toBeDelete d = false;        
173                    }        
174                }        
175          
176                if (toBe Deleted)        
177                {        
178                    // D elete all  records cr eated in t his sample .        
179                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou ntId);        
180          
181                    Cons ole.WriteL ine("Entit y record(s ) have bee n deleted. ");        
182                }        
183          
184           }        
185          
186           #e ndregion H ow To Samp le Code        
187          
188           #r egion Main  method        
189          
190           // / <summary >        
191           // / Standard  Main() me thod used  by most SD K samples.        
192           // / </summar y>        
193           // / <param n ame="args" ></param>        
194           st atic publi c void Mai n(string[]  args)        
195           {        
196                try        
197                {        
198                    // O btain the  target org anization' s Web addr ess and cl ient logon          
199                    // c redentials  from the  user.        
200                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
201                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
202          
203                    Roll upByObject  app = new  RollupByO bject();        
204                    app. Run(config , true);        
205                }        
206                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
207                {        
208                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
209                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
210                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
211                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
212                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
213                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
214                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
215                }        
216                catch (S ystem.Time outExcepti on ex)        
217                {        
218                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
219                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
220                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
221                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
222                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
223                }        
224                catch (S ystem.Exce ption ex)        
225                {        
226                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
227                    Cons ole.WriteL ine(ex.Mes sage);        
228          
229                    // D isplay the  details o f the inne r exceptio n.        
230                    if ( ex.InnerEx ception !=  null)        
231                    {        
232                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
233          
234                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
235                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
236                         if (fe !=  null)        
237                         {        
238                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
239                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
240                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
241                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
242                             Consol e.WriteLin e("Inner F ault: {0}" ,        
243                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
244                         }        
245                    }        
246                }        
247                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
248                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
249          
250                finally        
251                {        
252                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
253                    Cons ole.ReadLi ne();        
254                }        
255           }        
256          
257           #e ndregion M ain method        
258       }        
259   }        
260          
261          
262   //</snippe tRollupByO bject>