示例#1
0
		private void detach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = null;
		}
示例#2
0
 partial void DeletetblNew(tblNew instance);
示例#3
0
		private void attach_tblNews(tblNew entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = this;
		}
示例#4
0
 partial void InserttblNew(tblNew instance);
示例#5
0
 partial void UpdatetblNew(tblNew instance);
示例#6
0
        /// <summary>
        /// Cập nhật tin tức
        /// </summary>
        /// <param name="recordUpdate"></param>
        /// <returns></returns>
        public Boolean updateNews(int newsID, tblNew recordUpdate)
        {
            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="_title"></param>
        /// <param name="_chapeau"></param>
        /// <param name="_content"></param>
        /// <returns></returns>
        public Boolean insertNews(string _author, string _title, string _chapeau, string _content)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    tblNew record = new tblNew();
                    record.Title = _title;
                    record.Chapaeu = _chapeau;
                    record.Contents = _content;
                    record.Author = _author;
                    record.Posted = DateTime.Now;

                    DB.tblNews.InsertOnSubmit(record);

                    DB.SubmitChanges();

                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
示例#8
0
        /// <summary>
        /// Thêm tin tức
        /// </summary>
        /// <param name="record"></param>
        /// <returns>Boolean</returns>
        public Boolean insertNews(tblNew record)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    DB.tblNews.InsertOnSubmit(record);

                    DB.SubmitChanges();

                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
示例#9
0
 private string buildTopNews(tblNew item)
 {
     string data = "";
     try
     {
         data += "<h3>\n";
         data += "                " + item.Title + "";
         if (DateTime.Today.Year == item.Posted.Year && DateTime.Today.DayOfYear - item.Posted.DayOfYear <= 4)
         {
             data += BaseServices.createMsgByTemplate(CommonConstants.TEMP_IMG_NEW_LINK, CommonConstants.PATH_NEW_LINK_ICON);
         }
         data += "</h3>\n";
         data += "            <h5>\n";
         data += "                Post ngày " + item.Posted + " bởi <b>" + item.tblUser.DisplayName.Trim() + "</b></h5>\n";
         data += "            <p>\n";
         data += item.Chapaeu.Trim() + "...";
         data += BaseServices.createMsgByTemplate(CommonConstants.TEMP_NEWS_LINK, item.ID.ToString(), CommonConstants.TXT_VIEW_MORE);
         data += "            </p>\n";
     }
     catch (Exception ex)
     {
         log.writeLog(Server.MapPath(CommonConstants.PATH_LOG_FILE), ex.Message
                                                                     + CommonConstants.NEWLINE
                                                                     + ex.Source
                                                                     + CommonConstants.NEWLINE
                                                                     + ex.StackTrace
                                                                     + CommonConstants.NEWLINE
                                                                     + ex.HelpLink);
         Session[CommonConstants.SES_ERROR] = CommonConstants.MSG_E_COMMON_ERROR_TEXT;
         Response.Redirect(CommonConstants.PAGE_ERROR);
     }
     return data;
 }
示例#10
0
        private tblNew getData(object sender, EventArgs e)
        {
            tblNew item = new tblNew();
            item.Chapaeu = txtChapeau.Text;
            item.Contents = txtContent.Text;

            return item;
        }