示例#1
0
 public void DeleteItem(int itemNumber)
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         context.ExecuteCommand("DELETE FROM TvItems WHERE ItemNumber = {0}", itemNumber);
     }
 }
示例#2
0
 public void ClearChangeLogs()
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         context.ExecuteCommand("TRUNCATE Table ChangeLogs");
     }
 }
示例#3
0
 public IEnumerable <TVItem> GetAll()
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         return(context.TVItems.ToList());
     }
 }
示例#4
0
 public void ChangeItemChangeLog(ChangeLog changeLog)
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         context.ChangeLogs.InsertOnSubmit(changeLog);
         context.SubmitChanges();
     }
 }
示例#5
0
 public void AddItem(TVItem item)
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         context.TVItems.InsertOnSubmit(item);
         context.SubmitChanges();
     }
 }
示例#6
0
 public void UpdateItem(TVItem item)
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         context.TVItems.Attach(item);
         context.Refresh(RefreshMode.KeepCurrentValues, item);
         context.SubmitChanges();
     }
 }
示例#7
0
 public void RemoveItemChangeLog(int itemNumber)
 {
     using (var context = new TVItemsDataContext(_connectionString))
     {
         var changeLog = new ChangeLog
         {
             ItemNumber = itemNumber,
             ChangeType = "Remove"
         };
         context.ChangeLogs.InsertOnSubmit(changeLog);
         context.SubmitChanges();
     }
 }