public bool Delete(Guid Id)
        {
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                var categoryObj = new ContentCategoriesBO().Get(ConnectionHandler, Id);
                if (new ContentCategoriesBO().Delete(ConnectionHandler, Id) == false)
                {
                    throw new Exception();
                }
                new SyncAdapterBO().DeprecateOldVersion(ConnectionHandler, categoryObj.CongressId);
                new SyncAdapterBO().Insert(ConnectionHandler, createSyncAdapter(categoryObj, Enums.QueryTypes.Delete, null));


                ConnectionHandler.CommitTransaction();

                return(true);
            }
            catch (Exception exp)
            {
                ConnectionHandler.RollBack();
            }

            return(false);
        }
        public bool Insert(ContentCategories cntCategory, HttpPostedFileBase @base)
        {
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);

                if (@base != null)
                {
                    cntCategory.Image = FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection).Insert(@base);
                }
                if (new ContentCategoriesBO().Insert(ConnectionHandler, cntCategory) == false)
                {
                    throw new Exception();
                }
                new SyncAdapterBO().Insert(ConnectionHandler, createSyncAdapter(cntCategory, Enums.QueryTypes.Insert, null));

                ConnectionHandler.CommitTransaction();

                return(true);
            }
            catch (Exception exp)
            {
                ConnectionHandler.RollBack();
            }

            return(false);
        }
Ejemplo n.º 3
0
 public bool ModifyEvaluation(FormEvaluation formEvaluation, string culture)
 {
     try
     {
         ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         new FormEvaluationBO().ModifyEvaluation(ConnectionHandler, this.FileManagerConnection, formEvaluation, culture);
         ConnectionHandler.CommitTransaction();
         FileManagerConnection.CommitTransaction();
         return(true);
     }
     catch (KnownException ex)
     {
         ConnectionHandler.RollBack();
         FileManagerConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw;
     }
     catch (Exception ex)
     {
         ConnectionHandler.RollBack();
         FileManagerConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public bool SentArticle(Article article, HttpPostedFileBase orginalFileId, FormStructure formModel)
        {
            ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>();
            bool      result;
            RefereeBO refereeBo = new RefereeBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                if (orginalFileId != null)
                {
                    article.OrginalFileId =
                        FileManagerComponent.Instance.FileTransactionalFacade(FileManagerConnection)
                        .Insert(orginalFileId);
                }
                new ArticleBO().SetStatus(article);
                ArticleBO articleBo = new ArticleBO();
                FormGeneratorComponent.Instance.FormDataTransactionalFacade(FormGeneratorConnection).ModifyFormData(formModel);
                articleBo.Update(ConnectionHandler, article);
                articleBo.SendArticle(ConnectionHandler, FileManagerConnection, article, keyValuePairs);
                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                result = true;
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.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();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    refereeBo.InformRefereeAddArticle(ConnectionHandler, article.CongressId, keyValuePairs);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public bool AdminUpdate(Guid adminId, Article obj, List <ArticleAuthors> articleAuthorses,
                                string comment, HttpPostedFileBase flowFile, HttpPostedFileBase orginalFileId, HttpPostedFileBase abstractFileId, FormStructure formModel)
        {
            bool      result;
            ArticleBO articleBo = new ArticleBO();

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

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                Article oldsatus = articleBo.Get(ConnectionHandler, obj.Id);
                articleBo.AdminUpdate(ConnectionHandler, FileManagerConnection, FormGeneratorConnection, adminId, obj, articleAuthorses, orginalFileId, abstractFileId, comment, flowFile, formModel);
                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                result = true;
                if (oldsatus.Status != obj.Status)
                {
                    articles.Add(obj, Resources.Congress.ArticleChangeStatusEmail, Resources.Congress.ArticleChangeStatusSMS);
                }
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.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();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                articleBo.InformArticle(ConnectionHandler, obj.CongressId, articles);
            }
            catch (Exception)
            {
            }
            return(result);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        public override bool Delete(params object[] keys)
        {
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                SlideBO     slideBo         = new SlideBO();
                Slide       obj             = slideBo.Get(ConnectionHandler, keys);
                SlideItemBO slideItemFacade = new SlideItemBO();

                List <SlideItem> list = new SlideItemBO().Where(ConnectionHandler,
                                                                supporter => supporter.SlideId == obj.Id);
                foreach (SlideItem slideItem in list)
                {
                    if (
                        !slideItemFacade.Delete(ConnectionHandler, FileManagerConnection, slideItem.Id))
                    {
                        throw new Exception("خطایی در ");
                    }
                }

                if (!slideBo.Delete(ConnectionHandler, keys))
                {
                    throw new Exception("خطایی در حذف اسلاید وجود دارد");
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                return(true);
            }

            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Ejemplo n.º 12
0
 public override bool Delete(Article obj)
 {
     try
     {
         ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         if (!new ArticleBO().Delete(ConnectionHandler, obj))
         {
             throw new Exception(Resources.Congress.ErrorInDeleteArticle);
         }
         ConnectionHandler.CommitTransaction();
         return(true);
     }
     catch (KnownException ex)
     {
         ConnectionHandler.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Ejemplo n.º 13
0
        public bool UpdateConfirmAdmin(Guid articleId, List <Guid> confirmList)
        {
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                if (!new ArticleUserCommentBO().UpdateConfirmAdmin(ConnectionHandler, articleId, confirmList))
                {
                    throw new Exception(Resources.Congress.ErrorInUpdateComments);
                }

                ConnectionHandler.CommitTransaction();
                return(true);
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                throw new KnownException(ex.Message, ex);
            }
        }
Ejemplo n.º 14
0
        public bool UserUpdate(Article article, List <ArticleAuthors> articleAuthorses,
                               HttpPostedFileBase abstractFileId,
                               HttpPostedFileBase orginalFileId, FormStructure formModel)
        {
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);

                if (
                    !articleBo.UserUpdate(ConnectionHandler, FileManagerConnection,
                                          FormGeneratorConnection, article, articleAuthorses, abstractFileId, orginalFileId,
                                          formModel))
                {
                    return(false);
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.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();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Ejemplo n.º 15
0
        public bool Update(Contents cnt, Guid?userId, HttpPostedFileBase @base)
        {
            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                if (@base != null)
                {
                    if (cnt.Image.HasValue)
                    {
                        FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection)
                        .Update(@base, cnt.Image.Value);
                    }
                    else
                    {
                        cnt.Image =
                            FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection)
                            .Insert(@base);
                    }
                }
                if (new ContentsBO().Update(ConnectionHandler, cnt) == false)
                {
                    throw new Exception();
                }
                new SyncAdapterBO().DeprecateOldVersion(ConnectionHandler, cnt.CongressId);
                new SyncAdapterBO().Insert(ConnectionHandler, createSyncAdapter(cnt, Enums.QueryTypes.Update, userId));


                ConnectionHandler.CommitTransaction();

                return(true);
            }
            catch (Exception exp)
            {
                ConnectionHandler.RollBack();
            }

            return(false);
        }
Ejemplo n.º 16
0
        public bool UserInsert(Article article, List <ArticleAuthors> articleAuthorses,
                               HttpPostedFileBase abstractFileId,
                               HttpPostedFileBase orginalFileId, FormStructure formModel)
        {
            bool result = false;

            ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs = new ModelView.InFormEntitiyList <RefereeCartable>();
            ModelView.InFormEntitiyList <Article>         articles      = new ModelView.InFormEntitiyList <Article>();
            ArticleBO articleBo = new ArticleBO();

            try
            {
                ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                FileManagerConnection.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);
                }

                ConnectionHandler.CommitTransaction();
                FileManagerConnection.CommitTransaction();
                FormGeneratorConnection.CommitTransaction();
                result = true;
                articles.Add(
                    article, Resources.Congress.ArticleInsertEmail,
                    Resources.Congress.ArticleInsertSMS
                    );
            }
            catch (KnownException)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                throw;
            }
            catch (Exception ex)
            {
                ConnectionHandler.RollBack();
                FileManagerConnection.RollBack();
                FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                articleBo.InformArticle(ConnectionHandler, article.CongressId, articles);
                new RefereeBO().InformRefereeAddArticle(ConnectionHandler, article.CongressId, keyValuePairs);
            }
            catch (Exception)
            {
            }
            return(result);
        }