示例#1
0
        public bool Update(Guid congressId, News.DataStructure.News news, NewsContent newsContent, NewsProperty property, HttpPostedFileBase @base)
        {
            try
            {
                this.NewsConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                news.IsExternal = true;
                if (
                    !NewsComponent.Instance.NewsTransactionalFacade(this.NewsConnection)
                    .Update(news, newsContent, property, @base))
                {
                    throw new Exception("خطایی در ذخیره اخبار وجود دارد");
                }


                this.NewsConnection.CommitTransaction();

                return(true);
            }
            catch (KnownException ex)
            {
                this.NewsConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.NewsConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
示例#2
0
 public bool Insert(Guid websiteId, News.DataStructure.News news, NewsContent newsContent, NewsProperty newsproperty, HttpPostedFileBase file)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.NewsConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         news.IsExternal = true;
         if (!NewsComponent.Instance.NewsTransactionalFacade(this.NewsConnection).Insert(news, newsContent, newsproperty, file))
         {
             throw new Exception("خطایی درذخیره اخبار وجود دارد");
         }
         var congressNews = new Radyn.WebDesign.DataStructure.News {
             NewsId = news.Id, WebId = websiteId
         };
         if (!new NewsBO().Insert(this.ConnectionHandler, congressNews))
         {
             throw new Exception("خطایی درذخیره اخبار وجود دارد");
         }
         this.ConnectionHandler.CommitTransaction();
         this.NewsConnection.CommitTransaction();
         return(true);
     }
     catch (KnownException knownException)
     {
         this.ConnectionHandler.RollBack();
         this.NewsConnection.RollBack();
         throw new KnownException(knownException.Message, knownException);
     }
     catch (Exception ex)
     {
         this.ConnectionHandler.RollBack();
         this.NewsConnection.RollBack();
         throw new KnownException(ex.Message, ex);
     }
 }
示例#3
0
        public static NewsContent GetNewsContent(this News.DataStructure.News news, string culture)
        {
            var value = new NewsContentFacade().Get(news.Id, culture);

            if (value != null)
            {
                return(value);
            }
            var newcontent = new NewsContent()
            {
                Body = "", Title1 = "", Title2 = "", Lead = "", Sutitr = "", OverTitle = ""
            };

            return(newcontent);
        }