607. Araxis Merge File Comparison Report

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

607.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\CustomWorkflowActivities\TestNet4Activity SimpleSdkActivity.cs Tue Dec 20 19:51:45 2016 UTC
2 Wed Feb 1 19:56:52 2017 UTC

607.2 Comparison summary

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

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

607.4 Active regular expressions

No regular expressions were active.

607.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          
17   //<snippet SimpleSdkA ctivity>        
18   using Syst em;        
19   using Syst em.Activit ies;        
20   using Syst em.Collect ions.Objec tModel;        
21          
22   using Micr osoft.Crm. Sdk.Messag es;        
23          
24   using Micr osoft.Xrm. Sdk;        
25   using Micr osoft.Xrm. Sdk.Messag es;        
26   using Micr osoft.Xrm. Sdk.Query;        
27   using Micr osoft.Xrm. Sdk.Workfl ow;        
28          
29   namespace  Microsoft. Crm.Sdk.Sa mples        
30   {        
31           pu blic seale d class Si mpleSdkAct ivity : Co deActivity        
32           {        
33                    prot ected over ride void  Execute(Co deActivity Context ex ecutionCon text)        
34                    {        
35                             //Crea te the tra cing servi ce        
36                             ITraci ngService  tracingSer vice = exe cutionCont ext.GetExt ension<ITr acingServi ce>();        
37          
38                             //Crea te the con text        
39                             IWorkf lowContext  context =  execution Context.Ge tExtension <IWorkflow Context>() ;        
40                             IOrgan izationSer viceFactor y serviceF actory = e xecutionCo ntext.GetE xtension<I Organizati onServiceF actory>();        
41                             IOrgan izationSer vice servi ce = servi ceFactory. CreateOrga nizationSe rvice(cont ext.UserId );        
42          
43                             tracin gService.T race("Crea ting Accou nt");        
44          
45                             Accoun t entity =  new Accou nt();        
46                             entity .Name = Ac countName. Get<string >(executio nContext);        
47                             Guid e ntityId =  service.Cr eate(entit y);        
48          
49                             tracin gService.T race("Acco unt create d with Id  {0}", enti tyId.ToStr ing());        
50          
51                             tracin gService.T race("Crea te a task  for the ac count");        
52                             Task n ewTask = n ew Task();        
53                             newTas k.Subject  = TaskSubj ect.Get<st ring>(exec utionConte xt);        
54                             newTas k.Regardin gObjectId  = new Enti tyReferenc e(Account. EntityLogi calName, e ntityId);        
55          
56                             Guid t askId = se rvice.Crea te(newTask );        
57          
58                             tracin gService.T race("Task  has been  created");        
59          
60                             tracin gService.T race("Retr ieve the t ask using  QueryByAtt ribute");        
61                             QueryB yAttribute  query = n ew QueryBy Attribute( );        
62                             query. Attributes .AddRange( new string [] { "rega rdingobjec tid" });        
63                             query. ColumnSet  = new Colu mnSet(new  string[] {  "subject"  });        
64                             query. EntityName  = Task.En tityLogica lName;        
65                             query. Values.Add Range(new  object[] {  entityId  });        
66          
67                             tracin gService.T race("Exec uting the  Query for  entity {0} ", query.E ntityName) ;        
68          
69                             //Exec ute using  a request  to test th e OOB (XRM ) message  contracts        
70                             Retrie veMultiple Request re quest = ne w Retrieve MultipleRe quest();        
71                             reques t.Query =  query;        
72                             Collec tion<Entit y> entityL ist = ((Re trieveMult ipleRespon se)service .Execute(r equest)).E ntityColle ction.Enti ties;        
73          
74                             //Exec ute a requ est from t he CRM mes sage assem bly        
75                             tracin gService.T race("Exec uting a Wh oAmIReques t");        
76                             servic e.Execute( new WhoAmI Request()) ;        
77          
78                             if (1  != entityL ist.Count)        
79                             {        
80                                      tracingS ervice.Tra ce("The en tity list  was too lo ng");        
81                                      throw ne w InvalidP luginExecu tionExcept ion("Query  did not e xecute cor rectly");        
82                             }        
83                             else        
84                             {        
85                                      tracingS ervice.Tra ce("Castin g the Task  from Retr ieveMultip le to stro ng type");        
86                                      Task ret rievedTask  = (Task)e ntityList[ 0];        
87          
88                                      if (retr ievedTask. ActivityId  != taskId )        
89                                      {        
90                                               throw new  InvalidPlu ginExecuti onExceptio n("Incorre ct task wa s retrieve d");        
91                                      }        
92          
93                                      tracingS ervice.Tra ce("Retrie ving the e ntity from  IOrganiza tionServic e");        
94          
95                                      //Retrie ve the tas k using Re trieve        
96                                      retrieve dTask = (T ask)servic e.Retrieve (Task.Enti tyLogicalN ame, retri evedTask.I d, new Col umnSet("su bject"));        
97                                      if (!str ing.Equals (newTask.S ubject, re trievedTas k.Subject,  StringCom parison.Or dinal))        
98                                      {        
99                                               throw new  InvalidPlu ginExecuti onExceptio n("Task's  subject di d not get  retrieved  correctly" );        
100                                      }        
101          
102                                      //Update  the task        
103                                      retrieve dTask.Subj ect = Upda tedTaskSub ject.Get<s tring>(exe cutionCont ext);        
104                                      service. Update(ret rievedTask );        
105                             }        
106                    }        
107          
108                    [Inp ut("Accoun t Name")]        
109                    [Def ault("Test  Account:  {575A8B41- F8D7-4DCE- B2EA-3FFDE 936AB1B}") ]        
110                    publ ic InArgum ent<string > AccountN ame { get;  set; }        
111          
112                    [Inp ut("Task S ubject")]        
113                    [Def ault("Task  related t o account  {575A8B41- F8D7-4DCE- B2EA-3FFDE 936AB1B}") ]        
114                    publ ic InArgum ent<string > TaskSubj ect { get;  set; }        
115          
116                    [Inp ut("Update d Task Sub ject")]        
117                    [Def ault("UPDA TED: Task  related to  account { 575A8B41-F 8D7-4DCE-B 2EA-3FFDE9 36AB1B}")]        
118                    publ ic InArgum ent<string > UpdatedT askSubject  { get; se t; }        
119           }        
120          
121           pu blic seale d class Sd kWithLoose lyTypesAct ivity : Co deActivity        
122           {        
123                    prot ected over ride void  Execute(Co deActivity Context ex ecutionCon text)        
124                    {        
125                             //Crea te the tra cing servi ce        
126                             ITraci ngService  tracingSer vice = exe cutionCont ext.GetExt ension<ITr acingServi ce>();        
127          
128                             //Crea te the con text        
129                             IWorkf lowContext  context =  execution Context.Ge tExtension <IWorkflow Context>() ;        
130                             IOrgan izationSer viceFactor y serviceF actory = e xecutionCo ntext.GetE xtension<I Organizati onServiceF actory>();        
131                             IOrgan izationSer vice servi ce = servi ceFactory. CreateOrga nizationSe rvice(cont ext.UserId );        
132          
133                             tracin gService.T race("Crea ting Accou nt");        
134          
135                             tracin gService.T race("Crea ting Accou nt");        
136          
137                             Entity  entity =  new Entity ("account" );        
138                             entity .Attribute s["name"]  = AccountN ame.Get<st ring>(exec utionConte xt);        
139                             Guid e ntityId =  service.Cr eate(entit y);        
140          
141                             tracin gService.T race("Acco unt create d with Id  {0}", enti tyId.ToStr ing());        
142          
143                             tracin gService.T race("Crea te a task  for the ac count");        
144                             Entity  newTask =  new Entit y("task");        
145                             newTas k["subject "] = TaskS ubject.Get <string>(e xecutionCo ntext);        
146                             newTas k["regardi ngobjectid "] = new E ntityRefer ence("acco unt", enti tyId);        
147          
148                             Guid t askId = se rvice.Crea te(newTask );        
149          
150                             tracin gService.T race("Task  has been  created");        
151          
152                             Entity  updateTas k = new En tity("task ");        
153                             update Task.Id =  taskId;        
154                             update Task["subj ect"] = Up datedTaskS ubject.Get <string>(e xecutionCo ntext);        
155                             servic e.Update(u pdateTask) ;        
156          
157                             tracin gService.T race("Task  has been  updated");        
158                    }        
159          
160                    [Inp ut("Accoun t Name")]        
161                    [Def ault("Test  Account:  {575A8B41- F8D7-4DCE- B2EA-3FFDE 936AB1B}") ]        
162                    publ ic InArgum ent<string > AccountN ame { get;  set; }        
163          
164                    [Inp ut("Task S ubject")]        
165                    [Def ault("Task  related t o account  {575A8B41- F8D7-4DCE- B2EA-3FFDE 936AB1B}") ]        
166                    publ ic InArgum ent<string > TaskSubj ect { get;  set; }        
167          
168                    [Inp ut("Update d Task Sub ject")]        
169                    [Def ault("UPDA TED: Task  related to  account { 575A8B41-F 8D7-4DCE-B 2EA-3FFDE9 36AB1B}")]        
170                    publ ic InArgum ent<string > UpdatedT askSubject  { get; se t; }        
171           }        
172          
173           pu blic seale d class Si mpleSdkWit hRelatedEn titiesActi vity : Cod eActivity        
174           {        
175                    prot ected over ride void  Execute(Co deActivity Context ex ecutionCon text)        
176                    {        
177                             //Crea te the tra cing servi ce        
178                             ITraci ngService  tracingSer vice = exe cutionCont ext.GetExt ension<ITr acingServi ce>();        
179          
180                             //Crea te the con text        
181                             IWorkf lowContext  context =  execution Context.Ge tExtension <IWorkflow Context>() ;        
182                             IOrgan izationSer viceFactor y serviceF actory = e xecutionCo ntext.GetE xtension<I Organizati onServiceF actory>();        
183                             IOrgan izationSer vice servi ce = servi ceFactory. CreateOrga nizationSe rvice(cont ext.UserId );        
184          
185                             Relati onship pri maryContac tRelations hip = new  Relationsh ip("accoun t_primary_ contact");        
186          
187                             Guid p rimaryCont actId = se rvice.Crea te(new Con tact() { L astName =  RootContac tLastName. Get<string >(executio nContext)  });        
188          
189                             //trac ingService .Trace("Cr eate an Ac count with  an existi ng primary  contact") ;        
190                             Accoun t rootAcco unt = new  Account()  { Name = R elatedAcco untName.Ge t<string>( executionC ontext) };        
191                             Contac t primaryC ontact = n ew Contact ()        
192                             {        
193                                      EntitySt ate = Enti tyState.Ch anged,        
194                                      Id = pri maryContac tId,        
195                                      FirstNam e = RootCo ntactFirst Name.Get<s tring>(exe cutionCont ext)        
196                             };        
197          
198                             rootAc count.Rela tedEntitie s[primaryC ontactRela tionship]  =        
199                                      new Enti tyCollecti on(new Ent ity[] { pr imaryConta ct }) { En tityName =  Contact.E ntityLogic alName };        
200          
201                             tracin gService.T race("Exec ute the Cr eate/Updat e");        
202                             rootAc count.Id =  service.C reate(root Account);        
203          
204                             //Crea te the rel ated entit ies query        
205                             Relati onshipQuer yCollectio n retrieve RelatedEnt ities = ne w Relation shipQueryC ollection( );        
206                             retrie veRelatedE ntities[pr imaryConta ctRelation ship] = ne w QueryExp ression(Ac count.Enti tyLogicalN ame)        
207                             {        
208                                      ColumnSe t = new Co lumnSet("n ame"),        
209                                      Criteria  = new Fil terExpress ion()        
210                             };        
211          
212                             //Crea te the req uest        
213                             Retrie veResponse  response  = (Retriev eResponse) service.Ex ecute(new  RetrieveRe quest()        
214                             {        
215                                      ColumnSe t = new Co lumnSet("f irstname") ,        
216                                      RelatedE ntitiesQue ry = retri eveRelated Entities,        
217                                      Target =  new Entit yReference (primaryCo ntact.Logi calName, p rimaryCont act.Id)        
218                             });        
219          
220                             tracin gService.T race("Retr ieve the r ecord with  its relat ed entitie s");        
221                             Contac t retrieve dContact =  (Contact) response.E ntity;        
222                             Accoun t retrieve dAccount =  (Account) retrievedC ontact.Rel atedEntiti es[primary ContactRel ationship] [0];        
223          
224                             tracin gService.T race("Ensu re the fir st name wa s updated" );        
225                             if (re trievedCon tact.First Name == pr imaryConta ct.FirstNa me)        
226                             {        
227                                      tracingS ervice.Tra ce("Primar y Contact  name is co rrect");        
228                             }        
229                             else        
230                             {        
231                                      tracingS ervice.Tra ce("First  Name is \" {0}\", exp ected \"{1 }\".", ret rievedCont act.FirstN ame, prima ryContact. FirstName) ;        
232                                      throw ne w InvalidP luginExecu tionExcept ion("The f irst name  was not ch anged");        
233                             }        
234                    }        
235          
236                    [Inp ut("Relate d Account  Name")]        
237                    [Def ault("Rela ted Accoun t")]        
238                    publ ic InArgum ent<string > RelatedA ccountName  { get; se t; }        
239          
240                    [Inp ut("Root C ontact Fir st Name")]        
241                    [Def ault("New  FirstName" )]        
242                    publ ic InArgum ent<string > RootCont actFirstNa me { get;  set; }        
243          
244                    [Inp ut("Root C ontact Las t Name")]        
245                    [Def ault("Root  LastName" )]        
246                    publ ic InArgum ent<string > RootCont actLastNam e { get; s et; }        
247           }        
248   }        
249   //</snippe tSimpleSdk Activity>