Exemplo n.º 1
0
 public static DataTable GetFeeds()
 {
     try
     {
         using (dsTableAdapters.FeedTableAdapter ta = new dsTableAdapters.FeedTableAdapter())
         {
             ta.Fill(feeds);
             return feeds;
         }
     }
     catch
     {
         var dr = feeds.GetErrors();
         if (dr.Length > 0)
         {
             Notificator.NotifyMessage(dr[0].RowError);
         }
         throw;
     }
 }
Exemplo n.º 2
0
 public static void DeleteFeed(int feedId)
 {
     try
     {
         using (SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.nReaderConnectionString))
         {
             conn.Open();
             using(SqlCeTransaction tran = conn.BeginTransaction())
             {
                 SqlCeCommand cmd = conn.CreateCommand();
                 cmd.CommandText = "delete from [Topic] where [FeedId] = @FeedId";
                 cmd.Parameters.Add(new SqlCeParameter("@FeedId", feedId));
                 cmd.ExecuteNonQuery();
                 cmd = conn.CreateCommand();
                 cmd.CommandText = "delete from [Feed] where [Id] = @FeedId";
                 cmd.Parameters.Add(new SqlCeParameter("@FeedId", feedId));
                 cmd.ExecuteNonQuery();
                 tran.Commit();
             }
             conn.Close();
         }
         using (dsTableAdapters.FeedTableAdapter ta = new dsTableAdapters.FeedTableAdapter())
         {
             ta.Fill(feeds);
         }
     }
     catch
     {
         var dr = feeds.GetErrors();
         if (dr.Length > 0)
         {
             Notificator.NotifyMessage(dr[0].RowError);
         }
         throw;
     }
 }
Exemplo n.º 3
0
 public static void SaveFeed(ds.FeedRow feed)
 {
     try
     {
         using (dsTableAdapters.FeedTableAdapter ta = new dsTableAdapters.FeedTableAdapter())
         {
             if (feed.Id == 0)
             {
                 feeds.AddFeedRow(feed);
             }
             ta.Update(feed);
             ta.Fill(feeds);
         }
     }
     catch
     {
         var dr = feeds.GetErrors();
         if (dr.Length > 0)
         {
             Notificator.NotifyMessage(dr[0].RowError);
         }
         throw;
     }
 }