示例#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
文件: Default.aspx.cs 项目: kyvkri/MG
    public override NextCall Invoke(WorkflowMethod invoker)
    {
        if (!Session.Access.IsAdmin()) throw new Exception("Only administrators can run this workflow. ");

        if (!Engine.Installation.EnableContentLinkIndex) {
            Session.Notify("Link indexing is not enabled on this installation. See menu \"Application/Settings\" to enable it. ");
            return null;
        }

        WFContext.Caption = "Updating link index...";

        AqlQuery q;
        AqlResultSet result;

        q = new AqlQuery(Session);
        var rNodeId = q.Select(AqlContent.NodeId);
        var rLCID = q.Select(AqlContent.NodeId);
        var rClassId = q.Select(AqlContent.ContentClassId);
        q.Distinct();
        q.From<UrlStatus>();
        var nodeIds = new List<int>();
        result = q.Execute();
        nodeIds = new List<int>();
        while (result.Read()) nodeIds.Add(rNodeId);
        int n = 0;
        foreach (int id in nodeIds) {
            n++;
            WFContext.Description = "Deleting old non-system url index, " + n + " of " + nodeIds.Count + "...";
            if (WFContext.BreakExecution) return null;
            Session.DeleteNode(id, true);
        }

        WFContext.Description = "Queuing link updates...";
        q = new AqlQuery(Session);
        rNodeId = q.Select(AqlContent.NodeId);
        rClassId = q.Select(AqlContent.ContentClassId);
        q.Distinct();
        result = q.Execute();
        var keys = new List<CKeyNC>();
        while (result.Read()) {
            keys.Add(new CKeyNC(rNodeId, rClassId));
        }
        WFContext.Engine.QueNodeLinksUpdate(keys);

        WFContext.Notify("Link update is cued for " + keys.Count + " nodes.");
        return null;
    }
示例#3
0
文件: Default.aspx.cs 项目: kyvkri/MG
 NextCall onComplete(WorkflowMethod invoker)
 {
     var f = (WMContentForm)invoker;
     int pixels = 1000000 * int.Parse(f.Result.Get<ShortStringPropertyValue>("megapixels").Value.Substring(1));
     AqlQuery q = new AqlQuery(Session);
     AqlAliasHierarchicalContent alias = new AqlAliasHierarchicalContent();
     var rC = q.Select<HierarchicalContent>(alias);
     q.From(alias);
     var rs = q.Execute();
     var cs = new List<HierarchicalContent>();
     while (rs.Read()) cs.Add(rC.Value);
     foreach (var c in cs) {
         _countContents++;
         WFContext.Caption = "Rescaling images...";
         WFContext.Description = _countContents + " contents examined. " + _countResized + " images rescaled. Before: " + Utils.GetByteSizeString(bytesBefore) + ". After: " + Utils.GetByteSizeString(bytesAfter);
         try {
             resizeImages(c, pixels);
             if (WFContext.BreakExecution) return null;
             if (c.Changed) c.UpdateChanges(false, false, false);
         } catch { }
     }
     Session.Notify("Rescale complete", _countContents + " contents examined. " + _countResized + " images rescaled. Before: " + Utils.GetByteSizeString(bytesBefore) + ". After: " + Utils.GetByteSizeString(bytesAfter));
     return null;
 }
示例#4
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     _countContents = 0;
     AqlQuery q = new AqlQuery(Session);
     AqlAliasHierarchicalContent alias = new AqlAliasHierarchicalContent();
     var rC = q.Select<HierarchicalContent>(alias);
     q.From(alias);
     var rs = q.Execute();
     var cs = new List<HierarchicalContent>();
     while (rs.Read()) cs.Add(rC.Value);
     foreach (var c in cs) {
         _countContents++;
         WFContext.Caption = "Resetting encoded video files...";
         WFContext.Description = _countContents + " contents examined. " + _countReset + " video files reset. ";
         try {
             resetVideoEncoding(c);
             if (WFContext.BreakExecution) return null;
             if (c.Changed) c.UpdateChanges(false, false, false);
         } catch { }
     }
     Session.Notify("Encoding reset complete", _countContents + " contents examined. " + _countReset + " video reset. ");
     return null;
 }