Esempio n. 1
0
 /// <DeleteRssReader>
 /// Delete RssReader
 /// </summary>
 /// <param name="rss">Set rssid in a RssReader Class Property and Pass the Object of RssReader Class.(Domein.RssReader)</param>
 /// <returns>Return 1 for true and 0 for false.(int)</returns>
 public int DeleteRssReader(Domain.Socioboard.Domain.RssReader rss)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action to delete RssReader by id.
                 NHibernate.IQuery query = session.CreateQuery("delete from RssReader where Id = :adsid")
                                           .SetParameter("adsid", rss.Id);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
 /// <DeleteRssReader>
 /// Delete RssReader
 /// </summary>
 /// <param name="rss">Set rssid in a RssReader Class Property and Pass the Object of RssReader Class.(Domein.RssReader)</param>
 /// <returns>Return 1 for true and 0 for false.(int)</returns>
 public int DeleteRssReader(RssReader rss)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action to delete RssReader by id.
                 NHibernate.IQuery query = session.CreateQuery("delete from RssReader where Id = :adsid")
                                 .SetParameter("adsid", rss.Id);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return isUpdated;
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return 0;
             }
         }//End Transaction
     }//End Session
 }
Esempio n. 3
0
 /// <AddRssReader>
 /// Add new RssReader
 /// </summary>
 /// <param name="rss">Set Values in a RssReader Class Property and Pass the Object of RssReader Class.(Domein.RssReader)</param>
 public void AddRssReader(Domain.Socioboard.Domain.RssReader rss)
 {
     try
     {
         //Creates a database connection and opens up a session
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             //After Session creation, start Transaction.
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 //Proceed action, to save new data.
                 session.Save(rss);
                 transaction.Commit();
             } //End Transaction
         }     //End Session
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
 /// <AddRssReader>
 /// Add new RssReader
 /// </summary>
 /// <param name="rss">Set Values in a RssReader Class Property and Pass the Object of RssReader Class.(Domein.RssReader)</param>
 public void AddRssReader(RssReader rss)
 {
     try
     {
         //Creates a database connection and opens up a session
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             //After Session creation, start Transaction.
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 //Proceed action, to save new data.
                 session.Save(rss);
                 transaction.Commit();
             }//End Transaction
         }//End Session
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
 public void UpdateRssReader(RssReader rss)
 {
     throw new NotImplementedException();
 }