@@ -170,7 +170,14 @@ private static WorkItem CreateAndPopulateWorkItem(WorkItem oldWi, Project destPr
170170
171171
172172 // WorkItem newwit = oldWi.Copy(destProject.WorkItemTypes[destType]);
173+ var NewWorkItemstartTime = DateTime . UtcNow ;
174+ Stopwatch NewWorkItemTimer = new Stopwatch ( ) ;
173175 WorkItem newwit = destProject . WorkItemTypes [ destType ] . NewWorkItem ( ) ;
176+ NewWorkItemTimer . Stop ( ) ;
177+ Telemetry . Current . TrackDependency ( "TeamService" , "NewWorkItem" , NewWorkItemstartTime , NewWorkItemTimer . Elapsed , true ) ;
178+ Trace . WriteLine ( string . Format ( "Dependnacy: {0} - {1} - {2} - {3} - {4}" , "TeamService" , "NewWorkItem" , NewWorkItemstartTime , NewWorkItemTimer . Elapsed , true ) ) ;
179+
180+
174181 newwit . Title = oldWi . Title ;
175182 newwit . State = oldWi . State ;
176183 switch ( newwit . State )
@@ -253,25 +260,42 @@ private static string ReplaceFirstOccurence(string wordToReplace, string replace
253260 }
254261
255262
256- private static void BuildFieldTable ( WorkItem oldWi , StringBuilder history )
263+ private static void BuildFieldTable ( WorkItem oldWi , StringBuilder history , bool useHTML = false )
257264 {
258- history . Append ( "<p> </p>" ) ;
259- history . Append ( "<table border='1' cellpadding='2' style='width:100%;border-color:#C0C0C0;'><tr><td><b>Field</b></td><td><b>Value</b></td></tr>" ) ;
265+ if ( useHTML ) {
266+ history . Append ( "<p> </p>" ) ;
267+ history . Append ( "<table border='1' cellpadding='2' style='width:100%;border-color:#C0C0C0;'><tr><td><b>Field</b></td><td><b>Value</b></td></tr>" ) ;
268+ }
260269 foreach ( Field f in oldWi . Fields )
261270 {
262271 if ( f . Value == null )
263272 {
264- history . AppendFormat ( "<tr><td style='text-align:right;white-space:nowrap;'><b>{0}</b></td><td>n/a</td></tr>" , f . Name ) ;
265-
273+ if ( useHTML )
274+ {
275+ history . AppendFormat ( "<tr><td style='text-align:right;white-space:nowrap;'><b>{0}</b></td><td>n/a</td></tr>" , f . Name ) ;
276+ } else
277+ {
278+ history . AppendLine ( string . Format ( "{0}: null" , f . Name ) ) ;
279+ }
266280 }
267281 else
268282 {
269- history . AppendFormat ( "<tr><td style='text-align:right;white-space:nowrap;'><b>{0}</b></td><td style='width:100%'>{1}</td></tr>" , f . Name , f . Value . ToString ( ) ) ;
283+ if ( useHTML )
284+ {
285+ history . AppendFormat ( "<tr><td style='text-align:right;white-space:nowrap;'><b>{0}</b></td><td style='width:100%'>{1}</td></tr>" , f . Name , f . Value . ToString ( ) ) ;
286+
287+ } else
288+ {
289+ history . AppendLine ( string . Format ( "{0}: {1}" , f . Name , f . Value . ToString ( ) ) ) ;
290+ }
270291 }
271292
272293 }
273- history . Append ( "</table>" ) ;
274- history . Append ( "<p> </p>" ) ;
294+ if ( useHTML )
295+ {
296+ history . Append ( "</table>" ) ;
297+ history . Append ( "<p> </p>" ) ;
298+ }
275299 }
276300
277301 private static void BuildCommentTable ( WorkItem oldWi , StringBuilder history )
0 commit comments