private ContentRepository CreateRepository(IDatabaseUnitOfWork unitOfWork, out ContentTypeRepository contentTypeRepository) { var templateRepository = new TemplateRepository(unitOfWork, NullCacheProvider.Current); contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository); var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository); return repository; }
public static ContentEntityService Create() { IDatabaseFactory databaseFactory = new DatabaseFactory(); IUnitOfWork unitOfWork = new UnitOfWork(databaseFactory); IContentRepository contentRepository = new ContentRepository(databaseFactory); return new ContentEntityService(contentRepository, unitOfWork); }
public Tuple<IEnumerable<FolderNode>, IEnumerable<Content>> Folder(int? id) { ContentRepository contentRepos = new ContentRepository(unitOfWork); FolderNodeRepository folderRepos = new FolderNodeRepository(unitOfWork); return new Tuple<IEnumerable<FolderNode>, IEnumerable<Content>>(folderRepos.FindByFolder(id), contentRepos.FindByFolder(id)); }
public override void Initialize(ContentRepository.Content context, string backUri, Application application, object parameters) { base.Initialize(context, backUri, application, parameters); //if (string.Compare(PortalContext.Current.AuthenticationMode, "windows", StringComparison.CurrentCultureIgnoreCase) != 0) // this.Forbidden = true; }
public ActionResult Legal() { ContentRepository repo = new ContentRepository(); Content legalContent = (from hc in repo.Content where hc.ContentID == "Legal" select hc).FirstOrDefault<Content>(); return View(legalContent); }
public ActionResult Info() { ContentRepository repo = new ContentRepository(); Content infoContent = (from hc in repo.Content where hc.ContentID == "Information" select hc).FirstOrDefault<Content>(); return View(infoContent); }
//public ActionResult Index() //{ // return View(); //} //public ActionResult About() //{ // ViewBag.Message = "Your application description page."; // return View(); //} //public ActionResult Contact() //{ // ViewBag.Message = "Your contact page."; // return View(); //} public ActionResult Index() { ContentRepository repo = new ContentRepository(); Content homeContent = (from hc in repo.Content where hc.ContentID == "Home" select hc).FirstOrDefault<Content>(); return View(homeContent); }
public ActionResult About() { ContentRepository repo = new ContentRepository(); Content aboutContent = (from hc in repo.Content where hc.ContentID == "About" select hc).FirstOrDefault<Content>(); return View(aboutContent); }
public override void Initialize(ContentRepository.Content context, string backUri, Application application, object parameters) { base.Initialize(context, backUri, application, parameters); if (!context.IsContentListItem) this.Visible = false; }
public override IEnumerable<IndexFieldInfo> GetIndexFieldInfos(ContentRepository.Field snField, out string textExtract) { var data = snField.GetData() as string ?? string.Empty; var titles = data.Split(new[] {WikiTools.REFERENCEDTITLESFIELDSEPARATOR}, 100000, StringSplitOptions.RemoveEmptyEntries); textExtract = string.Empty; return CreateFieldInfo(snField.Name, titles); }
public override void Initialize(ContentRepository.Content context, string backUri, Application application, object parameters) { base.Initialize(context, backUri, application, parameters); //if (string.Compare(PortalContext.Current.AuthenticationMode, "windows", StringComparison.CurrentCultureIgnoreCase) != 0) // this.Forbidden = true; if (!Repository.WebdavEditExtensions.Any(extension => context.Name.EndsWith(extension))) this.Visible = false; }
public ContentController() { this._contentRepository = new ContentRepository(); this._contentTypeRepository = new ContentTypeRepository(); this._contentMapper = new ContentMapper(); this._contentTypeMapper = new ContentTypeMapper(); ViewData["ContentTypes"] = _contentTypeMapper.ToList(_contentTypeRepository.GetList()); }
public GameBase() { GameController.CurrentGame = this; IsMouseVisible = true; Graphics = new GraphicsDeviceManager(this); Content = new ContentRepository(Services); Content.RootDirectory = "Content"; ResetGameTime(); Camera = new CameraController { Graphics = Graphics, LookAt = Vector3.Zero, Position = new Vector3(0, 0, 15), FieldOfViewDegrees = 45f, FarPlaneDistance=10000, NearPlaneDistance=1 }; Window.AllowUserResizing = true; Window.ClientSizeChanged += new EventHandler<EventArgs>(OnWindowClientSizeChanged); Mouse = new MouseController { WindowRect = Window.ClientBounds, IsCenterMouse = false, InvertX = true, InvertY = true }; Mouse.OnRightButtonDown += new MouseController.MouseEventHandler(OnMouseRightButtonDown); Mouse.OnRightButtonUp += new MouseController.MouseEventHandler(OnMouseRightButtonUp); Keyboard = new KeyboardController(); Keyboard.OnKeyPress += new KeyboardController.KeyPressDelegate(OnGameBaseKeyPress); //visibleModelCleanerThread.Worker = CleanVisibleModelsList; }
public ResponseContentFindByCategory ContentFindByCategory(RequestContentFindByCategory reqparam) { var resp = new ResponseContentFindByCategory(); try { using (var dbc = new AppDbContext()) { var repoContent = new ContentRepository(dbc); resp.Datas = new List <SVP.CIL.Domain.Content>(); foreach (var c in repoContent.FindByCategory(new Category { Id = reqparam.Category.Id })) { var domainContent = Mapper.Map <SVP.CIL.Domain.Content>(c); resp.Datas.Add(domainContent); } resp.Success = true; } } catch (DbEntityValidationException dbEx) { foreach (DbEntityValidationResult entityErr in dbEx.EntityValidationErrors) { foreach (DbValidationError error in entityErr.ValidationErrors) { Console.WriteLine("Error Property Name {0} : Error Message: {1}", error.PropertyName, error.ErrorMessage); resp.Success = false; } } } return(resp); }
public override MultistepActionSettings Setup(int siteId, int contentId, bool?boundToExternal) { if (ContentRepository.IsAnyAggregatedFields(contentId)) { throw new ActionNotAllowedException(ContentStrings.OperationIsNotAllowedForAggregated); } if (ContentRepository.GetAggregatedContents(contentId).Any()) { throw new ActionNotAllowedException(ContentStrings.OperationIsNotAllowedForRoot); } var content = ContentRepository.GetById(contentId); if (content == null) { throw new Exception(string.Format(ContentStrings.ContentNotFound, contentId)); } if (!content.IsContentChangingActionsAllowed) { throw new ActionNotAllowedException(ContentStrings.ContentChangingIsProhibited); } var row = ClearContentRepository.GetContentItemsInfo(contentId); var contentName = string.Empty; var itemCount = 0; if (row != null) { itemCount = row.Field <int>("ITEMS_COUNT"); contentName = row.Field <string>("CONTENT_NAME"); } _command = new ClearContentCommand(siteId, contentId, contentName, itemCount); return(base.Setup(siteId, contentId, boundToExternal)); }
public Footer Add(Guid documentId, Footer footer) { if (DocumentRepository.Exists(documentId)) { if (!FooterRepository.ExistsForDocument(documentId)) { Document documentThatBelongs = DocumentRepository.GetById(documentId); documentThatBelongs.StyleClass = null; footer.DocumentThatBelongs = documentThatBelongs; footer.Id = Guid.NewGuid(); footer.Content = new Content() { Id = Guid.NewGuid() }; if (footer.StyleClass != null && !StyleClassRepository.Exists(footer.StyleClass.Name)) { footer.StyleClass = null; } ContentRepository.Add(footer.Content); FooterRepository.Add(footer); return(footer); } else { throw new ExistingFooterException("This document already has a footer."); } } else { throw new MissingDocumentException("This document is not in the database."); } }
public static Guid GetDefaultBusinessUnitId(ContentRepository repository) { QueryExpression query = new QueryExpression("businessunit") { Criteria = { Conditions = { new ConditionExpression("parentbusinessunitid", ConditionOperator.Null) } } }; var entities = repository.Get(query, 1); if (entities == null || entities.Count() != 1) { throw new Exception("Unable to determine default business unit."); } else { return(entities.First().Id); } }
public MultistepActionStepResult Step(int step) { var content = ContentRepository.GetById(ContentId); if (content == null) { throw new Exception(string.Format(ContentStrings.ContentNotFound, ContentId)); } if (!content.IsContentChangingActionsAllowed) { throw new ActionNotAllowedException(ContentStrings.ContentChangingIsProhibited); } ClearContentRepository.RemoveContentItems(ContentId, ItemsPerStep); if (IsLastStep(step)) { ClearContentRepository.ClearO2MRelations(ContentId); } return(new MultistepActionStepResult { ProcessedItemsCount = ItemsPerStep }); }
public IHttpActionResult ContentWithTypes(string type, string search, string sort, int pageNumber) { try { ContentRepository contentRepo = new ContentRepository(); ContentTypeRepository typeRepo = new ContentTypeRepository(); ContentWithTypesCollectionViewModel model = new ContentWithTypesCollectionViewModel(); List<ContentViewModel> lstContents = contentRepo.GetList(type, search, sort, pageNumber); string[] contact_us = { Constants.CONTACT_US }; List<ContentTypeViewModel> lstTypes = typeRepo.GetList(contact_us); model.types = lstTypes; model.contents = lstContents; return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
public StoreHomePage GetHomePage() { int page = 1; StoreHomePage resultModel = new StoreHomePage(); resultModel.SStore = MyStore; resultModel.SCarouselImages = FileManagerRepository.GetStoreCarousels(MyStore.Id); resultModel.SProductCategories = ProductCategoryRepository.GetProductCategoriesByStoreId(MyStore.Id); var products = ProductRepository.GetProductsCategoryId(MyStore.Id, null, StoreConstants.ProductType, true, page, 24); resultModel.SProducts = new PagedList <Product>(products.items, products.page - 1, products.pageSize, products.totalItemCount); var contents = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.NewsType, true, page, 24); resultModel.SNews = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount); contents = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.BlogsType, true, page, 24); resultModel.SBlogs = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount); resultModel.SBlogsCategories = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.BlogsType, true); resultModel.SNewsCategories = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.NewsType, true); resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id); resultModel.SSettings = this.GetStoreSettings(); return(resultModel); }
/// <summary> /// 获取栏目下的内容 /// </summary> /// <param name="channelId"></param> /// <param name="recursive"></param> /// <returns></returns> public async Task <List <Content> > FindContentsByChannelIdAsync(long?channelId, bool recursive = false) { if (recursive) { if (!channelId.HasValue) { channelId = (await ChannelManager.FindDefaultAsync()).Id; } //获取栏目子集 var channels = await ChannelManager.FindChildrenAsync(channelId.Value, recursive); //添加自己 channels.Insert(0, await ChannelManager.ChannelRepository.GetAsync(channelId.Value)); if (channels != null) { var query = from c in ContentRepository.GetAll() join ch in channels on c.ChannelId equals ch.Id where ch.Id == channelId.Value select c; return(await Task.FromResult(query.ToList <Content>())); } return(await Task.FromResult(new List <Content>())); } else { //单独栏目下的内容 var query = from c in ContentRepository.GetAll() join ch in ChannelManager.ChannelRepository.GetAll() on c.ChannelId equals ch.Id where ch.Id == channelId.Value select c; return(await Task.FromResult(query.ToList <Content>())); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Content.RootDirectory = "Content"; ContentDatabase = new ContentDatabase(); ContentRepository = new ContentRepository(this); OpenFeasyo.Platform.Configuration.Configuration.ClearBindingPoints(); // // "Horizontal" - 0 // OpenFeasyo.Platform.Configuration.Configuration.RegisterBindingPoint(Definition.BindingPoints[0], Engine.HorizontalMovementHandle); // TODO: Add your initialization logic here _uiengine = new UIEngine(ContentRepository, GraphicsDevice); _uiengine.ActivitiesFinished += _engine_ActivitiesFinished; _uiengine.StartActivity(new SplashActivity(_uiengine)); IsMouseVisible = true; base.Initialize(); }
public bool DeleteLink(int id) { try { bool result = false; if (id > 0) { IContentRepository repos = new ContentRepository(); result = repos.DeleteLink(id); if (result) { Helpers.CacheHelper.RemoveObjectFromCache(Helpers.CacheHelperKeys.CK_ALL_LINKS); } } return(result); } catch (Exception e) { log.ErrorFormat("Service Error {0}", e.ToString()); throw; } }
public bool DeletePdfById(int id) { try { bool result = false; IContentRepository repos = new ContentRepository(); var pdf = repos.FetchPdfById(id); if (pdf.PdfId > 0) { //to do // delete the reference with all objects...update set null... //try delete first string svrPdfPath = ConfigurationHelper.PdfDirectory(); result = Helpers.DirectoryHelper.DeleteFile(svrPdfPath, pdf.PdfGuid) == "File Deleted"; if (!result) { log.WarnFormat("Pdf {0} could not be deleted from server as it was not found ", pdf.PdfGuid); } //if ok - delete in db result = repos.DeletePdf(id); //Helpers.CacheHelper.RemoveObjectFromCache(Helpers.CacheHelperKeys.CK_ALL_PAGES); } return(result); } catch (Exception) { throw; } }
public MultistepActionStepResult Step(int step) { var context = HttpContext.Session.GetValue <RebuildUserQueryCommandContext>(HttpContextSession.RebuildUserQueryCommandProcessingContext); var ids = context.ContentIdsToRebuild .Skip(step * ItemsPerStep) .Take(ItemsPerStep) .ToArray(); var helper = new VirtualContentHelper(); var contents = ContentRepository.GetList(ids).ToDictionary(n => n.Id); using (VirtualFieldRepository.LoadVirtualFieldsRelationsToMemory(ContentId)) { foreach (var content in ids.Select(n => contents[n]).Where(n => n.VirtualType == VirtualType.UserQuery)) { helper.UpdateUserQueryAsSubContent(content); } } return(new MultistepActionStepResult { ProcessedItemsCount = ItemsPerStep }); }
public override MultistepActionSettings Setup(int siteId, int contentId, bool?boundToExternal) { var content = ContentRepository.GetById(contentId); if (content == null) { throw new ApplicationException(string.Format(ContentStrings.ContentNotFound, contentId)); } if (!content.IsAccessible(ActionTypeCode.Remove)) { throw new ApplicationException(ArticleStrings.CannotRemoveBecauseOfSecurity); } var violationMessages = new List <string>(); content.ValidateForRemove(violationMessages); if (violationMessages.Count > 0) { throw new ApplicationException(string.Join(Environment.NewLine, violationMessages)); } var row = ClearContentRepository.GetContentItemsInfo(contentId); var contentName = string.Empty; var itemCount = 0; if (row != null) { itemCount = row.Field <int>("ITEMS_COUNT"); contentName = row.Field <string>("CONTENT_NAME"); } _clearCommand = new ClearContentCommand(siteId, contentId, contentName, itemCount); _removeCommand = new RemoveContentCommand(siteId, contentId, contentName); return(base.Setup(siteId, contentId, boundToExternal)); }
private void LoadAggregateArticles(IEnumerable <FieldValue> result, bool forArticle) { if (Id == CurrentVersionId) { AggregatedArticles = Article.AggregatedArticles.ToList(); } else { foreach (var item in result.Where(n => n.Field.IsClassifier)) { if (!string.IsNullOrEmpty(item.Value) && int.TryParse(item.Value, out var contentId)) { var id = Article.AggregatedArticles.Where(n => n.ContentId == contentId).Select(n => n.Id).SingleOrDefault(); var aggArticle = new Article(ContentRepository.GetById(contentId)) { Id = id }; aggArticle.FieldValues = Article.GetFieldValues(_versionRowData.Value, aggArticle.Content.Fields, aggArticle, Id, aggArticle.Content.Name); ProcessFieldValues(aggArticle.FieldValues, forArticle); AggregatedArticles.Add(aggArticle); } } } }
/// <summary> /// Проверка полей базовых контентов для UNION на соответствие /// </summary> public IEnumerable <RuleViolation> UnionFieldsMatchCheck(List <int> unionSourceContentIds) { var contents = ContentRepository.GetList(unionSourceContentIds.Distinct()).ToList(); var contentNames = new Dictionary <int, string>(contents.Count); foreach (var c in contents) { contentNames.Add(c.Id, c.Name); } var unionBaseContentFields = VirtualContentRepository.GetFieldsOfContents(unionSourceContentIds); // Группируем по имени поля var _ = unionBaseContentFields //.GroupBy(f => f.Name, new LambdaComparer<string>((s1, s2) => s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase))); .GroupBy(f => f.Name.ToLowerInvariant()); var result = new List <RuleViolation>(); // Проверяет поля на соответствие var __ = new LambdaEqualityComparer <Field>( (f1, f2) => { var violation = СheckUnionMatchedFields(contentNames[f1.ContentId], contentNames[f2.ContentId], f1, f2); if (violation != null) { result.Add(violation); } return(true); }, f => f.Name.ToLowerInvariant().GetHashCode() ); return(result); }
internal static IEnumerable <ListItem> GetBaseFieldsForM2O(int contentId, int fieldId) { var siteId = ContentRepository.GetById(contentId).SiteId; var result = new List <ListItem>(); using (var scope = new QPConnectionScope()) { foreach (DataRow row in Common.GetBaseFieldsForM2O(scope.DbConnection, contentId, fieldId).Rows) { var parts = new List <string>(); if (siteId != (int)(decimal)row["site_id"]) { parts.Add((string)row["site_name"]); } if (contentId != (int)(decimal)row["content_id"]) { parts.Add((string)row["content_name"]); } parts.Add((string)row["attribute_name"]); var currentFieldId = (int)(decimal)row["attribute_id"]; var resultPart = new ListItem { Text = string.Join(".", parts), Value = currentFieldId.ToString() }; if (currentFieldId == fieldId) { resultPart.Selected = true; } result.Add(resultPart); } } return(result); }
public ActionResult CheckPayment() { var data = IcbcodeUtility.ToDictionary(Request.Form); var signature = IcbcodeCMS.Areas.CMS.Utilities.SignatureHelper.GetSignature("CCF34CBC5A8A479A1DF6FF86AC6B2C43", data); if (signature == data["signature"]) { long orderId = Int64.Parse(data["order_id"]); using (ContentRepository content = new ContentRepository()) { content.Update("oplachen = true", $"content_id = {orderId}"); } var order = IcbcodeContent.Get(orderId); var productItems = new List <ProductItem>(); foreach (var item in order.Childs()) { productItems.Add(new ProductItem() { name = item.Name, price = (decimal)item.UserDefined.cena_rub, quantity = (int)item.UserDefined.kolichestvo, VATrate = 6 }); } EOFD eofd = new EOFD(); eofd.SendCheck(order.UserDefined.email, productItems); IcbcodeUtility.SendEmail(null, null, $"Поступил платеж по заказу №{orderId}", ""); } return(Content("")); }
public ActionResult Index(int mod) { ContentRepository content = new ContentRepository(SessionCustom); ModulRepository modul = new ModulRepository(SessionCustom); SectionRepository objsection = new SectionRepository(SessionCustom); PaginInfo paginInfo = new PaginInfo() { PageIndex = 1 }; content.Entity.ModulId = mod; modul.Entity.ModulId = content.Entity.ModulId = mod; content.Entity.LanguageId = modul.Entity.LanguageId = CurrentLanguage.LanguageId; modul.Load(); ////objsection.Entity.Active = true; objsection.Entity.LanguageId = CurrentLanguage.LanguageId; if (HttpContext.Session["CollClones"] != null) { ViewBag.CollClone = (List <int>)HttpContext.Session["CollClones"]; } return(this.View(new Models.Content() { UserPrincipal = CustomUser, Module = modul.Entity, CollSection = objsection.GetAll().Where(t => t.ParentId == null), ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext), CollContent = content.GetAllPaging(null, paginInfo), Total = paginInfo.TotalCount, Controller = modul.Entity.Controller, CurrentLanguage = CurrentLanguage })); }
public IEnumerable <Content> GetContents(CustomAction action) { return(ContentRepository.GetList(action.ContentIds, true)); }
public IEnumerable <Content> GetContents(IEnumerable <int> contentIDs) => ContentRepository.GetList(contentIDs);
/// <summary> /// Called when the program switches to the screen. This is /// where screen assets are loaded and resources are created. /// </summary> public override void LoadContent() { // Load the content repository, which stores all assets imported via the editor. // This must be loaded before any other assets. contentRepository = BaseGameProgram.Instance.ContentDatabase.Load<ContentRepository>("ContentRepository"); // Load the scene and add it to the managers. Scene scene = BaseGameProgram.Instance.ContentDatabase.Load<Scene>("Scene"); sceneInterface.Submit(scene); // Load the scene settings. environment = BaseGameProgram.Instance.ContentDatabase.Load<SceneEnvironment>("SceneEnvironment"); // Apply the user preferences (example - not required). sceneInterface.ApplyPreferences(BaseGameProgram.Instance.GetSystemPreferences()); }
public Content GetContentById(int contentId) => ContentRepository.GetByIdWithFields(contentId);
public ActionResult SaveOrEdit(Content content, int[] selectedFileId = null, int[] selectedLabelId = null) { try { if (ModelState.IsValid) { if (content.CategoryId == 0) { var labels = new List <LabelLine>(); var fileManagers = new List <FileManager>(); int mainImageFileManagerId = 0; if (content.Id > 0) { content = ContentRepository.GetContentWithFiles(content.Id); labels = LabelLineRepository.GetLabelLinesByItem(content.Id, ContentType); fileManagers = content.ContentFiles.Select(r => r.FileManager).ToList(); var mainImage = content.ContentFiles.FirstOrDefault(r => r.IsMainImage); if (mainImage != null) { mainImageFileManagerId = mainImage.FileManagerId; } } ViewBag.MainImageId = mainImageFileManagerId; ViewBag.SelectedLabels = labels.Select(r => r.LabelId).ToArray(); ViewBag.FileManagers = fileManagers; ModelState.AddModelError("CategoryId", "You should select category from category tree."); return(View(content)); } if (content.Id == 0) { ContentRepository.Add(content); ClearCache(content.StoreId); } else { ContentRepository.Edit(content); } ContentRepository.Save(); int contentId = content.Id; if (selectedFileId != null) { ContentFileRepository.SaveContentFiles(selectedFileId, contentId); } LabelLineRepository.SaveLabelLines(selectedLabelId, contentId, ContentType); if (IsSuperAdmin) { return(RedirectToAction("Index", new { storeId = content.StoreId, categoryId = content.CategoryId })); } else { return(RedirectToAction("Index", new { categoryId = content.CategoryId })); } } } catch (Exception ex) { Logger.Error(ex, "Unable to save changes:" + ex.StackTrace, content); //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(content)); }
public static string GetComponentName(int componentType, Guid objectId) { MetadataRepository mdr = new MetadataRepository(); string componentLogicalName = null; string primaryNameAttribute = null; switch (componentType) { case 1: //Entity return(mdr.GetEntity(objectId).LogicalName); case 2: //Attribute return(mdr.GetAttribute(objectId).LogicalName); case 3: //Relationship return(mdr.GetRelationship(objectId).SchemaName); case 9: //Option Set return(mdr.GetOptionSet(objectId).Name); case 10: //Entity Relationship return(mdr.GetRelationship(objectId).SchemaName); case 13: //Managed Property return(mdr.GetManagedProperty(objectId).LogicalName); case 11: //Relationship Role componentLogicalName = "relationshiprole"; primaryNameAttribute = "name"; break; case 20: //Security Role componentLogicalName = "role"; primaryNameAttribute = "name"; break; case 21: //Privilege componentLogicalName = "privilege"; primaryNameAttribute = "name"; break; case 24: //User Dashboard componentLogicalName = "userform"; primaryNameAttribute = "name"; break; case 25: //Organization componentLogicalName = "organization"; primaryNameAttribute = "name"; break; case 26: //View componentLogicalName = "savedquery"; primaryNameAttribute = "name"; break; case 29: //Process componentLogicalName = "workflow"; primaryNameAttribute = "name"; break; case 31: //Report componentLogicalName = "report"; primaryNameAttribute = "name"; break; case 36: //Email Template componentLogicalName = "template"; primaryNameAttribute = "title"; break; case 37: //Contract Template componentLogicalName = "contracttemplate"; primaryNameAttribute = "name"; break; case 38: //Article Template componentLogicalName = "kbarticletemplate"; primaryNameAttribute = "title"; break; case 39: //Mail Merge Template componentLogicalName = "mailmergetemplate"; primaryNameAttribute = "name"; break; case 44: //Duplicate Detection Rule componentLogicalName = "duplicaterule"; primaryNameAttribute = "name"; break; case 59: //System Chart componentLogicalName = "savedqueryvisualization"; primaryNameAttribute = "name"; break; case 60: //System Form componentLogicalName = "systemform"; primaryNameAttribute = "name"; break; case 61: //Web Resource componentLogicalName = "webresource"; primaryNameAttribute = "name"; break; case 63: //Connection Role componentLogicalName = "connectionrole"; primaryNameAttribute = "name"; break; case 65: //Hierarchy Rule componentLogicalName = "hierarchyrule"; primaryNameAttribute = "name"; break; case 70: //Field Security Profile componentLogicalName = "fieldsecurityprofile"; primaryNameAttribute = "name"; break; case 90: //Plug-in Type componentLogicalName = "plugintype"; primaryNameAttribute = "name"; break; case 91: //Plug-in Assembly componentLogicalName = "pluginassembly"; primaryNameAttribute = "name"; break; case 92: //Sdk Message Processing Step componentLogicalName = "sdkmessageprocessingstep"; primaryNameAttribute = "name"; break; case 93: //Sdk Message Processing Step Image componentLogicalName = "sdkmessageprocessingstepimage"; primaryNameAttribute = "name"; break; case 95: //Service Endpoint componentLogicalName = "serviceendpoint"; primaryNameAttribute = "name"; break; case 150: //Routing Rule Set componentLogicalName = "routingrule"; primaryNameAttribute = "name"; break; case 151: //Rule Item componentLogicalName = "routingruleitem"; primaryNameAttribute = "name"; break; case 152: //SLA componentLogicalName = "sla"; primaryNameAttribute = "name"; break; case 154: //Record Creation and Update Rule componentLogicalName = "convertrule"; primaryNameAttribute = "name"; break; case 155: //Record Creation and Update Rule Item componentLogicalName = "convertruleitem"; primaryNameAttribute = "name"; break; default: componentLogicalName = null; primaryNameAttribute = null; break; } if (!string.IsNullOrWhiteSpace(componentLogicalName) && !string.IsNullOrWhiteSpace(primaryNameAttribute)) { ContentRepository ctr = new ContentRepository(); Entity componentEntity = ctr.Get(componentLogicalName, objectId); return(componentEntity.GetAttributeValue <string>(primaryNameAttribute)); } return(null); }
public HomeController(ContentRepository contentRepository) { ContentRepository = contentRepository; }
public IHttpActionResult UserProfile(long id, string data) { try { UserRepository userRepo = new UserRepository(); Applicant app = userRepo.GetApplicant(id); JobRepository jobRepo = new JobRepository(); UserCollectionsViewModel model = new UserCollectionsViewModel(); switch (data) { case "educ": model.educ = userRepo.GetListEducationalInfo(id); break; case "basic": model.basicInfo = userRepo.GetBasicInfo(id); break; case "saved": model.savedJobs = jobRepo.GetSavedJobs(id); break; case "exp": model.exp = userRepo.GetExperience(userRepo.GetApplicant(id).resume_id); break; default: model.initialInfo = userRepo.GetInitialInfo(id); break; } SelectRepository selectRepo = new SelectRepository(); model.jobSearch = new JobFilterCollectionViewModel(); model.jobSearch.workbases = selectRepo.Workbases(); model.jobSearch.specializations = selectRepo.Specializations(); ContentRepository contentRepo = new ContentRepository(); model.news = contentRepo.GetLatest("news", 2); model.partners = contentRepo.GetLatest("partners", 6); SettingsRepository settingsRepo = new SettingsRepository(); model.fb = JsonConvert.DeserializeObject<FacebookViewModel>(settingsRepo.GetSetting("fb").value); model.hotJobs = jobRepo.GetHotJobs(); model.recommendedJobs = jobRepo.GetRecommendedJobs(app); model.savedJobsCount = jobRepo.GetSavedJobs(app.id).Count; JobGroupRepository groupRepo = new JobGroupRepository(); List<JobGroupViewModel> groups = groupRepo.GetList(string.Empty, "sequence_asc", true); foreach (var g in groups) { g.jobs = jobRepo.GetByGroup(g.id); model.jobGroups.Add(g); } model.promotions = userRepo.GetPromotions(app.resume_id); model.initialInfo = userRepo.GetInitialInfo(id); model.photo = app.photo; model.interview = userRepo.GetInterviewStatus(app.role_id); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); world = new WorldGeometry( new Rectangle( 0, 0, GraphicsDevice.Viewport.Width, 1)); collisionManager.RegisterCollisionBody(world); // Load the content repository, which stores all assets imported via the editor. // This must be loaded before any other assets. contentRepository = Content.Load<ContentRepository>("Content"); // Add objects and lights to the ObjectManager and LightManager. They accept // objects and lights in several forms: // // -As scenes containing both dynamic (movable) and static objects and lights. // // -As SceneObjects and lights, which can be dynamic or static, and // (in the case of objects) are created from XNA Models or custom vertex / index buffers. // // -As XNA Models, which can only be static. // // Load the scene and add it to the managers. Scene scene = Content.Load<Scene>("Scenes/Scene"); SceneInterface.Submit(scene); // Load the scene environment settings. environment = Content.Load<SceneEnvironment>("Environment/Environment"); // TODO: use this.Content to load your game content here character.Load(Content, SpriteManager, SceneInterface); world.Load(Content, SpriteManager, SceneInterface); }
protected override void OnModified(object sender, ContentRepository.Storage.Events.NodeEventArgs e) { base.OnModified(sender, e); var cdName = e.ChangedData.FirstOrDefault(cd => cd.Name == "Name"); if (cdName != null) { var cl = ContentList.GetContentListByParentWalk(this); if (cl != null && !string.IsNullOrEmpty(cl.DefaultView) && cl.DefaultView.CompareTo(cdName.Original) == 0) { cl.DefaultView = this.Name; cl.Save(SavingMode.KeepVersion); } } }
public void CloseSession() { _session.Dispose(); _authRepository = null; _configRepository = null; _contentRepository = null; _fileRepository = null; //_session = null; }
protected internal override void PersistUploadToken(ContentRepository.Storage.ApplicationMessaging.UploadToken value) { WriteLog(MethodInfo.GetCurrentMethod(), value); base.PersistUploadToken(value); }
public ActionResult Create(ChallengeModel model, HttpPostedFileBase contentImage, HttpPostedFileBase contentCoverImage, List <string> videoyoutube, string existingTags, string newTags) { ChallengeRepository objchallenge = new ChallengeRepository(this.SessionCustom); ContentManagement objcontent = new ContentManagement(this.SessionCustom, HttpContext); try { DateTime?currentEndDate = null; if (model.IContent.ContentId.HasValue) { objchallenge.Entity.ContentId = model.IContent.ContentId; objchallenge.LoadByKey(); currentEndDate = objchallenge.Entity.EndDate; objchallenge.Entity = new Domain.Entities.Challenge(); } objcontent.ContentImage = contentImage; objcontent.ContentCoverImage = contentCoverImage; objcontent.CollVideos = videoyoutube; this.SessionCustom.Begin(); model.IContent.LanguageId = CurrentLanguage.LanguageId; objcontent.ContentInsert(model.IContent); objchallenge.Entity = model.Challenge; objchallenge.Entity.ExistingTags = !string.Empty.Equals(existingTags) ? existingTags : null; objchallenge.Entity.NewTags = !string.Empty.Equals(newTags) ? newTags : null; if (objchallenge.Entity.ContentId != null) { objchallenge.Update(); bool reactivated = false; if (currentEndDate < DateTime.Now.Date && model.Challenge.EndDate >= DateTime.Now.Date) { reactivated = true; } if (reactivated) { ContentRepository content = new ContentRepository(SessionCustom); content.Entity.ContentId = model.Challenge.ContentId; content.LoadByKey(); Business.Utilities.Notification.StartReActivateProcess(content.Entity.Frienlyname, content.Entity.ContentId.Value, this.HttpContext, this.CurrentLanguage); } this.InsertAudit("Update", this.Module.Name + " -> " + model.IContent.Name); } else { if (!string.IsNullOrEmpty(Request.Form["TempFiles"])) { string[] files = Request.Form["TempFiles"].Split(','); if (files.Length > 0) { if (!Directory.Exists(Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\"))) { Directory.CreateDirectory(Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\")); } } foreach (var item in files) { string filep = Path.Combine(Server.MapPath("~"), @"Files\Images\" + Path.GetFileName(item)); if (System.IO.File.Exists(filep)) { string filedestin = Path.Combine(Server.MapPath("~"), @"Files\Images\" + Path.GetFileName(item)); System.IO.File.Move(filep, Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\" + Path.GetFileName(item))); } } } objchallenge.Entity.ContentId = objcontent.ObjContent.ContentId; objchallenge.Entity.Followers = 0; objchallenge.Insert(); ContentRepository content = new ContentRepository(SessionCustom); content.Entity.ContentId = model.Challenge.ContentId; content.LoadByKey(); ////EmailNotificationRepository emailNotification = new EmailNotificationRepository(SessionCustom); ////List<int> users = emailNotification.SendNewProcessNotification(); ////foreach (int userId in users) ////{ //// Business.Utilities.Notification.NewNotification(userId, Domain.Entities.Basic.EmailNotificationType.NEW_PROCESS, null, null, string.Concat("/", content.Entity.Frienlyname), content.Entity.ContentId, content.Entity.ContentId.Value, null, null, null, this.SessionCustom, this.HttpContext, this.CurrentLanguage); ////} Business.Utilities.Notification.StartNewProcess(content.Entity.Frienlyname, content.Entity.ContentId.Value, this.HttpContext, this.CurrentLanguage); this.InsertAudit("Insert", this.Module.Name + " -> " + model.IContent.Name); } this.SessionCustom.Commit(); } catch (Exception ex) { SessionCustom.RollBack(); Utils.InsertLog( this.SessionCustom, "Error" + this.Module.Name, ex.Message + " " + ex.StackTrace); } if (Request.Form["GetOut"] == "0") { return(this.RedirectToAction("Index", "Content", new { mod = Module.ModulId })); } else { return(this.RedirectToAction("Detail", "Challenge", new { mod = Module.ModulId, id = objchallenge.Entity.ContentId })); } }
public override void LoadStep() { var children = ContentRepository.GetChildren <IContent>(TestRootLink); }
//========================================================================================= Helper methods private static void AddContentListField(ContentRepository.Content content) { if (content == null) return; var contentList = ContentList.GetContentListByParentWalk(content.ContentHandler); if (contentList == null) return; //build longtext field for custom status messages var fs = new LongTextFieldSetting { ShortName = "LongText", Name = "#" + ContentNamingHelper.GetNameFromDisplayName(content.Name, content.DisplayName) + "_status", DisplayName = content.DisplayName + " status", Icon = content.Icon }; contentList.AddOrUpdateField(fs); }
public IEnumerable <Content> GetContentList(IEnumerable <int> contentIDs) => ContentRepository.GetList(contentIDs, loadFields: true);
public ContentController() { this.repo = new ContentRepository(); }
private DomainRepository CreateRepository(IDatabaseUnitOfWork unitOfWork, out ContentTypeRepository contentTypeRepository, out ContentRepository contentRepository, out LanguageRepository languageRepository) { var templateRepository = new TemplateRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax, Mock.Of <IFileSystem>(), Mock.Of <IFileSystem>(), Mock.Of <ITemplatesSection>()); var tagRepository = new TagRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax); contentTypeRepository = new ContentTypeRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax, templateRepository); contentRepository = new ContentRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax, contentTypeRepository, templateRepository, tagRepository, Mock.Of <IContentSection>()); languageRepository = new LanguageRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax); var domainRepository = new DomainRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Logger, SqlSyntax); return(domainRepository); }
public static ContentGroup GetDefaultGroup(int siteId) => ContentRepository.GetGroupById(ContentRepository.GetDefaultGroupId(siteId));
public RestController(ContentRepository contentRepository) { ContentRepository = contentRepository; }
public IHttpActionResult SingleContentWithTypes(long id) { try { ContentRepository contentRepo = new ContentRepository(); ContentTypeRepository typeRepo = new ContentTypeRepository(); SingleContentWithTypesCollectionViewModel model = new SingleContentWithTypesCollectionViewModel(); ContentViewModel content = contentRepo.GetSingle(id); if (content.id == 0) { throw new Exception(Error.CONTENT_NOT_FOUND); } string[] contact_us = { Constants.CONTACT_US }; List<ContentTypeViewModel> lstTypes = typeRepo.GetList(contact_us); model.types = lstTypes; model.content = content; return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
/// <summary> /// Called when the program switches away from this screen /// and is where screen resources are disposed. /// </summary> public override void UnloadContent() { sceneInterface.Unload(); environment = null; contentRepository = null; }
public IHttpActionResult NewsBlogSettings() { try { NewsBlogSettingCollectionsViewModel model = new NewsBlogSettingCollectionsViewModel(); ContentRepository contentRepo = new ContentRepository(); model.news = contentRepo.GetLatest("news"); model.blogs = contentRepo.GetLatest("blogs", 4); SettingsRepository settingsRepo = new SettingsRepository(); model.facebook = JsonConvert.DeserializeObject<FacebookViewModel>(settingsRepo.GetSetting("fb").value); model.twitter = JsonConvert.DeserializeObject<TwitterViewModel>(settingsRepo.GetSetting("twitter").value); model.instagram = JsonConvert.DeserializeObject<InstagramViewModel>(settingsRepo.GetSetting("ig").value); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
public override IEnumerable <IContent> GetItems(EPiServer.Cms.Shell.UI.Rest.ContentQuery.ContentQueryParameters parameters) { var filterModelString = parameters.AllParameters["filterModel"]; var productGroupedString = parameters.AllParameters["productGrouped"]; var sortColumn = parameters.SortColumns != null ? (parameters.SortColumns.FirstOrDefault() ?? new SortColumn()) : new SortColumn(); bool productGrouped; Boolean.TryParse(productGroupedString, out productGrouped); var listingMode = GetListingMode(parameters); var contentLink = GetContentLink(parameters, listingMode); var filterModel = CheckedOptionsService.CreateFilterModel(filterModelString); var searchType = typeof(CatalogContentBase); // make this selectable using Conventions api var filters = new Dictionary <string, IEnumerable <object> >(); if (filterModel != null && filterModel.CheckedItems != null) { filters = filterModel.CheckedItems.Where(x => x.Value != null) .ToDictionary(k => k.Key, v => v.Value.Select(x => x)); var receivedSearchType = GetSearchType(filterModel); if (receivedSearchType != null) { searchType = receivedSearchType; } } var content = ContentRepository.Get <IContent>(contentLink); var includeProductVariationRelations = productGrouped && !(content is ProductContent); var supportedFilters = GetSupportedFilterContentModelTypes(searchType).ToList(); var query = CreateSearchQuery(searchType); var startIndex = parameters.Range.Start ?? 0; var endIndex = includeProductVariationRelations ? MaxItems : parameters.Range.End ?? MaxItems; var cacheKey = String.Concat("ContentFilterService#", content.ContentLink.ToString(), "#"); if (!String.IsNullOrEmpty(sortColumn.ColumnName)) { cacheKey += sortColumn.ColumnName + sortColumn.SortDescending; } if (!includeProductVariationRelations) { cacheKey += startIndex + endIndex; } query = GetFiltersToQuery(content, supportedFilters, filters, query, ref cacheKey); query = SearchSortingService.Sort(sortColumn, query); var cachedItems = GetCachedContent <Tuple <IEnumerable <IFacetContent>, int> >(cacheKey); if (cachedItems != null) { parameters.Range.Total = cachedItems.Item2; return(cachedItems.Item1); } var properties = ContentRepository.GetDefault <FacetContent>(content.ContentLink).Property; var contentList = new List <IFacetContent>(); var linkedProductLinks = new List <ContentReference>(); var total = AddFilteredChildren(query, contentList, linkedProductLinks, properties, includeProductVariationRelations, startIndex, endIndex); parameters.Range.Total = includeProductVariationRelations ? contentList.Count : total; Cache(cacheKey, new Tuple <IEnumerable <IFacetContent>, int>(contentList, parameters.Range.Total.Value)); return(contentList); }
public IHttpActionResult ListContentWithSingle(string type, string id) { try { ContentRepository repo = new ContentRepository(); ListContentWithSingleViewModel model = new ListContentWithSingleViewModel(); model.contents = repo.GetListByType(type, ""); model.content = repo.GetSingleByAlias(id); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }