Пример #1
0
        public bool UserInsert(ref Article article, List <ArticleAuthors> articleAuthorses,
                               HttpPostedFileBase abstractFileId,
                               HttpPostedFileBase orginalFileId, List <DiscountType> transactionDiscountAttaches, string callbackurl,
                               FormStructure formModel)
        {
            try
            {
                ArticleBO articleBo = new ArticleBO();
                ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>();
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                if (!articleBo.UserInsert(ConnectionHandler, FileManagerConnection,
                                          FormGeneratorConnection, article, articleAuthorses, abstractFileId, orginalFileId,
                                          formModel))
                {
                    return(false);
                }

                if (!articleBo.SendArticle(ConnectionHandler, FileManagerConnection, article, keyValuePairs))
                {
                    return(false);
                }

                article = new ArticleBO().Get(ConnectionHandler, article.Id);
                bool articlePaymnet = new ArticleBO().ArticlePaymnet(ConnectionHandler, PaymentConnection,
                                                                     ref article, transactionDiscountAttaches, callbackurl + article.Id);
                if (!articlePaymnet)
                {
                    throw new Exception(string.Format(Resources.Congress.ErrorInPayArticleAmount,
                                                      Extention.GetAtricleTitle(article.CongressId)));
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                PaymentConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                PaymentConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                PaymentConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Пример #2
0
        public Guid UpdateStatusAfterTransaction(Guid congressId, Guid id)
        {
            ModelView.ModifyResult <Article> afterTransactionModel;
            ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>();
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                Article article = new ArticleBO().Get(ConnectionHandler, id);
                if (article == null || article.TempId == null)
                {
                    return(Guid.Empty);
                }

                afterTransactionModel = new ArticleBO().UpdateStatusAfterTransaction(ConnectionHandler, PaymentConnection, FileManagerConnection, (Guid)article.TempId, keyValuePairs);
                ConnectionHandler.CommitTransaction();
                PaymentConnection.CommitTransaction();
                FileManagerConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                PaymentConnection.RollBack();
                FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                PaymentConnection.RollBack();
                FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                new RefereeBO().InformRefereeAddArticle(ConnectionHandler, congressId, keyValuePairs);
            }
            catch (Exception)
            {
            }
            try
            {
                if (afterTransactionModel.SendInform)
                {
                    new ArticleBO().InformArticle(ConnectionHandler, congressId, afterTransactionModel.InformList);
                }
            }
            catch (Exception)
            {
            }
            return(afterTransactionModel == null ? Guid.Empty : afterTransactionModel.TransactionId);
        }
Пример #3
0
        public bool ArticlePaymnet(Article article, List <DiscountType> transactionDiscountAttaches, string callbackurl)
        {
            bool Resultpaymnet;

            ModelView.InFormEntitiyList <Article> articles = new ModelView.InFormEntitiyList <Article>();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                if (
                    !new ArticleBO().ArticlePaymnet(ConnectionHandler, PaymentConnection, ref article,
                                                    transactionDiscountAttaches, callbackurl))
                {
                    return(false);
                }

                ConnectionHandler.CommitTransaction();
                PaymentConnection.CommitTransaction();
                Resultpaymnet = true;
                articles.Add(article, Resources.Congress.ArticlePaymentEmail, Resources.Congress.ArticlePaymentSMS);
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                PaymentConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                PaymentConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (Resultpaymnet)
                {
                    new ArticleBO().InformArticle(ConnectionHandler, article.CongressId, articles);
                }
            }
            catch (Exception)
            {
            }
            return(Resultpaymnet);
        }