Beispiel #1
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);
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
            }
        }
Beispiel #4
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);
            }
        }