internal static void RunCreateViewDdl(string viewCreateDdl) { using (var scope = new QPConnectionScope()) { Common.ExecuteSql(scope.DbConnection, viewCreateDdl); } }
internal static void RemoveUserQueryAttrs(Content dbContent) { using (var scope = new QPConnectionScope()) { Common.RemoveUserQueryAttrs(scope.DbConnection, dbContent.Id); } }
/// <summary> /// Удалить записи в таблице union_contents для всех полей union-контента /// </summary> internal static void RemoveUnionAttrs(Content unionContent) { using (var scope = new QPConnectionScope()) { Common.RemoveUnionAttrsByUnionContent(scope.DbConnection, unionContent.Id); } }
public void MultipleRemove(int parentId, IEnumerable <int> entityIDs, int?userId, int?groupId) { using (var scope = new QPConnectionScope()) { Common.RemoveChildContentPermissions(scope.DbConnection, entityIDs.ToList(), userId, groupId); } }
public VirtualFieldRelationsStorage(int rootContentId) { if (_storage == null) { _storage = new Dictionary <int, VirtualFieldRelationStorageItem>(); } if (_contentIds == null) { _contentIds = new Queue <int>(); } _contentIds.Enqueue(rootContentId); if (!_storage.ContainsKey(rootContentId)) { var item = new VirtualFieldRelationStorageItem { ScopeCount = 1 }; _storage.Add(rootContentId, item); using (var scope = new QPConnectionScope()) { var dt = Common.LoadVirtualFieldsRelations(scope.DbConnection, rootContentId); item.Data = MapperFacade.VirtualFieldsRelationMapper.GetBizList(dt.AsEnumerable().ToList()).Distinct().ToArray(); } } else { _storage[rootContentId].ScopeCount++; } }
internal static void Delete(int id) { using (var scope = new QPConnectionScope()) { if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeDeleteBindingsTriggerState(false); } var bindings = QPContext.EFContext.ContentWorkflowBindSet.Where(n => n.WorkflowId == id).ToArray(); DefaultRepository.SimpleDeleteBulk(bindings); var bindings2 = QPContext.EFContext.ArticleWorkflowBindSet.Where(n => n.WorkflowId == id).ToArray(); DefaultRepository.SimpleDeleteBulk(bindings2); var waits = QPContext.EFContext.WaitingForApprovalSet.Include(n => n.Article.WorkflowBinding) .Where(n => n.Article.WorkflowBinding.WorkflowId == id).ToArray(); DefaultRepository.SimpleDeleteBulk(waits); DefaultRepository.Delete <WorkflowDAL>(id); if (QPContext.DatabaseType == DatabaseType.SqlServer) { ChangeDeleteBindingsTriggerState(true); } } }
internal static void CopyArticleWorkflowBind(int sourceSiteId, int destinationSiteId, string relationsBetweenItemsXml) { using (var scope = new QPConnectionScope()) { Common.CopyArticleWorkflowBind(scope.DbConnection, sourceSiteId, destinationSiteId, relationsBetweenItemsXml); } }
internal static int[] GetReferencedAggregatedContentIds(int contentId) { using (var scope = new QPConnectionScope()) { return(Common.GetReferencedAggregatedContentIds(scope.DbConnection, contentId)); } }
internal static Dictionary <int, Dictionary <int, int> > GetAggregatedArticleIdsMap(int contentId, int[] articleIds) { using (var scope = new QPConnectionScope()) { return(Common.GetAggregatedArticleIdsMap(scope.DbConnection, contentId, articleIds)); } }
/// <summary> /// Возвращает список контекстных меню /// </summary> /// <returns>список контекстных меню</returns> internal static List <ContextMenu> GetList() { using (var scope = new QPConnectionScope()) { return(MapperFacade.ContextMenuRowMapper.GetBizList(Common.GetContextMenusList(scope.DbConnection, QPContext.CurrentUserId).ToList())); } }
/// <summary> /// Возвращает список статусов действий /// </summary> internal static IEnumerable <BackendActionStatus> GetStatusesList(string menuCode, int entityId) { using (var scope = new QPConnectionScope()) { return(MapperFacade.BackendActionStatusMapper.GetBizList(Common.GetMenuStatusList(scope.DbConnection, QPContext.CurrentUserId, menuCode, entityId).ToList())); } }
/// <summary> /// Возвращает контекстное меню по его коду /// </summary> internal static ContextMenu GetByCode(string menuCode, bool loadItems = false) { using (var scope = new QPConnectionScope()) { return(MapperFacade.ContextMenuRowMapper.GetBizObject(Common.GetContextMenuByCode(scope.DbConnection, QPContext.CurrentUserId, menuCode, loadItems))); } }
internal static void RefreshView(string viewName) { using (var scope = new QPConnectionScope()) { Common.RefreshView(scope.DbConnection, viewName); } }
internal static void CreateFrontendViews(int contentId) { using (var scope = new QPConnectionScope()) { Common.CreateFrontedViews(scope.DbConnection, contentId); } }
internal static void CleanWorkflowContentIds(int workflowId) { using (var scope = new QPConnectionScope()) { Common.CleanWorkflowContentBindedIds(scope.DbConnection, workflowId); } }
internal static IEnumerable <int> BatchRemoveContents(int siteId, int contentsToRemove) { using (var scope = new QPConnectionScope()) { return(Common.RemovingActions_BatchRemoveContents(siteId, contentsToRemove, scope.DbConnection)); } }
internal static void SetWorkflowBindedContentId(int workflowId, int contentId) { using (var scope = new QPConnectionScope()) { Common.SetWorkflowBindedContentId(scope.DbConnection, workflowId, contentId); } }
internal static bool IsArticlePermissionsAllowed(int contentId) { using (var scope = new QPConnectionScope()) { return(Common.IsArticlePermissionsAllowed(scope.DbConnection, contentId)); } }
internal static void SaveHistoryStatus(int id, int systemStatusTypeId, string comment, int currentUserId) { using (var scope = new QPConnectionScope()) { Common.AddHistoryStatus(scope.DbConnection, id, systemStatusTypeId, currentUserId, comment); } }
internal static void CopyCustomActions(int sourceId, int destinationId) { using (var scope = new QPConnectionScope()) { Common.CopyContentCustomActions(scope.DbConnection, sourceId, destinationId); } }
public void RemoveAll(int parentId, int?userId, int?groupId) { using (var scope = new QPConnectionScope()) { Common.RemoveChildContentPermissions(scope.DbConnection, parentId, userId, groupId); } }
internal static int GetDefaultGroupId(int siteId) { using (var scope = new QPConnectionScope()) { return(Common.GetDefaultGroupId(scope.DbConnection, siteId)); } }
public ChildEntityPermission Read(int parentId, int entityId, int?userId, int?groupId) { using (var scope = new QPConnectionScope()) { DataRow row; if (userId.HasValue) { row = Common.GetChildContentPermissionForUser(scope.DbConnection, parentId, entityId, userId.Value); } else if (groupId.HasValue) { row = Common.GetChildContentPermissionForGroup(scope.DbConnection, parentId, entityId, groupId.Value); } else { throw new ArgumentNullException(nameof(groupId)); } if (row?.Field <decimal?>("LevelId") == null) { return(null); } var containsHide = row.Table.Columns.Contains("Hide"); return(ChildEntityPermission.Create(null, parentId, userId, groupId, Convert.ToInt32(row.Field <decimal>("LevelId")), row.Field <bool>("PropagateToItems"), containsHide && row.Field <bool>("Hide"))); } }
internal static void UpdateContentModification(int contentId) { using (var scope = new QPConnectionScope()) { Common.UpdateContentModification(scope.DbConnection, contentId); } }
/// <summary> /// Обновить привязку базовых полей к UQ-контенту /// </summary> internal static void RebuildUserQueryAttrs(Content dbContent) { dbContent = ContentRepository.GetById(dbContent.Id); // определить какие контенты используются // и построить словарь используемых контентов var usedContentIds = dbContent.UserQueryContentViewSchema.SelectUniqContentIDs(); var usedContents = ContentRepository.GetList(usedContentIds); var usedContentDict = new Dictionary <int, Dictionary <string, int> >(); foreach (var uc in usedContents) { usedContentDict.Add(uc.Id, new Dictionary <string, int>(StringComparer.InvariantCultureIgnoreCase)); foreach (var f in uc.Fields) { usedContentDict[uc.Id].Add(f.Name, f.Id); } } var userQueryAttr = dbContent.UserQueryContentViewSchema .Where(c => c.ContentId.HasValue) // только колонки из контентов .Where(c => usedContentDict[c.ContentId.Value].ContainsKey(c.ColumnName)) .Select(c => new UserQueryAttr { UserQueryContentId = dbContent.Id, BaseFieldId = usedContentDict[c.ContentId.Value][c.ColumnName] }); var records = MapperFacade.UserQueryAttrMapper.GetDalList(userQueryAttr.ToList()).AsEnumerable(); using (var scope = new QPConnectionScope()) { Common.BatchInsertUserQueryAttrs(scope.DbConnection, records); } }
internal static ListResult <ContentListItem> GetList(ContentListFilter filter, ListCommand cmd, int[] selectedContentIDs = null, int workflowId = 0) { using (var scope = new QPConnectionScope()) { var options = new ContentPageOptions { ContentName = filter.ContentName, SiteId = filter.SiteId, IsVirtual = filter.IsVirtual, GroupId = filter.GroupId, Mode = filter.Mode, SelectedIDs = selectedContentIDs, UserId = QPContext.CurrentUserId, UseSecurity = !QPContext.IsAdmin, IsAdmin = QPContext.IsAdmin, SortExpression = cmd.SortExpression, StartRecord = cmd.StartRecord, PageSize = cmd.PageSize, LanguageId = QPContext.CurrentUserIdentity.LanguageId, CustomFilter = filter.CustomFilter }; var rows = Common.GetContentsPage(scope.DbConnection, options, out var totalRecords); return(new ListResult <ContentListItem> { Data = MapperFacade.ContentListItemRowMapper.GetBizList(rows.ToList()), TotalRecords = totalRecords }); } }
/// <summary> /// Для виртуального поля, возвращает ID всех реальных базовых полей /// </summary> internal static IEnumerable <int> GetRealBaseFieldIds(int virtualFieldId) { using (var scope = new QPConnectionScope()) { return(Common.GetRealBaseFieldIds(scope.DbConnection, virtualFieldId)); } }
internal static IEnumerable <int> GetBindedContetnsIds(int workflowId) { using (var scope = new QPConnectionScope()) { return(Common.GetWorkflowContentBindedIds(scope.DbConnection, workflowId).Select(x => Converter.ToInt32(x.Field <decimal>("CONTENT_ID")))); } }
/// <summary> /// Удалить записи в таблице union_contents для базовых полей /// </summary> internal static void RemoveUnionAttrs(List <int> baseFieldIds) { using (var scope = new QPConnectionScope()) { Common.RemoveUnionAttrsByBaseFields(scope.DbConnection, baseFieldIds); } }
/// <summary> /// Возвращает информацию о столбцах View /// </summary> internal static IEnumerable <UserQueryColumn> GetViewSchema(string viewName) { using (var scope = new QPConnectionScope()) { return(DataTableToUserQueryColumns(Common.GetViewColumnUsage(scope.DbConnection, viewName))); } }