Esempio n. 1
0
        public List <Tools.ModelView.ArticleCertificateModel> GetAllArticleCertificate(Homa homa, Article article,
                                                                                       string serachvalue, FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <ModelView.ArticleCertificateModel> list = new List <Tools.ModelView.ArticleCertificateModel>();

                ArticleBO      articleBo = new ArticleBO();
                List <Article> search    = articleBo.Search(ConnectionHandler, homa.Id, article, serachvalue, ascendingDescending, articleflow, formStructure);
                foreach (Article item in search)
                {
                    list.AddRange(articleBo.GetArticleCertificate(ConnectionHandler, item.Id, homa, true));
                }
                return(list);
            }
            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);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public ModelView.ModifyResult <RefereeCartable> AssigneArticleToRefreeCartabl(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconection, Guid articleId, Guid flowsender, List <Guid> refereesId, bool specialrefereesender = false)
        {
            var keyValuePairs = new ModelView.ModifyResult <RefereeCartable>();
            var articleBo     = new ArticleBO();
            var article       = articleBo.Get(connectionHandler, articleId);
            var config        = new ConfigurationBO().ValidConfig(connectionHandler, article.CongressId);

            article.FinalState = (byte)Enums.FinalState.WaitForAnswer;
            bool articleSpecialReferee = config.SentArticleSpecialReferee;

            if (refereesId.Count > 0)
            {
                if (config.SentArticleSpecialReferee)
                {
                    if (specialrefereesender)
                    {
                        articleSpecialReferee = false;
                        article.Status        = (byte)Enums.ArticleState.WaitForRefereeOpinion;
                    }
                    else
                    {
                        article.Status = (byte)Enums.ArticleState.SentToSpecialReferee;
                    }
                }
                else
                {
                    article.Status = (byte)Enums.ArticleState.WaitForRefereeOpinion;
                }
            }
            if (!articleBo.Update(connectionHandler, article))
            {
                return(keyValuePairs);
            }
            if (
                !this.UpdateRefreeCartabl(connectionHandler, filemanagerconection,
                                          article, flowsender, refereesId, articleSpecialReferee))
            {
                return(keyValuePairs);
            }
            foreach (var guid in refereesId)
            {
                keyValuePairs.AddInform(
                    new RefereeCartable()
                {
                    RefereeId = guid, ArticleId = articleId
                }, Resources.Congress.RefereeInformArticleEmail,
                    Resources.Congress.RefereeInformArticleSMS);
            }

            keyValuePairs.Result     = true;
            keyValuePairs.SendInform = true;
            return(keyValuePairs);
        }
Esempio n. 6
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. 7
0
        public IEnumerable <Tools.ModelView.ReportChartModel> ChartChash(IConnectionHandler connectionHandler,
                                                                         Guid congressId, string year = "", string month = "")
        {
            var list             = new List <Tools.ModelView.ReportChartModel>();
            var workShopUsers    = new WorkShopUserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var hotelUsers       = new HotelUserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var users            = new UserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var transactionId    = new ArticleBO().GetTransactionId(connectionHandler, congressId, year, month);
            var enumerable       = new UserBoothBO().GetTransactionId(connectionHandler, congressId, year, month);
            var reportChartModel = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)workShopUsers,
                Value        = Resources.Congress.Workshop,
                StringFormat = "N0"
            };

            list.Add(reportChartModel);
            var chartModel = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)hotelUsers,
                Value        = Resources.Congress.Hotel,
                StringFormat = "N0"
            };

            list.Add(chartModel);
            var model = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)enumerable,
                Value        = Resources.Congress.booth,
                StringFormat = "N0"
            };

            list.Add(model);
            var chartModel1 = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)users,
                Value        = Resources.Congress.User,
                StringFormat = "N0"
            };

            list.Add(chartModel1);
            var item = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)transactionId,
                Value        = Resources.Congress.Article,
                StringFormat = "N0"
            };

            list.Add(item);
            return(list);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 10
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);
     }
 }
Esempio n. 11
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);
            }
        }
Esempio n. 12
0
        public List <dynamic> SearchDynamic(Guid congressId, Article article, string serachvalue,
                                            FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <dynamic> searchArticleList = new ArticleBO().SearchDynamic(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow);
                if (!searchArticleList.Any())
                {
                    return(searchArticleList);
                }

                List <Guid> @select = new List <Guid>();
                if (searchArticleList.Any())
                {
                    List <Guid> idlist = searchArticleList.Select(user1 => (Guid)user1.Id).ToList();
                    @select = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId,
                                                             x => x.ArticleId.In(idlist), true);
                }

                foreach (dynamic item in searchArticleList)
                {
                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;
                    item.Abstract           = item.Abstract == null ? "" : ((string)item.Abstract).RemoveHtml();
                    item.ArticleOrginalText = item.ArticleOrginalText == null ? "" : ((string)item.ArticleOrginalText).RemoveHtml();
                }
                return(searchArticleList);
            }
            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);
            }
        }
Esempio n. 13
0
        public IEnumerable <Article> GetAllForZipFile(Guid congressId, Article article, string serachvalue,
                                                      FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                List <Article> search = new ArticleBO().Search(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow, formStructure);
                if (!search.Any())
                {
                    return(null);
                }

                List <Guid> @select = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId,
                                                                     x => x.ArticleId.In(search.Select(i => i.Id)), true);
                foreach (Article item in search)
                {
                    if (!string.IsNullOrEmpty(item.Abstract))
                    {
                        item.Abstract = Regex.Replace(item.Abstract, "<.*?>", "");
                    }

                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;
                    item.Abstract           = item.Abstract == null ? "" : item.Abstract.RemoveHtml();
                    item.ArticleOrginalText = item.ArticleOrginalText == null ? "" : item.ArticleOrginalText.RemoveHtml();
                }
                return(search);
            }
            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);
            }
        }
Esempio n. 14
0
        public override bool Delete(params object[] keys)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);

                var articlePaymentTypeBo = new ArticlePaymentTypeBO();
                var obj = articlePaymentTypeBo.Get(this.ConnectionHandler, keys);
                var configurationSupportTypes = new ArticleBO().Any(ConnectionHandler,
                                                                    supporter => supporter.PaymentTypeId == obj.Id);
                if (configurationSupportTypes)
                {
                    throw new Exception(string.Format(Resources.Congress.ErrorInDeleteArticlePaymentTypeThisUseInArticle, Tools.Extention.GetAtricleTitle(obj.CongressId), Tools.Extention.GetAtricleTitle(obj.CongressId)));
                }
                if (!articlePaymentTypeBo.Delete(this.ConnectionHandler, keys))
                {
                    throw new Exception(string.Format(Resources.Congress.ErrorInDeleteArticlePaymentTypeThisUseInArticle, Tools.Extention.GetAtricleTitle(obj.CongressId), Tools.Extention.GetAtricleTitle(obj.CongressId)));
                }

                this.ConnectionHandler.CommitTransaction();

                return(true);
            }

            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
        }
Esempio n. 15
0
        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);
            }
        }
Esempio n. 16
0
        public bool AnswerArticle(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconnection, Guid congressId,
                                  RefereeCartable refereeCartable, Guid answeredrefreeId, string comments,
                                  HttpPostedFileBase attachment)
        {
            var articleBo     = new ArticleBO();
            var articleFlowBo = new ArticleFlowBO();
            var config        = new ConfigurationBO().ValidConfig(connectionHandler, congressId);
            var refree        = new RefereeBO().Get(connectionHandler, answeredrefreeId);


            if (!this.ModifyCartabl(connectionHandler, refereeCartable.ArticleId, answeredrefreeId,
                                    refereeCartable.Status, refereeCartable.Visited, false))
            {
                return(false);
            }

            var article = articleBo.Get(connectionHandler, refereeCartable.ArticleId);

            article.FinalState = (byte)Enums.FinalState.WaitForAnswer;
            if (config.SentArticleSpecialReferee)
            {
                article.Status = refree.IsSpecial
                    ? (byte)Enums.ArticleState.WaitForScientificTeacher
                    : (byte)Enums.ArticleState.WaitforSpecialRefereeOpinion;
            }
            else
            {
                article.Status = (byte)Enums.ArticleState.WaitForScientificTeacher;
            }

            if (!articleBo.Update(connectionHandler, article))
            {
                throw new Exception(string.Format(Resources.Congress.ErrorInEditArticleCongress, Extention.GetAtricleTitle(article.CongressId)));
            }

            var lastSenderId = new ArticleFlowBO().SelectFirstOrDefault(connectionHandler, x => x.SenderId,
                                                                        x => x.ReceiverId == answeredrefreeId && x.ArticleId == article.Id,
                                                                        new OrderByModel <ArticleFlow>()
            {
                Expression = x => x.SaveDate + "" + x.SaveTime,
                OrderType  = OrderType.DESC
            });


            var lastrefree = new RefereeBO().Get(connectionHandler, lastSenderId);

            if (lastrefree != null && lastrefree.IsSpecial)
            {
                var lastrefereeCartable = new RefereeCartable();
                lastrefereeCartable = this.FirstOrDefaultWithOrderByDescending(connectionHandler, x => x.InsertDate,
                                                                               x => x.ArticleId == article.Id && x.RefereeId == lastrefree.Id);

                if (lastrefereeCartable != null)
                {
                    if (!this.ModifyCartabl(connectionHandler, lastrefereeCartable.ArticleId, lastSenderId,
                                            (byte)Enums.FinalState.RefereeAnswered, lastrefereeCartable.Visited, false))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!this.ModifyCartabl(connectionHandler, article.Id, lastSenderId, (byte)Enums.FinalState.WaitForAnswer, false, true))
                    {
                        return(false);
                    }
                }

                if (!articleFlowBo.AddFlow(connectionHandler, filemanagerconnection, answeredrefreeId, lastSenderId != Guid.Empty ? lastSenderId : (Guid?)null, refereeCartable.ArticleId,
                                           refereeCartable.Status, comments, attachment))
                {
                    return(false);
                }
            }
            else
            {
                var articleFlow =
                    articleFlowBo.FirstOrDefaultWithOrderBy(connectionHandler, x => x.SaveDate + " " + x.SaveTime,
                                                            x => x.ArticleId == refereeCartable.ArticleId && x.ReceiverId == answeredrefreeId);
                var senderId = articleFlow != null ? articleFlow.SenderId : (Guid?)null;
                if (!articleFlowBo.AddFlow(connectionHandler, filemanagerconnection, answeredrefreeId, senderId,
                                           refereeCartable.ArticleId, refereeCartable.Status, comments, attachment))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
        public void InformRefereeAddArticle(IConnectionHandler connectionHandler, Guid congressId, ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs)
        {
            if (!keyValuePairs.Any())
            {
                return;
            }
            var refereeBo = new RefereeBO();
            var arti      = keyValuePairs.FirstOrDefault();
            var referee   = refereeBo.Get(connectionHandler, arti.obj.RefereeId);
            var homa1     = new HomaBO().Get(connectionHandler, congressId);
            var articleBo = new ArticleBO();
            var config    = homa1.Configuration;

            if (config.RefereeInformType == null)
            {
                return;
            }
            CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == congressId && x.Type == Enums.MessageInformType.RefereeArticle);

            foreach (var article in keyValuePairs)
            {
                var article1 = articleBo.Get(connectionHandler, article.obj.ArticleId);
                if (article1 == null)
                {
                    continue;
                }
                var name                       = referee.EnterpriseNode.DescriptionFieldWithGender;
                var homaCompleteUrl            = homa1.GetHomaCompleteUrl();
                var homaArticleRefereePanelUrl = homa1.GetHomaArticleRefereePanelUrl(article1.Id, referee.Id);
                var email                      = string.Format(article.EmailBody, homa1.CongressTitle, name, article1.Title, homaCompleteUrl, homaArticleRefereePanelUrl);
                var sms = string.Format(article.SmsBody, homa1.CongressTitle, name, article1.Code);

                if (custommessage != null)
                {
                    if (!string.IsNullOrEmpty(custommessage.EmailText))
                    {
                        email = custommessage.EmailText.Replace($"[{Enums.RefereeArticleMessageKey.FullName.ToString()}]", name);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.Username.ToString()}]", referee.Username);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.ArticleCode.ToString()}]", article1.Code.ToString());
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.ArticleTitle.ToString()}]", article1.Title);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                    if (!string.IsNullOrEmpty(custommessage.SmsText))
                    {
                        sms = custommessage.SmsText.Replace($"[{Enums.RefereeArticleMessageKey.FullName.ToString()}]", name);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.Username.ToString()}]", referee.Username);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.ArticleCode.ToString()}]", article1.Code.ToString());
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.ArticleTitle.ToString()}]", article1.Title);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                }


                var inform = new Message.Tools.ModelView.MessageModel()
                {
                    Email      = referee.EnterpriseNode.Email,
                    Mobile     = referee.EnterpriseNode.Cellphone,
                    EmailTitle = homa1.CongressTitle,
                    EmailBody  = email,
                    SMSBody    = sms
                };
                new HomaBO().SendInform((byte)config.RefereeInformType, inform, config, homa1.CongressTitle);
                MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa1.OwnerId, config.CongressId,
                                                                                             new[] { referee.EnterpriseNode.Id.ToString() }, homa1.CongressTitle, inform.SMSBody);
            }
        }
Esempio n. 19
0
        public IEnumerable <ModelView.UserArticleAbstract> SearchArticle(Guid congressId, Article article, string serachvalue, FormStructure formStructure, Enums.AscendingDescending ascendingDescending, Enums.SortAccordingToArticle articleflow)
        {
            try
            {
                ArticleBO      articleBo = new ArticleBO();
                List <Article> list      = articleBo.Search(ConnectionHandler, congressId, article, serachvalue, ascendingDescending, articleflow, formStructure);
                if (!list.Any())
                {
                    return(null);
                }

                List <ModelView.UserArticleAbstract> outlist = new List <ModelView.UserArticleAbstract>();
                List <ArticleAuthors> articleAuthorses       = new ArticleAuthorsBO().Where(ConnectionHandler, c => c.ArticleId.In(list.Select(i => i.Id)));
                Homa homa = new HomaBO().Get(ConnectionHandler, congressId);
                ConfigurationContent configcontent = new ConfigurationContentBO().Get(ConnectionHandler, congressId, homa.Configuration.CardLanguageId);
                List <Guid>          @select       = new RefereeCartableBO().Select(ConnectionHandler, x => x.ArticleId, x => x.ArticleId.In(list.Select(i => i.Id)));
                foreach (Article item in list)
                {
                    ModelView.UserArticleAbstract model = new ModelView.UserArticleAbstract();
                    item.HasRefereeOpinion     = @select.Any(x => x.Equals(item.Id));
                    item.HasRefereeAttachment  = item.HasRefereeOpinion;
                    item.AllowPrintCertificate = true;

                    List <ArticleAuthors> authorbo = articleAuthorses.Where(c => c.ArticleId == item.Id).OrderBy(c => c.Order).ToList();
                    string auters = "";
                    if (string.IsNullOrEmpty(item.Title))
                    {
                        foreach (ArticleAuthors author in authorbo)
                        {
                            auters += "," + author.Name + ":" + (author.IsDirector == false ? "" : "Director" + ":") + author.Address;
                        }
                        if (!string.IsNullOrEmpty(auters))
                        {
                            model.Authors = auters.Substring(1);
                        }
                    }
                    if (string.IsNullOrEmpty(auters))
                    {
                        foreach (ArticleAuthors author in authorbo)
                        {
                            auters += "," + author.Name + ":" + (author.IsDirector == false ? "" : "مسوول" + ":") + author.Address;
                        }
                        if (!string.IsNullOrEmpty(auters))
                        {
                            model.Authors = auters.Substring(1);
                        }
                    }
                    if (configcontent != null && configcontent.LogoId.HasValue && configcontent.Logo != null)
                    {
                        model.CongressLogo = configcontent.Logo.Content;
                    }

                    model.Id = item.Id.ToString();
                    model.OrginalTextFile = item.ArticleOrginalText == null ? "" : item.ArticleOrginalText.RemoveHtml();
                    model.Abstract        = item.Abstract == null ? "" : item.Abstract.RemoveHtml();
                    model.CongressTitle   = homa.CongressTitle;
                    model.Description     = item.Description;
                    model.Title           = item.Title;
                    model.Keyword         = item.Keyword;
                    if (item.Pivot != null)
                    {
                        model.Pivot = item.Pivot.Title;
                    }

                    outlist.Add(model);
                }
                return(outlist);
            }
            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);
            }
        }
Esempio n. 20
0
 //[Route("Article/{id}")]
 public ActionResult Article(string id)
 {
     DataStructure.Article article = new ArticleBO().Get(id);
     return(View(article));
 }
Esempio n. 21
0
 public Guid UpdateStatusAfterTransactionGroupTemp(Guid userId, Guid id)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.ReservationConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         var tempTransactionalFacade = PaymentComponenets.Instance.TempTransactionalFacade(this.PaymentConnection);
         var tr = tempTransactionalFacade.RemoveTempAndReturnTransaction(id);
         if (tr == null)
         {
             return(Guid.Empty);
         }
         var byFilter = tempTransactionalFacade.Where(x => x.ParentId == id);
         if (byFilter.Any())
         {
             var userBo         = new UserBO();
             var userBoothBo    = new UserBoothBO();
             var articleBo      = new ArticleBO();
             var hotelUserBo    = new HotelUserBO();
             var workShopUserBo = new WorkShopUserBO();
             foreach (var temp in byFilter)
             {
                 workShopUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                             userId, temp.Id);
                 hotelUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, userId,
                                                          temp.Id);
                 articleBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                        this.FileManagerConnection, temp.Id, new ModelView.InFormEntitiyList <RefereeCartable>());
                 userBoothBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, temp.Id);
                 userBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                     this.ReservationConnection, userId, temp.Id);
                 tempTransactionalFacade.RemoveTempAndReturnTransaction(temp.Id);
             }
         }
         this.ConnectionHandler.CommitTransaction();
         this.PaymentConnection.CommitTransaction();
         this.FileManagerConnection.CommitTransaction();
         this.ReservationConnection.CommitTransaction();
         return(tr.Id);
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.RollBack();
         this.FileManagerConnection.RollBack();
         this.ReservationConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.RollBack();
         this.FileManagerConnection.RollBack();
         this.ReservationConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }