Esempio n. 1
0
		private void attach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = this;
		}
Esempio n. 2
0
		private void detach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = null;
		}
Esempio n. 3
0
 partial void DeletetblNew(tblNew instance);
Esempio n. 4
0
 partial void UpdatetblNew(tblNew instance);
Esempio n. 5
0
 partial void InserttblNew(tblNew instance);
Esempio n. 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;
        }
Esempio n. 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;
        }