protected void btnEmpty_Click(object sender, EventArgs e) { lstBin.DataBind(); deleteList m = new deleteList(); q = WAFContext.Session.CreateQuery(); var alias = new AqlAlias(); alias.IncludeOnlyDeletedNodes = true; q.From(alias); if (!WAFContext.Session.Access.IsAdmin()) { q.Where(Aql.MemberOf(alias.EditGroupId, WAFContext.Session.Access)); q.Where(Aql.MemberOf(alias.PublishGroupId, WAFContext.Session.Access)); } q.Select(alias.NodeId); m.NodeIds = q.Execute<int>(); WAFContext.StartWorkflowMethod(m); }
protected override void OnInit(EventArgs e) { q = WAFContext.Session.CreateQuery(); var alias = new AqlAlias(); alias.IncludeOnlyDeletedNodes = true; q.From(alias); q.Where(Aql.MemberOf(alias.EditGroupId, WAFContext.Session.Access)); q.Where(Aql.MemberOf(alias.PublishGroupId, WAFContext.Session.Access)); q.Select(alias, "Content"); q.Select(alias.Name, "Name"); q.Select(alias.ChangeDate, "ChangeDate"); q.Select(alias.CreateDate, "CreateDate"); lstBin.SortColumnIndex = 1; lstBin.Query = q; base.OnInit(e); }
public AqlAliasRelMgArticleBackground(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelMgArticleBackground.Relation) { }
public AqlAliasRelUserFriendsList(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelUserFriendsList.Relation, onParent, onChild) { }
public AqlAliasRelUserFriendsList(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelUserFriendsList.Relation) { }
public AqlAliasRelArticleBoxes(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelArticleBoxes.Relation, onParent, onChild) { }
public AqlAliasRelThemeWishList(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelThemeWishList.Relation, onParent, onChild) { }
public AqlAliasRelHelloWorldArticles(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelHelloWorldArticles.Relation) { }
public AqlAliasRelUserMGWishList(AqlAlias parent, AqlAliasRelation child, AqlAlias onChild) : base(parent, child, AqlRelUserMGWishList.Relation, onChild) { }
public AqlAliasRelUserMGWishList(AqlAliasRelation parent, AqlAlias child, AqlAlias onParent) : base(parent, child, AqlRelUserMGWishList.Relation, onParent) { }
public AqlAliasRelWishListWishes(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelWishListWishes.Relation, onParent, onChild) { }
public AqlAliasRelWishListWishes(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelWishListWishes.Relation) { }
public AqlAliasRelWishListBackgroundImage(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelWishListBackgroundImage.Relation, onParent, onChild) { }
public AqlAliasRelWishListBackgroundImage(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelWishListBackgroundImage.Relation) { }
public AqlAliasRelMgArticleBackground(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelMgArticleBackground.Relation, onParent, onChild) { }
void ensureInegrity(object stateInfo) { try { setThreadDescription("Ensuring data uniqueness"); SqlQuery query = new SqlQuery(WAFRuntime.Engine.Dao); DataAccessObject dao = WAFRuntime.Engine.Dao; // Node table setThreadDescription("Fixing Node table..."); int fixCount = 0; foreach (int nodeId in dao.GetDuplicateNodeRecords()) { if (dao.FixDuplicateNodeRecords(nodeId)) fixCount++; } //if (fixCount > 0) WFContext.Notify("Fixed " + fixCount + " duplicate records in the node table. "); // NodeCsd table setThreadDescription("Fixing Node Csd table..."); fixCount = 0; foreach (int[] ids in dao.GetDuplicateNodeCsdRecords()) { if (dao.FixDuplicateNodeCsdRecords(ids[0], ids[1])) fixCount++; } //if (fixCount > 0) WFContext.Notify("Fixed " + fixCount + " duplicate records in the nodeCsd table. "); // Content table setThreadDescription("Fixing Content table..."); fixCount = 0; foreach (int[] ids in dao.GetDuplicateContentBaseRecords()) { if (dao.FixDuplicateContentBaseRecords(ids[0], ids[1], ids[2])) fixCount++; } //if (fixCount > 0) WAFRuntime.Notify("Fixed " + fixCount + " duplicate records in the content table. "); // Class tables foreach (MemDefContentClass classDef in WAFRuntime.Engine.Definition.ContentClass.Values) { setThreadDescription("Fixing Class table '" + classDef.ClassName + "'..."); fixCount = 0; List<int> contentIds = dao.GetDuplicateContentClassRecords(classDef.Id); foreach (int contentId in contentIds) { if (dao.FixDuplicateContentClassRecords(classDef.Id, contentId)) fixCount++; } } //if (fixCount > 0) WAFRuntime.Notify("Fixed " + fixCount + " duplicate records in class tables. "); foreach (MemDefRelation relDef in WAFRuntime.Engine.Definition.Relation.Values) { } foreach (MemDefProperty propDef in WAFRuntime.Engine.Definition.Property.Values) { if (propDef.BasePropertyClassId == PropertyBaseClass.InnerContents) { } } AqlAlias alias = new AqlAlias(); alias.IgnoreSessionCulture = true; alias.IgnoreSessionRevision = true; alias.IncludeDeletedContents = true; alias.IncludeDeletedNodes = true; setThreadDescription("Refreshing derived flag..."); foreach (int siteId in WAFRuntime.Engine.GetAllSiteIds()) { foreach (int lcid in WAFRuntime.Engine.GetSiteAllLCIDs(siteId)) { UniqueList<int> cultInSite = new UniqueList<int>(WAFRuntime.Engine.GetSiteLCIDs(siteId)); if (!cultInSite.Contains(lcid)) { // if lcid is not in site, set all contents in this lcis to derived... // get all nodes in site SqlAliasNode node = new SqlAliasNode(); SqlAliasContent content = new SqlAliasContent(); SqlJoinExpression joinExp = new SqlJoinExpression(); joinExp.Add(node.Id, content.NodeId); SqlFromInnerJoin join = new SqlFromInnerJoin(node, content, joinExp); SqlQuery select = new SqlQuery(WAFRuntime.Engine.Dao); select.Select(content.ContentId); select.From(join); select.Where(node.SiteId == siteId); select.Where(content.LCID == lcid); select.Where(content.IsDerived == false); List<int> cIds = new List<int>(); using (SqlDataReader dr = select.ExecuteReader()) { while (dr.Read()) cIds.Add(dr.GetInt(0)); } foreach (int contentId in cIds) { SqlQuery update = new SqlQuery(WAFRuntime.Engine.Dao); update.Update(Sql.Table.Content); update.Set(Sql.Field.Content.IsDerived, true); update.Where(Sql.Field.Content.LCID == lcid); update.Where(Sql.Field.Content.ContentId == contentId); update.ExecuteNonQuery(); } if (isThreadCancelled()) return; } } } setThreadDescription("Retrieving node ids..."); SqlQuery sqlQuery = new SqlQuery(WAFRuntime.Engine.Dao); List<int> nodeIds = new List<int>(); List<int> classIds = new List<int>(); sqlQuery.From(Sql.Table.Node); sqlQuery.Distinct = true; sqlQuery.Select(Sql.Field.Node.Id); sqlQuery.Select(Sql.Field.Node.ContentClassId); using (SqlDataReader sqlDr = sqlQuery.ExecuteReader()) { while (sqlDr.Read()) { nodeIds.Add(sqlDr.GetInt(0)); classIds.Add(sqlDr.GetInt(1)); } } int n = 0; foreach (int nodeId in nodeIds) { WAFRuntime.Engine.Dao.RebuildDerivedContents(nodeId, classIds[n]); setThreadDescription("Ensuring derived content records: " + (++n) + " of " + nodeIds.Count + "..."); if (isThreadCancelled()) return; } setThreadDescription("Retrieving content ids..."); AqlQuery q = WAFRuntime.SystemSession.CreateQuery(); alias.IgnoreSessionRevision = true; alias.IgnoreSessionCulture = true; q.From(alias); q.Select(alias.ContentId); q.Select(alias.ContentClassId); List<int> coIds = new List<int>(); classIds = new List<int>(); AqlResultSet rs = q.Distinct().Execute(); while (rs.Read()) { coIds.Add((int)rs[0]); classIds.Add((int)rs[1]); } WAFRuntime.Engine.Dao.AddContentIdsInnerContent(ref coIds, ref classIds); n = 0; foreach (int contentId in coIds) { WAFRuntime.Engine.Dao.EnsureContentRecords(contentId, classIds[n], 0); setThreadDescription("Ensuring class table records: " + (++n) + " of " + coIds.Count + "..."); if (isThreadCancelled()) return; } WAFRuntime.Engine.ClearCache(); completeThread("DONE. Database integrity check is complete."); } catch (Exception error) { completeThread("ERROR: " + error.Message); } }
public AqlAliasRelControlPanelBackground(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelControlPanelBackground.Relation) { }
public AqlAliasRelHelloWorldArticles(AqlAliasRelation parent, AqlAliasRelation child, AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelHelloWorldArticles.Relation, onParent, onChild) { }
public AqlAliasRelControlPanelBackground(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild) : base(parent, child, AqlRelControlPanelBackground.Relation, onParent, onChild) { }
public AqlAliasRelArticleBoxes(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelArticleBoxes.Relation) { }
public AqlAliasRelThemeWishList(AqlAlias parent, AqlAlias child) : base(parent, child, AqlRelThemeWishList.Relation) { }