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); }
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); }
public IEnumerable <Article> GetByUserId(Configuration configuration, Guid id) { try { ArticleBO articleBo = new ArticleBO(); List <Article> list = articleBo.Where(ConnectionHandler, x => x.UserId == id); foreach (Article article in list) { UserFillComplex(article, configuration); } return(list.OrderByDescending(x => x.Code)); } 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); } }