public List <ModelView.SerachResultvalue> SearchInHoma(Guid congressId, Enums.SearchType SerachType, string txtvalue) { var resultvalues = new List <ModelView.SerachResultvalue>(); if (string.IsNullOrEmpty(txtvalue)) { return(resultvalues); } var homaBo = new HomaBO(); switch (SerachType) { case Enums.SearchType.All: homaBo.NewsSearch(ConnectionHandler, congressId, txtvalue, resultvalues); homaBo.ContenetSearch(ConnectionHandler, congressId, txtvalue, resultvalues); return(resultvalues); break; case Enums.SearchType.Content: homaBo.ContenetSearch(ConnectionHandler, congressId, txtvalue, resultvalues); return(resultvalues); case Enums.SearchType.News: homaBo.NewsSearch(ConnectionHandler, congressId, txtvalue, resultvalues); return(resultvalues); } return(resultvalues); }
public IEnumerable <ModelView.UserCardModel> SearchChipFoodReport(Guid congressId, Guid chipfoodId, string txtSearch, User user, EnterpriseNode.Tools.Enums.Gender gender, FormStructure postFormData) { try { var list = new ChipsFoodBO().SearchChipFood(this.ConnectionHandler, congressId, chipfoodId, txtSearch, user, gender, postFormData); var enumerable = list.Where(x => x.Value).Select(x => x.Key); var userCardModels = new List <ModelView.UserCardModel>(); var homa = new HomaBO().Get(this.ConnectionHandler, congressId); var config = homa.Configuration; var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, congressId, config.CardLanguageId); var chipsFoodUserBo = new ChipsFoodBO(); var chipsFood = chipsFoodUserBo.Get(this.ConnectionHandler, chipfoodId); foreach (var keyValuePair in enumerable) { userCardModels.AddRange(new UserBO().GetChipFootUser(this.ConnectionHandler, keyValuePair, configcontent, homa, new List <ChipsFood> { chipsFood })); } return(userCardModels); } 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 Dictionary <int, decimal> GetDaysInfo(Guid congressId, string culture, Guid?registerPaymentTypeId) { try { var homa = new HomaBO().Get(this.ConnectionHandler, congressId); if (homa == null || homa.HoldingDays == null || homa.HoldingDays.ToString().ToInt() == 0) { return(null); } var dictionary = new Dictionary <int, decimal>(); var oldictionary = new Dictionary <int, decimal>(); var type = new UserRegisterPaymentType(); if (registerPaymentTypeId.HasValue) { var registerPaymentType = new UserRegisterPaymentTypeBO().GetLanuageContent(this.ConnectionHandler, culture, registerPaymentTypeId); if (registerPaymentType != null) { type = registerPaymentType; } } if (!string.IsNullOrEmpty(type.DaysInfo)) { var split = type.DaysInfo.Split('-'); foreach (var value in split) { if (string.IsNullOrEmpty(value)) { continue; } var strings = value.Split(','); oldictionary.Add(strings[0].ToInt(), strings[1].ToDecimal()); } } for (var i = 1; i <= homa.HoldingDays; i++) { dictionary.Add(i, oldictionary.ContainsKey(i)? oldictionary[i].ToString().ToDecimal(): 0); } return(dictionary); } 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 Dictionary <int, bool> GetDaysInfo(Guid congressId, Guid?chipfoodId) { try { var dictionary = new Dictionary <int, bool>(); if (chipfoodId.HasValue) { var chipsFood = new ChipsFoodBO().Get(this.ConnectionHandler, chipfoodId); if (chipsFood != null) { if (!string.IsNullOrEmpty(chipsFood.DaysInfo)) { var split = chipsFood.DaysInfo.Split('-'); foreach (var value in split) { if (string.IsNullOrEmpty(value)) { continue; } dictionary.Add(value.ToInt(), true); } } } } var homa = new HomaBO().Get(this.ConnectionHandler, congressId); if (homa == null || homa.HoldingDays == null || homa.HoldingDays.ToString().ToInt() == 0) { return(null); } for (var i = 1; i <= homa.HoldingDays; i++) { if (!dictionary.ContainsKey(i)) { dictionary.Add(i, false); } } return(dictionary); } 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 ModelView.UserCardModel GetBoothOfficerCard(Guid Id, Guid boothId, Guid userId) { try { var userBo = new UserBO(); var boothOfficerBo = new BoothOfficerBO(); var user = userBo.Get(this.ConnectionHandler, userId); var homa = new HomaBO().Get(this.ConnectionHandler, user.CongressId); var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId, homa.Configuration.CardLanguageId); var list = new ModelView.UserCardModel(); var userBooth = new UserBoothBO().Get(this.ConnectionHandler, userId, boothId); if (userBooth.Status == (byte)Enums.RezervState.PayConfirm || userBooth.Status == (byte)Enums.RezervState.Finalconfirm) { var boothOfficers = boothOfficerBo.Get(this.ConnectionHandler, Id, boothId, userId); if (boothOfficers == null) { return(list); } list = boothOfficerBo.GetCardList(this.ConnectionHandler, user, configcontent, homa, new List <BoothOfficer>() { boothOfficers }).FirstOrDefault(); } 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.UserCardModel> GetCardList(Guid boothId, Guid userId) { try { var userBo = new UserBO(); var boothOfficerBo = new BoothOfficerBO(); var user = userBo.Get(this.ConnectionHandler, userId); var homa = new HomaBO().Get(this.ConnectionHandler, user.CongressId); var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId, homa.Configuration.CardLanguageId); var list = new List <ModelView.UserCardModel>(); var userBooth = new UserBoothBO().Get(this.ConnectionHandler, userId, boothId); if (userBooth.Status == (byte)Enums.RezervState.PayConfirm || userBooth.Status == (byte)Enums.RezervState.Finalconfirm) { var boothOfficers = boothOfficerBo.Where(this.ConnectionHandler, x => x.BoothId == boothId && x.UserId == userId ); list = boothOfficerBo.GetCardList(this.ConnectionHandler, user, configcontent, homa, boothOfficers); } 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 ModelView.UserCardModel SearchChipFoodReport(Guid chipfoodId, Guid userId) { try { var userCardModels = new ModelView.UserCardModel(); var userBo = new UserBO(); var user = userBo.Get(this.ConnectionHandler, userId); var config = new ConfigurationBO().Get(this.ConnectionHandler, user.CongressId); var configcontent = new ConfigurationContentBO().Get(this.ConnectionHandler, user.CongressId, config.CardLanguageId); var homa = new HomaBO().Get(this.ConnectionHandler, user.CongressId); var chipsFoodUserBo = new ChipsFoodUserBO(); var chipsFoodUsers = chipsFoodUserBo.Get(this.ConnectionHandler, chipfoodId, user.Id); var chipsFoodBo = new ChipsFoodBO(); if (chipsFoodUsers != null) { var chipsFood = chipsFoodBo.Get(this.ConnectionHandler, chipsFoodUsers.ChipsFoodId); var cardModels = userBo.GetChipFootUser(this.ConnectionHandler, user, configcontent, homa, new List <ChipsFood> { chipsFood }); if (cardModels.Count > 0) { userCardModels = cardModels.FirstOrDefault(); } } return(userCardModels); } 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); } }
public bool ConfigByDefaulToHoma(Guid homaId) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); var defaulthoma = new HomaBO().FirstOrDefault(ConnectionHandler, x => x.IsDefaultForConfig); var configurationTranscationFacade = new ConfigurationBO(); var configurationContentTranscationFacade = new ConfigurationContentBO(); var fileTransactionalFacade = FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection); if (defaulthoma != null) { var homa = new HomaBO().FirstOrDefault(ConnectionHandler, x => x.Id == homaId); if (defaulthoma.Id == homa.Id) { return(true); } if (homa.Configuration == null || homa.Configuration.CongressId == Guid.Empty) { var configuration1 = new ConfigurationBO().Get(ConnectionHandler, defaulthoma.Id); if (configuration1 != null) { configuration1.CongressId = homa.Id; var configurationContents = new ConfigurationContentBO().Where(ConnectionHandler, x => x.ConfigurationId == defaulthoma.Id); configurationTranscationFacade.Insert(ConnectionHandler, configuration1); foreach (var configurationContent in configurationContents) { configurationContent.ConfigurationId = homa.Id; if (configurationContent != null) { if (configurationContent.AttachRefereeFile != null) { var AttachRefereeFile = Guid.NewGuid(); configurationContent.AttachRefereeFile.Id = AttachRefereeFile; configurationContent.AttachRefereeFileId = AttachRefereeFile; fileTransactionalFacade.Insert(configurationContent.AttachRefereeFile); } if (configurationContent.BoothMapAttachment != null) { var BoothMapAttachment = Guid.NewGuid(); configurationContent.BoothMapAttachment.Id = BoothMapAttachment; configurationContent.BoothMapAttachmentId = BoothMapAttachment; fileTransactionalFacade.Insert(configurationContent.BoothMapAttachment); } if (configurationContent.OrginalPoster != null) { var OrginalPoster = Guid.NewGuid(); configurationContent.OrginalPoster.Id = OrginalPoster; configurationContent.OrginalPosterId = OrginalPoster; fileTransactionalFacade.Insert(configurationContent.OrginalPoster); } if (configurationContent.MiniPoster != null) { var MiniPoster = Guid.NewGuid(); configurationContent.MiniPoster.Id = MiniPoster; configurationContent.MiniPosterId = MiniPoster; fileTransactionalFacade.Insert(configurationContent.MiniPoster); } if (configurationContent.Logo != null) { var logoId = Guid.NewGuid(); configurationContent.Logo.Id = logoId; configurationContent.LogoId = logoId; fileTransactionalFacade.Insert(configurationContent.Logo); } if (configurationContent.Header != null) { var headerId = Guid.NewGuid(); configurationContent.HeaderId = headerId; configurationContent.Header.Id = headerId; fileTransactionalFacade.Insert(configurationContent.Header); } if (configurationContent.Footer != null) { var logoId = Guid.NewGuid(); configurationContent.FooterId = logoId; configurationContent.Footer.Id = logoId; fileTransactionalFacade.Insert(configurationContent.Footer); } if (configurationContent.HallMap != null) { var HallMap = Guid.NewGuid(); configurationContent.HallMapId = HallMap; configurationContent.HallMap.Id = HallMap; fileTransactionalFacade.Insert(configurationContent.HallMap); } } configurationContentTranscationFacade.Insert(ConnectionHandler, configurationContent); } } } var congressLanguageBo = new CongressLanguageBO(); var congressLanguages = congressLanguageBo.Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressLanguages != null) { var congressMenuTranscationFacade = congressLanguageBo; foreach (var congressLanguage in congressLanguages) { congressLanguage.CongressId = homa.Id; congressMenuTranscationFacade.Insert(ConnectionHandler, congressLanguage); } } var congressContentBo = new CongressContentBO(); var congressContents = congressContentBo.Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressContents != null) { var contentContentFacade = ContentManagerComponent.Instance.ContentTransactionalFacade(ConnectionHandler); var contentFacade = ContentManagerComponent.Instance.ContentContentTransactionalFacade(ConnectionHandler); foreach (var congressContent in congressContents) { var oldid = congressContent.ContentId; var contents = contentFacade.Where(x => x.Id == oldid); contentContentFacade.Insert(congressContent.Content); foreach (var contentContent in contents) { contentContent.Id = congressContent.Content.Id; contentFacade.Insert(contentContent); } congressContent.CongressId = homa.Id; congressContent.ContentId = congressContent.Content.Id; congressContentBo.Insert(ConnectionHandler, congressContent); } } var congressContainers = new CongressContainerBO().Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressContainers != null) { var congressMenuTranscationFacade = new CongressContainerFacade(ConnectionHandler); foreach (var congressMenu in congressContainers) { var newGuid = Guid.NewGuid(); congressMenu.Container.Id = newGuid; congressMenu.ContainerId = newGuid; congressMenu.CongressId = homa.Id; congressMenuTranscationFacade.Insert(homa.Id, congressMenu.Container); } } var congressMenus = new CongressMenuHtmlBO().Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressMenus != null) { var congressMenuTranscationFacade = new CongressMenuHtmlFacade(ConnectionHandler); foreach (var congressMenu in congressMenus) { var newGuid = Guid.NewGuid(); congressMenu.MenuHtml.Id = newGuid; congressMenu.MenuHtmlId = newGuid; congressMenu.CongressId = homa.Id; congressMenuTranscationFacade.Insert(homa.Id, congressMenu.MenuHtml); } } var @where = new CongressHtmlBO().Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (@where != null) { var congressMenuTranscationFacade = new CongressHtmlFacade(ConnectionHandler); foreach (var congressMenu in @where) { var oldId = congressMenu.HtmlDesginId; var newGuid = Guid.NewGuid(); congressMenu.HtmlDesgin.Id = newGuid; congressMenu.HtmlDesginId = newGuid; congressMenu.CongressId = homa.Id; congressMenuTranscationFacade.Insert(homa.Id, congressMenu.HtmlDesgin); var partialLoadTransactionalFacade = ContentManagerComponent.Instance.PartialLoadTransactionalFacade(ConnectionHandler); var list = partialLoadTransactionalFacade.Where(x => x.HtmlDesginId == oldId); foreach (var partialLoad in list) { partialLoad.HtmlDesginId = newGuid; partialLoadTransactionalFacade.Insert(partialLoad); } } } var congressId = new CongressMenuBO().Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressId != null) { var congressMenuTranscationFacade = new CongressMenuFacade(ConnectionHandler); foreach (var congressMenu in congressId) { var newGuid = Guid.NewGuid(); congressMenu.Menu.Id = newGuid; congressMenu.MenuId = newGuid; congressMenu.CongressId = homa.Id; congressMenuTranscationFacade.Insert(homa.Id, congressMenu.Menu, null); } } var formAssigmentTransactionalFacade = FormGeneratorComponent.Instance.FormAssigmentTransactionalFacade(ConnectionHandler); var congressFormses = new CongressFormsBO().Where(ConnectionHandler, x => x.CongressId == defaulthoma.Id); if (congressFormses != null) { var congressFormsFacade = new CongressFormsFacade(ConnectionHandler); foreach (var congressForms in congressFormses) { var oldId = congressForms.FomId; var formAssigments = formAssigmentTransactionalFacade.Where(x => x.FormStructureId == oldId); var newGuid = Guid.NewGuid(); var newGuidStructureFileId = Guid.NewGuid(); congressForms.FormStructure.Id = newGuid; congressForms.FomId = newGuid; congressForms.CongressId = homa.Id; if (!string.IsNullOrEmpty(congressForms.FormStructure.StructureFileId)) { var file = fileTransactionalFacade.Get(congressForms.FormStructure.StructureFileId); if (file != null) { file.Id = newGuidStructureFileId; fileTransactionalFacade.Insert(file); congressForms.FormStructure.StructureFileId = newGuidStructureFileId.ToString(); } } congressFormsFacade.Insert(homa.Id, congressForms.FormStructure); foreach (var formAssigment in formAssigments) { formAssigment.FormStructureId = newGuid; formAssigmentTransactionalFacade.Insert(formAssigment); } } } } this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); throw new KnownException(ex.Message, ex); } return(true); }