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 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 Update(Configuration configuration, ConfigurationContent configurationContent, HttpPostedFileBase refreeAttachment, HttpPostedFileBase boothMapAttachmentId, HttpPostedFileBase orginalPoster, HttpPostedFileBase miniPoster, HttpPostedFileBase logo, HttpPostedFileBase header, HttpPostedFileBase footer, HttpPostedFileBase hallMapId, HttpPostedFileBase backgroundImageId, HttpPostedFileBase favIcon, string modelName, List <DiscountTypeSection> sectiontypes) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); this.ContentManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted); var fileTransactionalFacade = FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection); var configurationBo = new ConfigurationBO(); var oldconfig = configurationBo.Get(this.ConnectionHandler, configuration.CongressId); configuration.TerminalPassword = !String.IsNullOrEmpty(configuration.TerminalPassword) ? StringUtils.Encrypt(configuration.TerminalPassword) : oldconfig.TerminalPassword; configuration.SMSAccountPassword = !String.IsNullOrEmpty(configuration.SMSAccountPassword) ? StringUtils.Encrypt(configuration.SMSAccountPassword) : oldconfig.SMSAccountPassword; configuration.MailPassword = !String.IsNullOrEmpty(configuration.MailPassword) ? StringUtils.Encrypt(configuration.MailPassword) : oldconfig.MailPassword; configuration.CertificatePassword = !String.IsNullOrEmpty(configuration.CertificatePassword) ? StringUtils.Encrypt(configuration.CertificatePassword) : oldconfig.CertificatePassword; //--------------------- configuration.MerchantPublicKey = !String.IsNullOrEmpty(configuration.MerchantPublicKey) ? StringUtils.Encrypt(configuration.MerchantPublicKey) : oldconfig.MerchantPublicKey; configuration.MerchantPrivateKey = !String.IsNullOrEmpty(configuration.MerchantPrivateKey) ? StringUtils.Encrypt(configuration.MerchantPrivateKey) : oldconfig.MerchantPrivateKey; //------------------------ if ( !PaymentComponenets.Instance.DiscountTypeSectionTransactionalFacade(this.ContentManagerConnection) .Update(modelName, sectiontypes)) { throw new Exception(Resources.Congress.ErrorInEditConfuguration); } if (favIcon != null) { if (configuration.FavIcon == null) { configuration.FavIcon = fileTransactionalFacade.Insert(favIcon); } else { if (!fileTransactionalFacade.Update(favIcon, (Guid)configuration.FavIcon)) { throw new Exception("خطا در ذخیره fav icon وجود دارد"); } } } if (backgroundImageId != null) { if (configuration.BackgroundImage == null) { configuration.BackgroundImage = fileTransactionalFacade.Insert(backgroundImageId); } else { if (!fileTransactionalFacade.Update(backgroundImageId, (Guid)configuration.BackgroundImage)) { throw new Exception("خطایی در ذخیره عکس پشت زمینه وجود دارد"); } } configuration.BackgroundColor = null; } if (!string.IsNullOrEmpty(configuration.BackgroundColor)) { configuration.BackgroundImage = null; } if (!configurationBo.Update(this.ConnectionHandler, configuration)) { throw new Exception(Resources.Congress.ErrorInEditConfuguration); } if (configurationContent != null) { if (refreeAttachment != null) { if (configurationContent.AttachRefereeFileId == null) { configurationContent.AttachRefereeFileId = fileTransactionalFacade.Insert(refreeAttachment); } else { if ( !fileTransactionalFacade.Update(refreeAttachment, (Guid)configurationContent.AttachRefereeFileId)) { throw new Exception(string.Format(Resources.Congress.ErrorInEditArticleOrginalFile, configuration.ArticleTitle)); } } } if (boothMapAttachmentId != null) { if (configurationContent.BoothMapAttachmentId == null) { configurationContent.BoothMapAttachmentId = fileTransactionalFacade.Insert(boothMapAttachmentId); } else { if ( !fileTransactionalFacade.Update(boothMapAttachmentId, (Guid)configurationContent.BoothMapAttachmentId)) { throw new Exception(Resources.Congress.ErrorInEditBoothMapFile); } } } if (orginalPoster != null) { if (configurationContent.OrginalPosterId == null) { configurationContent.OrginalPosterId = fileTransactionalFacade.Insert(orginalPoster); } else { if ( !fileTransactionalFacade.Update(orginalPoster, (Guid)configurationContent.OrginalPosterId)) { throw new Exception(string.Format(Resources.Congress.ErrorInEditArticleOrginalFile, configuration.ArticleTitle)); } } } if (miniPoster != null) { if (configurationContent.MiniPosterId == null) { configurationContent.MiniPosterId = fileTransactionalFacade.Insert(miniPoster); } else { if (!fileTransactionalFacade.Update(miniPoster, (Guid)configurationContent.MiniPosterId)) { throw new Exception(Resources.Congress.ErrorInEditMiniPosterFile); } } } if (logo != null) { if (configurationContent.LogoId == null) { configurationContent.LogoId = fileTransactionalFacade.Insert(logo); } else { if (!fileTransactionalFacade.Update(logo, (Guid)configurationContent.LogoId)) { throw new Exception(Resources.Congress.ErrorInEditLogoFile); } } } if (header != null) { if (configurationContent.HeaderId == null) { configurationContent.HeaderId = fileTransactionalFacade.Insert(header); } else { if (!fileTransactionalFacade.Update(header, (Guid)configurationContent.HeaderId)) { throw new Exception(Resources.Congress.ErrorInEditHeaderFile); } } } if (footer != null) { if (configurationContent.FooterId == null) { configurationContent.FooterId = fileTransactionalFacade.Insert(footer); } else { if (!fileTransactionalFacade.Update(footer, (Guid)configurationContent.FooterId)) { throw new Exception(Resources.Congress.ErrorInEditFooterFile); } } } if (hallMapId != null) { if (configurationContent.HallMapId == null) { configurationContent.HallMapId = fileTransactionalFacade.Insert(hallMapId); } else { if (!fileTransactionalFacade.Update(footer, (Guid)configurationContent.HallMapId)) { throw new Exception(Resources.Congress.ErrorInEditHallmapFile); } } } if (configurationContent.ConfigurationId == Guid.Empty) { configurationContent.ConfigurationId = configuration.CongressId; if (!new ConfigurationContentBO().Insert(this.ConnectionHandler, configurationContent)) { throw new Exception(Resources.Congress.ErrorInSaveConfiguartion); } } else { var oldobj = new ConfigurationContentBO().Get(this.ConnectionHandler, configurationContent.ConfigurationId, configurationContent.LanguageId); if (oldobj != null) { if (oldobj.HeaderId.HasValue && configurationContent.HeaderId == null) { fileTransactionalFacade.Delete(oldobj.HeaderId); } if (oldobj.FooterId.HasValue && configurationContent.FooterId == null) { fileTransactionalFacade.Delete(oldobj.FooterId); } if (oldobj.LogoId.HasValue && configurationContent.LogoId == null) { fileTransactionalFacade.Delete(oldobj.LogoId); } if (oldobj.OrginalPosterId.HasValue && configurationContent.OrginalPosterId == null) { fileTransactionalFacade.Delete(oldobj.OrginalPosterId); } if (oldobj.MiniPosterId.HasValue && configurationContent.MiniPosterId == null) { fileTransactionalFacade.Delete(oldobj.MiniPosterId); } if (oldobj.AttachRefereeFileId.HasValue && configurationContent.AttachRefereeFileId == null) { fileTransactionalFacade.Delete(oldobj.AttachRefereeFileId); } if (oldobj.BoothMapAttachmentId.HasValue && configurationContent.BoothMapAttachmentId == null) { fileTransactionalFacade.Delete(oldobj.BoothMapAttachmentId); } } if (!new ConfigurationContentBO().Update(this.ConnectionHandler, configurationContent)) { throw new Exception(Resources.Congress.ErrorInEditConfuguration); } } } this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); this.ContentManagerConnection.CommitTransaction(); this.PaymentConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); this.ContentManagerConnection.RollBack(); this.PaymentConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); this.ContentManagerConnection.RollBack(); this.PaymentConnection.RollBack(); 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); }