Esempio n. 1
0
        public bool AdminUpdateArticles(Guid congressId, List <Article> model)
        {
            ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>();
            bool      result;
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                var transactionTransactionalFacade = PaymentComponenets.Instance.TransactionTransactionalFacade(PaymentConnection);
                var list = articleBo.Where(ConnectionHandler, x => x.Id.In(model.Select(article => article.Id)));
                foreach (Article obj in list)
                {
                    articleBo.AdminSetStatus(obj);
                    if (obj.PayStatus.HasValue)
                    {
                        obj.PayStatus = obj.PayStatus;
                        if (obj.PayStatus == (byte)Enums.ArticlepayState.PayConfirm && obj.TransactionId != null)
                        {
                            transactionTransactionalFacade.Done((Guid)obj.TransactionId);
                        }
                    }
                    articleBo.Update(ConnectionHandler, obj);
                    articles.Add(obj, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS);
                }
                ConnectionHandler.CommitTransaction();
                result = true;
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    articleBo.InformArticle(ConnectionHandler, congressId, articles);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 2
0
        public bool UpdateStatus(Guid congressId, List <Guid> guids, FinalState status)
        {
            ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>();
            bool      result;
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                if (!guids.Any())
                {
                    return(true);
                }

                List <Article> list = articleBo.Where(ConnectionHandler, x => x.Id.In(guids));
                foreach (Article item in list)
                {
                    item.FinalState = (byte)status;
                    articleBo.AdminSetStatus(item);
                    articleBo.Update(ConnectionHandler, item);
                    articles.Add(item, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS);
                }
                ConnectionHandler.CommitTransaction();
                result = true;
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    articleBo.InformArticle(ConnectionHandler, congressId, articles);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 3
0
 public bool AdminUpdate(Article obj)
 {
     try
     {
         ArticleBO articleBo = new ArticleBO();
         articleBo.AdminSetStatus(obj);
         return(base.Update(obj));
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }