Produced by Araxis Merge on 10/26/2017 10:44:23 PM Eastern Daylight 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Oct 27 02:44:23 2017 UTC | ||
| 2 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\Source\Sources\BMS.Vista.TestEis\BMS.Utils | Extensions.cs | Wed Oct 18 18:47:02 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 522 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Collect ions; | |||||
| 3 | using Syst em.Collect ions.Gener ic; | |||||
| 4 | using Syst em.Linq; | |||||
| 5 | using Syst em.Linq.Ex pressions; | |||||
| 6 | using Syst em.Text; | |||||
| 7 | using Syst em.Web.Mvc ; | |||||
| 8 | using Info World.HL7. ITS; | |||||
| 9 | ||||||
| 10 | namespace BMS.Utils | |||||
| 11 | { | |||||
| 12 | /// <s ummary> | |||||
| 13 | /// Ex tension cl ass. | |||||
| 14 | /// </ summary> | |||||
| 15 | public static cl ass Extens ion | |||||
| 16 | { | |||||
| 17 | pu blic stati c bool Exi sts<T>(thi s IList<T> list, Pre dicate<T> predicate) | |||||
| 18 | { | |||||
| 19 | for (int i = 0; i < list.Cou nt; i++) | |||||
| 20 | if ( predicate( list[i])) | |||||
| 21 | return tru e; | |||||
| 22 | return f alse; | |||||
| 23 | } | |||||
| 24 | ||||||
| 25 | pu blic stati c string E lapsedTime (this Time Span timeS pan) | |||||
| 26 | { | |||||
| 27 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 28 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 29 | { | |||||
| 30 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 31 | } | |||||
| 32 | try | |||||
| 33 | { | |||||
| 34 | Stri ngBuilder resultBuil der = new StringBuil der(); | |||||
| 35 | resu ltBuilder. Clear(); | |||||
| 36 | stri ng days = ((int)time Span.Days) .ToString( ); | |||||
| 37 | stri ng hours = ((int)tim eSpan.Hour s).ToStrin g(); | |||||
| 38 | if ( days.Lengt h > 1) | |||||
| 39 | resultBuil der.Append (days); | |||||
| 40 | else | |||||
| 41 | resultBuil der.Append (string.Fo rmat("0{0} ", days)); | |||||
| 42 | resu ltBuilder. Append(":" ); | |||||
| 43 | if ( hours.Leng th > 1) | |||||
| 44 | resultBuil der.Append (hours); | |||||
| 45 | else | |||||
| 46 | resultBuil der.Append (string.Fo rmat("0{0} ", hours)) ; | |||||
| 47 | ||||||
| 48 | retu rn resultB uilder.ToS tring(); | |||||
| 49 | } | |||||
| 50 | finally | |||||
| 51 | { | |||||
| 52 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 53 | { | |||||
| 54 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 55 | } | |||||
| 56 | } | |||||
| 57 | } | |||||
| 58 | ||||||
| 59 | pu blic stati c int Inde xOf<T>(thi s IList<T> source, P redicate<T > predicat e) | |||||
| 60 | { | |||||
| 61 | for (int i = 0; i < source.C ount; i++) | |||||
| 62 | if ( predicate( source[i]) ) | |||||
| 63 | return i; | |||||
| 64 | ||||||
| 65 | return - 1; | |||||
| 66 | } | |||||
| 67 | ||||||
| 68 | // / <summary > | |||||
| 69 | // / Sorts th e specifie d source. | |||||
| 70 | // / </summar y> | |||||
| 71 | // / <typepar am name="T "></typepa ram> | |||||
| 72 | // / <param n ame="sourc e">The sou rce.</para m> | |||||
| 73 | // / <param n ame="sortE xpression" >The sort expression .</param> | |||||
| 74 | // / <returns ></returns > | |||||
| 75 | pu blic stati c IEnumera ble<T> Sor t<T>(this IEnumerabl e<T> sourc e, string sortExpres sion) | |||||
| 76 | { | |||||
| 77 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 78 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 79 | { | |||||
| 80 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 81 | } | |||||
| 82 | try | |||||
| 83 | { | |||||
| 84 | stri ng[] sortP arts = sor tExpressio n.Split(' '); | |||||
| 85 | var param = Ex pression.P arameter(t ypeof(T), string.Emp ty); | |||||
| 86 | try | |||||
| 87 | { | |||||
| 88 | var proper ty = Expre ssion.Prop erty(param , sortPart s[0]); | |||||
| 89 | var sortLa mbda = Exp ression.La mbda<Func< T, object> >(Expressi on.Convert (property, typeof(ob ject)), pa ram); | |||||
| 90 | ||||||
| 91 | if (sortPa rts.Length > 1 && so rtParts[1] .Equals("d esc", Stri ngComparis on.Ordinal IgnoreCase )) | |||||
| 92 | { | |||||
| 93 | return source.As Queryable< T>().Order ByDescendi ng<T, obje ct>(sortLa mbda); | |||||
| 94 | } | |||||
| 95 | return sou rce.AsQuer yable<T>() .OrderBy<T , object>( sortLambda ); | |||||
| 96 | } | |||||
| 97 | catc h (Argumen tException ) | |||||
| 98 | { | |||||
| 99 | return sou rce; | |||||
| 100 | } | |||||
| 101 | } | |||||
| 102 | finally | |||||
| 103 | { | |||||
| 104 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 105 | { | |||||
| 106 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 107 | } | |||||
| 108 | } | |||||
| 109 | } | |||||
| 110 | ||||||
| 111 | // / <summary > | |||||
| 112 | // / ForEach for IEnume rable coll ection. | |||||
| 113 | // / </summar y> | |||||
| 114 | // / <typepar am name="T "></typepa ram> | |||||
| 115 | // / <param n ame="sourc e"></param > | |||||
| 116 | // / <param n ame="actio n"></param > | |||||
| 117 | pu blic stati c void For Each<T>(th is IEnumer able<T> so urce, Acti on<T> acti on) | |||||
| 118 | { | |||||
| 119 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 120 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 121 | { | |||||
| 122 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 123 | } | |||||
| 124 | try | |||||
| 125 | { | |||||
| 126 | fore ach (T t i n source) | |||||
| 127 | action(t); | |||||
| 128 | ||||||
| 129 | } | |||||
| 130 | finally | |||||
| 131 | { | |||||
| 132 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 133 | { | |||||
| 134 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 135 | } | |||||
| 136 | } | |||||
| 137 | } | |||||
| 138 | ||||||
| 139 | // Sorts an IList<T> in place. | |||||
| 140 | pu blic stati c void Sor t<T>(this IList<T> l ist, Compa rison<T> c omparison) | |||||
| 141 | { | |||||
| 142 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 143 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 144 | { | |||||
| 145 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 146 | } | |||||
| 147 | try | |||||
| 148 | { | |||||
| 149 | Arra yList.Adap ter((IList )list).Sor t(new Comp arisonComp arer<T>(co mparison)) ; | |||||
| 150 | } | |||||
| 151 | finally | |||||
| 152 | { | |||||
| 153 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 154 | { | |||||
| 155 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 156 | } | |||||
| 157 | } | |||||
| 158 | } | |||||
| 159 | ||||||
| 160 | // Convenien ce method on IEnumer able<T> to allow pas sing of a | |||||
| 161 | // Compariso n<T> deleg ate to the OrderBy m ethod. | |||||
| 162 | pu blic stati c IEnumera ble<T> Ord erBy<T>(th is IEnumer able<T> li st, Compar ison<T> co mparison) | |||||
| 163 | { | |||||
| 164 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 165 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 166 | { | |||||
| 167 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 168 | } | |||||
| 169 | try | |||||
| 170 | { | |||||
| 171 | retu rn list.Or derBy(t => t, new Co mparisonCo mparer<T>( comparison )); | |||||
| 172 | } | |||||
| 173 | finally | |||||
| 174 | { | |||||
| 175 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 176 | { | |||||
| 177 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 178 | } | |||||
| 179 | } | |||||
| 180 | } | |||||
| 181 | ||||||
| 182 | // / <summary > | |||||
| 183 | // / Converts the given <seealso cref="T:IE numerable< T>" /> to a <seealso cref="T:L ist<T>" /> instance with items in the li st sorted using the given <see also cref= "T:Compari son<T>" /> . | |||||
| 184 | // / </summar y> | |||||
| 185 | // / <typepar am name="T ">The type of the co llection/l ist.</type param> | |||||
| 186 | // / <param n ame="sourc e">The sou rce collec tion.</par am> | |||||
| 187 | // / <param n ame="compa rison">The optional comparison delegate called to compare th e items. I f not spec ified, it uses defau lt compare r.</param> | |||||
| 188 | // / <returns >The list containing the items in given <paramref name="sour ce" /> sor ted using the given <paramref name="comp arison" /> delegate. </returns> | |||||
| 189 | pu blic stati c List<T> ToSortedLi st<T>(this IEnumerab le<T> sour ce, ICompa rer<T> com parer) | |||||
| 190 | { | |||||
| 191 | var list = new Lis t<T>(); | |||||
| 192 | ||||||
| 193 | if (comp arer == nu ll) | |||||
| 194 | { | |||||
| 195 | comp arer = Com parer<T>.D efault; | |||||
| 196 | } | |||||
| 197 | ||||||
| 198 | foreach (var item in source) | |||||
| 199 | { | |||||
| 200 | var index = li st.BinaryS earch(item , comparer ); | |||||
| 201 | if ( index < 0) | |||||
| 202 | { | |||||
| 203 | // The neg ative valu e indicate s the item is not in the list and 2's co mplement o f it gives us the po sition to insert it into. | |||||
| 204 | index = ~i ndex; | |||||
| 205 | } | |||||
| 206 | ||||||
| 207 | list .Insert(in dex, item) ; | |||||
| 208 | } | |||||
| 209 | ||||||
| 210 | return l ist; | |||||
| 211 | } | |||||
| 212 | ||||||
| 213 | // / <summary > | |||||
| 214 | // / Determin es whether the given collectio n is null or has no items. | |||||
| 215 | // / </summar y> | |||||
| 216 | // / <typepar am name="T ">The type of collec tion.</typ eparam> | |||||
| 217 | // / <param n ame="sourc e">The col lection.</ param> | |||||
| 218 | // / <returns ><c>true</ c> if the collection is null o r has no i tems; <c>f alse</c> o therwise.< /returns> | |||||
| 219 | pu blic stati c bool IsN ullOrEmpty <T>(this I Enumerable <T> source ) | |||||
| 220 | { | |||||
| 221 | return s ource == n ull || !so urce.Any() ; | |||||
| 222 | } | |||||
| 223 | ||||||
| 224 | pu blic stati c void Rem oveRange<T >(this ICo llection<T > source, IEnumerabl e<T> items ) | |||||
| 225 | { | |||||
| 226 | foreach (var item in items) | |||||
| 227 | { | |||||
| 228 | sour ce.Remove( item); | |||||
| 229 | } | |||||
| 230 | } | |||||
| 231 | ||||||
| 232 | pu blic stati c decimal ParseDecim al(this st ring str, decimal de faultValue = 0) | |||||
| 233 | { | |||||
| 234 | decimal value; | |||||
| 235 | ||||||
| 236 | if (!dec imal.TryPa rse(str, o ut value)) | |||||
| 237 | { | |||||
| 238 | valu e = defaul tValue; | |||||
| 239 | } | |||||
| 240 | ||||||
| 241 | return v alue; | |||||
| 242 | } | |||||
| 243 | ||||||
| 244 | pu blic stati c IEnumera ble<T> Uni on<T>(this IEnumerab le<IEnumer able<T>> e numerables ) | |||||
| 245 | { | |||||
| 246 | var unio n = Enumer able.Empty <T>(); | |||||
| 247 | foreach (var enume rable in e numerables ) | |||||
| 248 | { | |||||
| 249 | unio n = union. Union(enum erable); | |||||
| 250 | } | |||||
| 251 | return u nion; | |||||
| 252 | } | |||||
| 253 | ||||||
| 254 | pu blic stati c IEnumera ble<T> DoA ction<T>(t his IEnume rable<T> s ource, Act ion<T> act ion) | |||||
| 255 | { | |||||
| 256 | foreach (var item in source) | |||||
| 257 | { | |||||
| 258 | acti on(item); | |||||
| 259 | yiel d return i tem; | |||||
| 260 | } | |||||
| 261 | } | |||||
| 262 | ||||||
| 263 | pu blic stati c IEnumera ble<string > JoinAndS plitByLeng th(this IE numerable< string> st rings, cha r joinBy, int maxLen gth) | |||||
| 264 | { | |||||
| 265 | if (stri ngs != nul l && strin gs.Any()) | |||||
| 266 | { | |||||
| 267 | var sb = new S tringBuild er(); | |||||
| 268 | ||||||
| 269 | fore ach (var i tem in str ings) | |||||
| 270 | { | |||||
| 271 | if (sb.Len gth + item .Length < maxLength) | |||||
| 272 | { | |||||
| 273 | if (sb .Length > 0) | |||||
| 274 | { | |||||
| 275 | sb .Append(jo inBy); | |||||
| 276 | } | |||||
| 277 | ||||||
| 278 | sb.App end(item); | |||||
| 279 | } | |||||
| 280 | else | |||||
| 281 | { | |||||
| 282 | yield return sb. ToString() ; | |||||
| 283 | sb.Cle ar(); | |||||
| 284 | } | |||||
| 285 | } | |||||
| 286 | ||||||
| 287 | if ( sb.Length > 0) | |||||
| 288 | { | |||||
| 289 | yield retu rn sb.ToSt ring(); | |||||
| 290 | } | |||||
| 291 | } | |||||
| 292 | } | |||||
| 293 | ||||||
| 294 | pu blic stati c string G etFriendly Name(this Type comma ndType) | |||||
| 295 | { | |||||
| 296 | return c ommandType .IsGeneric Type ? str ing.Format ("{0}<{1}> ", command Type.Name. Split('`') .First(), string.Joi n(", ", co mmandType. GetGeneric Arguments( ).Select(x => GetFri endlyName( x)))) : co mmandType. Name; | |||||
| 297 | } | |||||
| 298 | } | |||||
| 299 | ||||||
| 300 | // Wra ps a gener ic Compari son<T> del egate in a n ICompare r to make it easy | |||||
| 301 | // to use a lamb da express ion for me thods that take an I Comparer o r ICompare r<T> | |||||
| 302 | public class Com parisonCom parer<T> : IComparer <T>, IComp arer | |||||
| 303 | { | |||||
| 304 | pr ivate read only Compa rison<T> _ comparison ; | |||||
| 305 | ||||||
| 306 | pu blic Compa risonCompa rer(Compar ison<T> co mparison) | |||||
| 307 | { | |||||
| 308 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 309 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 310 | { | |||||
| 311 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 312 | } | |||||
| 313 | try | |||||
| 314 | { | |||||
| 315 | _com parison = comparison ; | |||||
| 316 | } | |||||
| 317 | finally | |||||
| 318 | { | |||||
| 319 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 320 | { | |||||
| 321 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 322 | } | |||||
| 323 | } | |||||
| 324 | } | |||||
| 325 | ||||||
| 326 | pu blic int C ompare(T x , T y) | |||||
| 327 | { | |||||
| 328 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 329 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 330 | { | |||||
| 331 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 332 | } | |||||
| 333 | try | |||||
| 334 | { | |||||
| 335 | retu rn _compar ison(x, y) ; | |||||
| 336 | } | |||||
| 337 | finally | |||||
| 338 | { | |||||
| 339 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 340 | { | |||||
| 341 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 342 | } | |||||
| 343 | } | |||||
| 344 | } | |||||
| 345 | ||||||
| 346 | pu blic int C ompare(obj ect o1, ob ject o2) | |||||
| 347 | { | |||||
| 348 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 349 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 350 | { | |||||
| 351 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 352 | } | |||||
| 353 | try | |||||
| 354 | { | |||||
| 355 | retu rn _compar ison((T)o1 , (T)o2); | |||||
| 356 | } | |||||
| 357 | finally | |||||
| 358 | { | |||||
| 359 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 360 | { | |||||
| 361 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 362 | } | |||||
| 363 | } | |||||
| 364 | } | |||||
| 365 | } | |||||
| 366 | ||||||
| 367 | /// <s ummary> | |||||
| 368 | /// MV C TempData extension s for Cont roller. | |||||
| 369 | /// </ summary> | |||||
| 370 | public static cl ass TempDa taExtensio ns | |||||
| 371 | { | |||||
| 372 | // / <summary > | |||||
| 373 | // / Puts a s trong type d object i n the Cont roller Tem pData dict ionary usi ng a defau lt key for the stron g type. | |||||
| 374 | // / </summar y> | |||||
| 375 | // / <typepar am name="T ">The stro ng type fo r the valu e.</typepa ram> | |||||
| 376 | // / <param n ame="tempD ata">Exten sion appli es to Temp Data from Controller .</param> | |||||
| 377 | // / <param n ame="value ">The stro ng typed v alue.</par am> | |||||
| 378 | pu blic stati c void Put <T>(this T empDataDic tionary te mpData, T value) whe re T : cla ss | |||||
| 379 | { | |||||
| 380 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 381 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 382 | { | |||||
| 383 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 384 | } | |||||
| 385 | try | |||||
| 386 | { | |||||
| 387 | temp Data[typeo f(T).FullN ame] = val ue; | |||||
| 388 | } | |||||
| 389 | finally | |||||
| 390 | { | |||||
| 391 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 392 | { | |||||
| 393 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 394 | } | |||||
| 395 | } | |||||
| 396 | } | |||||
| 397 | // / <summary > | |||||
| 398 | // / Puts a s trong type d object i n the Cont roller Tem pData dict ionary usi ng a strin g key. | |||||
| 399 | // / </summar y> | |||||
| 400 | // / <typepar am name="T ">The stro ng type fo r the valu e.</typepa ram> | |||||
| 401 | // / <param n ame="tempD ata">Exten sion appli es to Temp Data from Controller .</param> | |||||
| 402 | // / <param n ame="key"> Dictionary key where to store the object .</param> | |||||
| 403 | // / <param n ame="value ">The stro ng typed v alue.</par am> | |||||
| 404 | pu blic stati c void Put <T>(this T empDataDic tionary te mpData, St ring key, T value) w here T : c lass | |||||
| 405 | { | |||||
| 406 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 407 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 408 | { | |||||
| 409 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 410 | } | |||||
| 411 | try | |||||
| 412 | { | |||||
| 413 | temp Data[typeo f(T).FullN ame + key] = value; | |||||
| 414 | } | |||||
| 415 | finally | |||||
| 416 | { | |||||
| 417 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 418 | { | |||||
| 419 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 420 | } | |||||
| 421 | } | |||||
| 422 | } | |||||
| 423 | // / <summary > | |||||
| 424 | // / Gets a s trong type value fro m the Cont roller Tem pData dict ionary. | |||||
| 425 | // / </summar y> | |||||
| 426 | // / <typepar am name="T ">The stro ng type of the value .</typepar am> | |||||
| 427 | // / <param n ame="tempD ata">Exten sion appli es to Temp Data from Controller .</param> | |||||
| 428 | // / <returns ></returns > | |||||
| 429 | pu blic stati c T Get<T> (this Temp DataDictio nary tempD ata) where T : class | |||||
| 430 | { | |||||
| 431 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 432 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 433 | { | |||||
| 434 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 435 | } | |||||
| 436 | try | |||||
| 437 | { | |||||
| 438 | obje ct o = nul l; | |||||
| 439 | temp Data.TryGe tValue(typ eof(T).Ful lName, out o); | |||||
| 440 | retu rn (T)o ?? null; | |||||
| 441 | } | |||||
| 442 | finally | |||||
| 443 | { | |||||
| 444 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 445 | { | |||||
| 446 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 447 | } | |||||
| 448 | } | |||||
| 449 | } | |||||
| 450 | // / <summary > | |||||
| 451 | // / Gets a s trong type value fro m the Cont roller Tem pData dict ionary usi ng a speci fic key. | |||||
| 452 | // / </summar y> | |||||
| 453 | // / <typepar am name="T ">The stro ng type of the value .</typepar am> | |||||
| 454 | // / <param n ame="key"> Dictionary key where the stron g type val ue is stor ed.</param > | |||||
| 455 | // / <param n ame="tempD ata">Exten sion appli es to Temp Data from Controller .</param> | |||||
| 456 | // / <returns ></returns > | |||||
| 457 | pu blic stati c T Get<T> (this Temp DataDictio nary tempD ata, Strin g key) whe re T : cla ss | |||||
| 458 | { | |||||
| 459 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 460 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 461 | { | |||||
| 462 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 463 | } | |||||
| 464 | try | |||||
| 465 | { | |||||
| 466 | obje ct o = nul l; | |||||
| 467 | temp Data.TryGe tValue(typ eof(T).Ful lName + ke y, out o); | |||||
| 468 | retu rn (T)o ?? null; | |||||
| 469 | } | |||||
| 470 | finally | |||||
| 471 | { | |||||
| 472 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 473 | { | |||||
| 474 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 475 | } | |||||
| 476 | } | |||||
| 477 | } | |||||
| 478 | } | |||||
| 479 | ||||||
| 480 | public static cl ass CDExte nsions | |||||
| 481 | { | |||||
| 482 | pu blic stati c bool IsY es(this CD cd) | |||||
| 483 | { | |||||
| 484 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 485 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 486 | { | |||||
| 487 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 488 | } | |||||
| 489 | try | |||||
| 490 | { | |||||
| 491 | retu rn cd.code == Consta nts.Yes; | |||||
| 492 | } | |||||
| 493 | finally | |||||
| 494 | { | |||||
| 495 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 496 | { | |||||
| 497 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 498 | } | |||||
| 499 | } | |||||
| 500 | } | |||||
| 501 | ||||||
| 502 | pu blic stati c bool IsN o(this CD cd) | |||||
| 503 | { | |||||
| 504 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 505 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 506 | { | |||||
| 507 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 508 | } | |||||
| 509 | try | |||||
| 510 | { | |||||
| 511 | retu rn cd.code == Consta nts.No; | |||||
| 512 | } | |||||
| 513 | finally | |||||
| 514 | { | |||||
| 515 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 516 | { | |||||
| 517 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 518 | } | |||||
| 519 | } | |||||
| 520 | } | |||||
| 521 | } | |||||
| 522 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.