/// <summary>
 /// Adds the time.
 /// </summary>
 /// <param name="d">The d.</param>
 public static bool AddTime(ref TimeData d)
 {
     using (var db = new TimeDataContext(TimeDataContext.DBConnectionString)) {
         var newTd = TimeData.Copy(d);
         db.TimeDataItems.InsertOnSubmit(newTd);
         db.SubmitChanges();
         d.ItemId = newTd.ItemId;
         return(newTd.ItemId > 0);
     }
 }
 /// <summary>
 /// Gets the time data item.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <returns>TimeData.</returns>
 public static TimeData GetTimeDataItem(int id)
 {
     using (var db = new TimeDataContext(TimeDataContext.DBConnectionString)) {
         try {
             TimeDataItem tdi = db.TimeDataItems.Single(s => s.ItemId == id);
             var          td  = TimeData.Copy(tdi);
             return(td);
         } catch (InvalidOperationException) {
             return(null);
         }
     }
 }