Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
 public AqlAliasRelMgArticleBackground(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelMgArticleBackground.Relation)
 {
 }
Пример #4
0
 public AqlAliasRelUserFriendsList(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelUserFriendsList.Relation, onParent, onChild)
 {
 }
Пример #5
0
 public AqlAliasRelUserFriendsList(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelUserFriendsList.Relation)
 {
 }
Пример #6
0
 public AqlAliasRelArticleBoxes(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelArticleBoxes.Relation, onParent, onChild)
 {
 }
Пример #7
0
 public AqlAliasRelThemeWishList(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelThemeWishList.Relation, onParent, onChild)
 {
 }
Пример #8
0
 public AqlAliasRelHelloWorldArticles(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelHelloWorldArticles.Relation)
 {
 }
Пример #9
0
 public AqlAliasRelUserMGWishList(AqlAlias parent, AqlAliasRelation child, AqlAlias onChild)
     : base(parent, child, AqlRelUserMGWishList.Relation, onChild)
 {
 }
Пример #10
0
 public AqlAliasRelUserMGWishList(AqlAliasRelation parent, AqlAlias child, AqlAlias onParent)
     : base(parent, child, AqlRelUserMGWishList.Relation, onParent)
 {
 }
Пример #11
0
 public AqlAliasRelWishListWishes(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelWishListWishes.Relation, onParent, onChild)
 {
 }
Пример #12
0
 public AqlAliasRelWishListWishes(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelWishListWishes.Relation)
 {
 }
Пример #13
0
 public AqlAliasRelWishListBackgroundImage(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelWishListBackgroundImage.Relation, onParent, onChild)
 {
 }
Пример #14
0
 public AqlAliasRelWishListBackgroundImage(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelWishListBackgroundImage.Relation)
 {
 }
Пример #15
0
 public AqlAliasRelMgArticleBackground(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelMgArticleBackground.Relation, onParent, onChild)
 {
 }
Пример #16
0
    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);
        }
    }
Пример #17
0
 public AqlAliasRelControlPanelBackground(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelControlPanelBackground.Relation)
 {
 }
Пример #18
0
 public AqlAliasRelHelloWorldArticles(AqlAliasRelation parent, AqlAliasRelation child, AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelHelloWorldArticles.Relation, onParent, onChild)
 {
 }
Пример #19
0
 public AqlAliasRelControlPanelBackground(AqlAliasRelation parent, AqlAliasRelation child,AqlAlias onParent, AqlAlias onChild)
     : base(parent, child, AqlRelControlPanelBackground.Relation, onParent, onChild)
 {
 }
Пример #20
0
 public AqlAliasRelArticleBoxes(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelArticleBoxes.Relation)
 {
 }
Пример #21
0
 public AqlAliasRelThemeWishList(AqlAlias parent, AqlAlias child)
     : base(parent, child, AqlRelThemeWishList.Relation)
 {
 }