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

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

211.2 Comparison summary

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

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

211.4 Active regular expressions

No regular expressions were active.

211.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 WorkingWit hLeads>        
17   using Syst em;        
18   using Syst em.Service Model;        
19   using Micr osoft.Crm. Sdk.Messag es;        
20   using Micr osoft.Xrm. Sdk;        
21   using Micr osoft.Xrm. Sdk.Client ;        
22   using Micr osoft.Xrm. Sdk.Query;        
23          
24   namespace  Microsoft. Crm.Sdk.Sa mples        
25   {        
26       public  class Wor kingWithLe ads        
27       {        
28           #r egion Clas s Level Me mbers        
29           pr ivate Orga nizationSe rviceProxy  _serviceP roxy;        
30           pr ivate Guid  _lead1Id;        
31           pr ivate Guid  _lead2Id;        
32           pr ivate Guid  _accountI d;        
33           pr ivate Guid  _leadAcco untId;        
34           pr ivate Guid  _contactI d;        
35           pr ivate Guid  _opportun ityId;        
36           #e ndregion        
37          
38           #r egion How  To Sample  Code        
39          
40           pu blic void  Run(Server Connection .Configura tion serve rConfig,        
41                bool pro mptforDele te)        
42           {        
43                using (_ servicePro xy = new O rganizatio nServicePr oxy(server Config.Org anizationU ri, server Config.Hom eRealmUri, serverConf ig.Credent ials, serv erConfig.D eviceCrede ntials))        
44                {        
45                    // T his statem ent is req uired to e nable earl y bound ty pe support .        
46                    _ser viceProxy. EnableProx yTypes();        
47                    Crea teRequired Records();        
48          
49                    Cons ole.WriteL ine("=== C reating an d Qualifyi ng Leads = ==");        
50          
51                    // C reate two  leads.        
52                    var  lead1 = ne w Lead        
53                    {        
54                         CompanyNam e = "A. Da tum Corpor ation",        
55                         FirstName  = "Henriet te",        
56                         LastName =  "Andersen ",        
57                         Subject =  "Sample Le ad 1"        
58                    };        
59          
60                    _lea d1Id = _se rviceProxy .Create(le ad1);        
61                    Noti fyEntityCr eated(Lead .EntityLog icalName,  _lead1Id);        
62          
63                    var  lead2 = ne w Lead        
64                    {        
65                         CompanyNam e = "Adven ture Works ",        
66                         FirstName  = "Michael ",        
67                         LastName =  "Sullivan ",        
68                         Subject =  "Sample Le ad 2"        
69                    };        
70          
71                    _lea d2Id = _se rviceProxy .Create(le ad2);        
72                    Noti fyEntityCr eated(Lead .EntityLog icalName,  _lead2Id);        
73          
74                    //<s nippetWork ingWithLea ds1>        
75                    // Q ualify the  first lea d, creatin g an accou nt and a c ontact fro m it, but        
76                    // n ot creatin g an oppor tunity.        
77                    var  qualifyInt oAccountCo ntactReq =  new Quali fyLeadRequ est        
78                    {        
79                         CreateAcco unt = true ,        
80                         CreateCont act = true ,        
81                         LeadId = n ew EntityR eference(L ead.Entity LogicalNam e, _lead1I d),        
82                         Status = n ew OptionS etValue((i nt)lead_st atuscode.Q ualified)        
83                    };        
84          
85                    var  qualifyInt oAccountCo ntactRes =          
86                         (QualifyLe adResponse )_serviceP roxy.Execu te(qualify IntoAccoun tContactRe q);        
87                    Cons ole.WriteL ine("  The  first lea d was qual ified.");        
88                    //</ snippetWor kingWithLe ads1>        
89                    fore ach (var e ntity in q ualifyInto AccountCon tactRes.Cr eatedEntit ies)        
90                    {        
91                         NotifyEnti tyCreated( entity.Log icalName,  entity.Id) ;        
92                         if (entity .LogicalNa me == Acco unt.Entity LogicalNam e)        
93                         {        
94                             _leadA ccountId =  entity.Id ;        
95                         }        
96                         else if (e ntity.Logi calName ==  Contact.E ntityLogic alName)        
97                         {        
98                             _conta ctId = ent ity.Id;        
99                         }        
100                    }        
101          
102                    // R etrieve th e organiza tion's bas e currency  ID for se tting the        
103                    // t ransaction  currency  of the opp ortunity.        
104                    var  query = ne w QueryExp ression("o rganizatio n");        
105                             query. ColumnSet  = new Colu mnSet("bas ecurrencyi d");        
106                             var re sult = _se rviceProxy .RetrieveM ultiple(qu ery);        
107                             var cu rrencyId =  (EntityRe ference)re sult.Entit ies[0]["ba securrency id"];        
108          
109                    // Q ualify the  second le ad, creati ng an oppo rtunity fr om it, and  not        
110                    // c reating an  account o r a contac t.  We use  an existi ng account  for the        
111                    // o pportunity  customer  instead.        
112                    var  qualifyInt oOpportuni tyReq = ne w QualifyL eadRequest        
113                    {        
114                         CreateOppo rtunity =  true,        
115                         Opportunit yCurrencyI d = curren cyId,        
116                         Opportunit yCustomerI d = new En tityRefere nce(        
117                             Accoun t.EntityLo gicalName,        
118                             _accou ntId),        
119                         Status = n ew OptionS etValue((i nt)lead_st atuscode.Q ualified),        
120                         LeadId = n ew EntityR eference(L ead.Entity LogicalNam e, _lead2I d)        
121                    };        
122          
123                    var  qualifyInt oOpportuni tyRes =        
124                         (QualifyLe adResponse )_serviceP roxy.Execu te(qualify IntoOpport unityReq);        
125                    Cons ole.WriteL ine("  The  second le ad was qua lified.");        
126          
127                    fore ach (var e ntity in q ualifyInto Opportunit yRes.Creat edEntities )        
128                    {        
129                         NotifyEnti tyCreated( entity.Log icalName,  entity.Id) ;        
130                         if (entity .LogicalNa me == Oppo rtunity.En tityLogica lName)        
131                         {        
132                             _oppor tunityId =  entity.Id ;        
133                         }        
134                    }        
135          
136                    Dele teRecords( promptforD elete);        
137                }        
138           }        
139          
140           pr ivate void  NotifyEnt ityCreated (String en tityName,  Guid entit yId)        
141           {        
142                Console. WriteLine( "  {0} cre ated with  GUID {{{1} }}",        
143                    enti tyName, en tityId);        
144           }        
145          
146           pr ivate void  CreateReq uiredRecor ds()        
147           {        
148                // Creat e an accou nt to rela te the opp ortunity t o.        
149                var acco unt = new  Account        
150                {        
151                    Name  = "Litwar e, Inc.",        
152                    Addr ess1_State OrProvince  = "Colora do"        
153                };        
154                _account Id = (_ser viceProxy. Create(acc ount));        
155           }        
156          
157           pr ivate void  DeleteRec ords(bool  prompt)        
158           {        
159                bool toB eDeleted =  true;        
160          
161                if (prom pt)        
162                {        
163                    // A sk the use r if the c reated ent ities shou ld be dele ted.        
164                    Cons ole.Write( "\nDo you  want these  entity re cords dele ted? (y/n)  [y]: ");        
165                    Stri ng answer  = Console. ReadLine() ;        
166                    if ( answer.Sta rtsWith("y ") ||        
167                         answer.Sta rtsWith("Y ") ||        
168                         answer ==  String.Emp ty)        
169                    {        
170                         toBeDelete d = true;        
171                    }        
172                    else        
173                    {        
174                         toBeDelete d = false;        
175                    }        
176                }        
177          
178                if (toBe Deleted)        
179                {        
180                    // D eleting th e accounts  will dele te all of  their rela ted record s, and the n        
181                    // o nly the le ads will b e left.        
182                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _accou ntId);        
183                    _ser viceProxy. Delete(Acc ount.Entit yLogicalNa me, _leadA ccountId);        
184          
185                    _ser viceProxy. Delete(Lea d.EntityLo gicalName,  _lead1Id) ;        
186                    _ser viceProxy. Delete(Lea d.EntityLo gicalName,  _lead2Id) ;        
187                }        
188           }        
189          
190           #e ndregion H ow To Samp le Code        
191          
192           #r egion Main  method        
193          
194           // / <summary >        
195           // / Standard  Main() me thod used  by most SD K samples.        
196           // / </summar y>        
197           // / <param n ame="args" ></param>        
198           st atic publi c void Mai n(string[]  args)        
199           {        
200                try        
201                {        
202                    // O btain the  target org anization' s web addr ess and cl ient logon          
203                    // c redentials  from the  user.        
204                    Serv erConnecti on serverC onnect = n ew ServerC onnection( );        
205                    Serv erConnecti on.Configu ration con fig = serv erConnect. GetServerC onfigurati on();        
206          
207                    var  app = new  WorkingWit hLeads();        
208                    app. Run(config , true);        
209                }        
210                catch (F aultExcept ion<Micros oft.Xrm.Sd k.Organiza tionServic eFault> ex )        
211                {        
212                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
213                    Cons ole.WriteL ine("Times tamp: {0}" , ex.Detai l.Timestam p);        
214                    Cons ole.WriteL ine("Code:  {0}", ex. Detail.Err orCode);        
215                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Detail. Message);        
216                    Cons ole.WriteL ine("Plugi n Trace: { 0}", ex.De tail.Trace Text);        
217                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
218                         null == ex .Detail.In nerFault ?  "No Inner  Fault" :  "Has Inner  Fault");        
219                }        
220                catch (S ystem.Time outExcepti on ex)        
221                {        
222                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
223                    Cons ole.WriteL ine("Messa ge: {0}",  ex.Message );        
224                    Cons ole.WriteL ine("Stack  Trace: {0 }", ex.Sta ckTrace);        
225                    Cons ole.WriteL ine("Inner  Fault: {0 }",        
226                         null == ex .InnerExce ption.Mess age ? "No  Inner Faul t" : ex.In nerExcepti on.Message );        
227                }        
228                catch (S ystem.Exce ption ex)        
229                {        
230                    Cons ole.WriteL ine("The a pplication  terminate d with an  error.");        
231                    Cons ole.WriteL ine(ex.Mes sage);        
232          
233                    // D isplay the  details o f the inne r exceptio n.        
234                    if ( ex.InnerEx ception !=  null)        
235                    {        
236                         Console.Wr iteLine(ex .InnerExce ption.Mess age);        
237          
238                         FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> f e = ex.Inn erExceptio n        
239                             as Fau ltExceptio n<Microsof t.Xrm.Sdk. Organizati onServiceF ault>;        
240                         if (fe !=  null)        
241                         {        
242                             Consol e.WriteLin e("Timesta mp: {0}",  fe.Detail. Timestamp) ;        
243                             Consol e.WriteLin e("Code: { 0}", fe.De tail.Error Code);        
244                             Consol e.WriteLin e("Message : {0}", fe .Detail.Me ssage);        
245                             Consol e.WriteLin e("Plugin  Trace: {0} ", fe.Deta il.TraceTe xt);        
246                             Consol e.WriteLin e("Inner F ault: {0}" ,        
247                                 nu ll == fe.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault");        
248                         }        
249                    }        
250                }        
251                // Addit ional exce ptions to  catch: Sec urityToken Validation Exception,  ExpiredSe curityToke nException ,        
252                // Secur ityAccessD eniedExcep tion, Mess ageSecurit yException , and Secu rityNegoti ationExcep tion.        
253          
254                finally        
255                {        
256                    Cons ole.WriteL ine("Press  <Enter> t o exit.");        
257                    Cons ole.ReadLi ne();        
258                }        
259           }        
260           #e ndregion M ain method        
261       }        
262   }        
263   //</snippe tWorkingWi thLeads>