예제 #1
0
		private void attach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = this;
		}
예제 #2
0
		private void detach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = null;
		}
예제 #3
0
 partial void DeletetblNew(tblNew instance);
예제 #4
0
 partial void UpdatetblNew(tblNew instance);
예제 #5
0
 partial void InserttblNew(tblNew instance);
예제 #6
0
        /// <summary>
        /// Cập nhật tin tức
        /// </summary>
        /// <param name="recordUpdate"></param>
        /// <returns></returns>
        public static Boolean updateNews(int newsID, tblNew recordUpdate)
        {
            LTDHDataContext DB = new LTDHDataContext(@strPathDB);

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    var news = DB.tblNews.Single(n => n.ID == newsID);
                    news.Title = recordUpdate.Title;
                    news.Chapaeu = recordUpdate.Chapaeu;
                    news.Contents = recordUpdate.Contents;
                    news.Posted = recordUpdate.Posted;
                    news.Author = recordUpdate.Author;

                    DB.SubmitChanges();
                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
예제 #7
0
        /// <summary>
        /// Thêm tin tức
        /// </summary>
        /// <param name="record"></param>
        /// <returns>Boolean</returns>
        public static Boolean insertNews(tblNew record)
        {
            LTDHDataContext DB = new LTDHDataContext(@strPathDB);

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    DB.tblNews.InsertOnSubmit(record);

                    DB.SubmitChanges();

                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }