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); } }
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); } }