public IViewComponentResult Invoke(UniqueList <string> modules)
        {
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());
            modules.Add(nameof(ICDReferenceViewComponent).ViewComponentName());

            return(View(new Diagnosys()));
        }
Beispiel #2
0
        public IReadOnlyDictionary <Network, IReadOnlyList <AssetPair> > DeNormalise(IReadOnlyCollection <KeyValuePair <Network, IReadOnlyList <AssetPair> > > rawData)
        {
            var d = new Dictionary <Network, IReadOnlyList <AssetPair> >();

            foreach (var kv in PairsByNetwork)
            {
                var rawPairs = rawData.Get(kv.Key);
                if (rawPairs == null)
                {
                    continue;
                }

                var vals = new UniqueList <AssetPair>();
                foreach (var ourPair in kv.Value)
                {
                    if (rawPairs.Contains(ourPair))
                    {
                        vals.Add(ourPair);
                    }
                    else if (rawPairs.Contains(ourPair.Reversed))
                    {
                        vals.Add(ourPair.Reversed);
                    }
                }

                d.Add(kv.Key, vals);
            }
            return(d);
        }
Beispiel #3
0
        public IViewComponentResult Invoke(UniqueList <string> modules)
        {
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());
            modules.Add(nameof(PersonEditorViewComponent).ViewComponentName());

            return(View(new Models.GuardianEditorViewModel()));
        }
Beispiel #4
0
        /// <summary>
        /// The entry point of the program
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            UniqueList list = new UniqueList();
            try
            {
                list.Add(0, 1);
                list.Add(1, 1);
            }
            catch (EqualElementsException e)
            {
                Console.WriteLine(e);
            }
            try
            {
                list.Remove(2);
            }
            catch (NonexistentElementException e)
            {
                Console.WriteLine(e);
            }

            int counter = list.GetSize();
            Console.WriteLine("List: ");

            for (int i = 0; i < counter; ++i)
            {
                Console.Write(" " + list.Get(i));
            }
            Console.WriteLine();
        }
Beispiel #5
0
        public IViewComponentResult Invoke(UniqueList <string> modules)
        {
            modules.Add(nameof(DocumentEditorViewComponent).ViewComponentName());
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());

            return(View());
        }
Beispiel #6
0
        public IViewComponentResult Invoke(UniqueList <string> modules)
        {
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());
            modules.Add(nameof(DiagnosysEditorViewComponent).ViewComponentName());

            return(View(new PatientDiagnosys()));
        }
        public void AddOnlyUniqueItemsTest()
        {
            var list = new UniqueList <string>();

            list.Add("1");
            list.Add("1");
        }
Beispiel #8
0
        public IViewComponentResult Invoke(UniqueList <string> modules, CaseHistory history = null)
        {
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());
            modules.Add(nameof(CaseHistoryDiagnosysEditorViewComponent).ViewComponentName());
            modules.Add(nameof(CaseHistoryAdmissionEditorViewComponent).ViewComponentName());

            return(View(history ?? new CaseHistory()));
        }
Beispiel #9
0
            public void DuplicatePassedReturnsCountOne()
            {
                var uniqueList = new UniqueList <Card>();

                uniqueList.Add(Cards.AceOfClubs);
                uniqueList.Add(Cards.AceOfClubs);

                Assert.AreEqual(1, uniqueList.Count);
            }
        public IViewComponentResult Invoke(UniqueList <string> modules)
        {
            modules.Add(nameof(PhonesListViewComponent).ViewComponentName());
            modules.Add(nameof(EmailsListViewComponent).ViewComponentName());
            modules.Add(nameof(DocumentsListViewComponent).ViewComponentName());
            modules.Add(nameof(GuardiansListViewComponent).ViewComponentName());

            return(View());
        }
 public IViewComponentResult Invoke(UniqueList <string> modules)
 {
     modules.Add(nameof(SpecialtiesListViewComponent).ViewComponentName());
     modules.Add(nameof(SpecialtiesSelectorViewComponent).ViewComponentName());
     modules.Add(nameof(PhonesListViewComponent).ViewComponentName());
     modules.Add(nameof(EmailsListViewComponent).ViewComponentName());
     modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());
     return(View(new DepartmentsViewModel()));
 }
Beispiel #12
0
            public void ThreeUniqueItemsReturnsCountThree()
            {
                var uniqueList = new UniqueList <Card>();

                uniqueList.Add(Cards.AceOfClubs);
                uniqueList.Add(Cards.KingOfClubs);
                uniqueList.Add(Cards.JackOfClubs);

                Assert.AreEqual(3, uniqueList.Count);
            }
    static void Main(string[] args)
    {
        UniqueList <IntValue> list = new UniqueList <IntValue>();

        list.Add(new IntValue("Smile", 100));
        list.Add(new IntValue("Frown", 101));
        list.Add(new IntValue("Smile", 102));     // Error, key exists already
        int    x     = list["Smile"].Value;
        string frown = list[1].Name;
    }
        public void UniqueListForeach()
        {
            UniqueList <int> list = new UniqueList <int>();

            list.Add(1);
            list.Add(2);

            foreach (var item in list)
            {
                Console.WriteLine("item is " + item);
            }
        }
Beispiel #15
0
        public async Task <IViewComponentResult> InvokeAsync(UniqueList <string> modules)
        {
            modules.Add(nameof(PhonesListViewComponent).ViewComponentName());
            modules.Add(nameof(EmailsListViewComponent).ViewComponentName());
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());

            return(View(new HospitalsViewModel
            {
                Countries = await _countries.Get(),
                HospitalTypes = await _hospitalTypes.Get(),
                PropertyTypes = await _propertyTypes.Get()
            }));
        }
Beispiel #16
0
        private static void GetOrderedFlattenedBuildOnlyDependenciesInternal(Project.Configuration conf, UniqueList <Project.Configuration> dependencies)
        {
            if (!conf.IsFastBuild)
            {
                return;
            }

            IEnumerable <Project.Configuration> confDependencies = conf.BuildOrderDependencies;

            if (confDependencies.Contains(conf))
            {
                throw new Error("Cyclic dependency detected in project " + conf);
            }

            UniqueList <Project.Configuration> tmpDeps = new UniqueList <Project.Configuration>();

            foreach (var dep in confDependencies)
            {
                GetOrderedFlattenedBuildOnlyDependenciesInternal(dep, tmpDeps);
                tmpDeps.Add(dep);
            }
            foreach (var dep in tmpDeps)
            {
                if (dep.IsFastBuild && confDependencies.Contains(dep) && (conf != dep))
                {
                    dependencies.Add(dep);
                }
            }
        }
    private void Start()
    {
        TeamChanger teamChanger = new TeamChanger();

        UniqueList <IEventReceiver> receivers = new UniqueList <IEventReceiver>();

        receivers.Add(teamChanger);

        GameRecorder recorder = new GameRecorder();
        GameReplayer replayer = new GameReplayer(receivers);

        teamChanger.TeamName.Subscribe((newName) => Debug.Log(newName));

        TeamChangeEvent evt = new TeamChangeEvent(40, teamChanger.ID, "New team name");

        recorder.AddEvent(evt);

        string gameLog = recorder.CreateGameLog();

        replayer.Load(gameLog);

        replayer.Update(new Winch.UpdateInfo()
        {
            Time           = 40,
            TicksPerUpdate = 0.1f
        });
    }
Beispiel #18
0
        public override void LoadGame(Game game, Overlord overlord, XmlNode root)
        {
            XmlNode vars = root ["CustomVars"];

            UniqueList <string> existing = new UniqueList <string> ("Duplicate custom var {{}}");

            for (var i = 0; i < vars.ChildNodes.Count; i++)
            {
                XmlNode v = vars.ChildNodes [i];
                XmlAttributeCollection attrs = v.Attributes;
                string name = attrs ["name"].Value;

                existing.Add(name);

                CustomVar customVar = null;

                if (v.Name == "CustomArrayVar")
                {
                    string [] values = attrs ["values"].Value.Split(',');
                    customVar = new CustomArrayVar(name, values);
                }
                else
                {
                    string value = attrs ["value"].Value;
                    customVar = new CustomSingleVar(name, value);
                }

                game.CustomVars.Add(customVar);
            }
        }
Beispiel #19
0
        private void AddProduction(IProduction production)
        {
            _productions.Add(production);
            AddProductionToLeftHandSideLookup(production);

            if (production.IsEmpty)
            {
                _transativeNullableSymbols.Add(production.LeftHandSide);
            }

            var leftHandSide = production.LeftHandSide;
            var symbolPath   = _symbolPaths.AddOrGetExisting(leftHandSide);

            for (var s = 0; s < production.RightHandSide.Count; s++)
            {
                var symbol = production.RightHandSide[s];
                if (symbol.SymbolType == SymbolType.LexerRule)
                {
                    AddLexerRule(symbol as ILexerRule);
                }
                RegisterDottedRule(production, s);
                RegisterSymbolPath(production, symbolPath, s);
                RegisterSymbolInReverseLookup(production, symbol);
            }
            RegisterDottedRule(production, production.RightHandSide.Count);
        }
Beispiel #20
0
 private void FilterAddCandidate(Video candidate, UniqueList <Video> candidates)
 {
     if (candidate.TitleMatchRatio > Constants.MIN_ACCEPTABLE_TITLE_MATCH_PERCENTAGE && !candidates.Contains(candidate)) //TODO 003 replace by extension method: AddUnique(T)
     {
         candidates.Add(candidate);
     }
 }
Beispiel #21
0
        private void GenerateProjectReferences(
            IEnumerable <Project.Configuration> configurations,
            Resolver resolver,
            StreamWriter writer,
            Dictionary <Project.Configuration, Options.ExplicitOptions> optionsDictionary)
        {
            UniqueList <ProjectDependencyInfo> dependencies = new UniqueList <ProjectDependencyInfo>();

            foreach (var c in configurations)
            {
                foreach (var d in c.ConfigurationDependencies)
                {
                    ProjectDependencyInfo depInfo;
                    depInfo.ProjectFullFileNameWithExtension = d.ProjectFullFileNameWithExtension;
                    depInfo.ProjectGuid = d.ProjectGuid;
                    dependencies.Add(depInfo);
                }
            }

            if (dependencies.Count > 0)
            {
                Write(Template.Project.ItemGroupBegin, writer, resolver);
                var conf = configurations.ToList().First();
                foreach (var d in dependencies)
                {
                    string include = Util.PathGetRelative(conf.ProjectPath, d.ProjectFullFileNameWithExtension);
                    using (resolver.NewScopedParameter("include", include))
                        using (resolver.NewScopedParameter("projectGUID", d.ProjectGuid))
                        {
                            Write(Template.Project.ProjectReference, writer, resolver);
                        }
                }
                Write(Template.Project.ItemGroupEnd, writer, resolver);
            }
        }
        public void Add(TKey key, TValue amount)
        {
            int index = _mapping.Add(key);

            while (index >= _values.Count)
            {
                _values.Add(default);
Beispiel #23
0
        private void CollectFilesystem(Network network, FileInfo fileInfo)
        {
            if (!fileInfo.Exists)
            {
                return;
            }

            var apik = ApiKey.FromFile(network, fileInfo);

            if (apik == null)
            {
                return;
            }

            _keys.Add(apik);
        }
Beispiel #24
0
        private void FilterVolume(IReadOnlyDictionary <Network, IReadOnlyList <AssetPair> > pbn)
        {
            var r = new Dictionary <Network, IReadOnlyList <AssetPair> >();

            foreach (var kv in pbn)
            {
                var pairs = new UniqueList <AssetPair>();
                foreach (var pair in kv.Value)
                {
                    if (!VolumeCheck(kv.Key, pair))
                    {
                        continue;
                    }

                    pairs.Add(pair);
                }

                if (pairs.Any())
                {
                    r.Add(kv.Key, pairs);
                }
            }

            _dN.BuildData(r);
        }
 /// <summary>
 /// Adds a subscriber to this multicast channel.  Typically you would add a <see cref="BufferedChannel{T}"/> as the subscriber.
 /// </summary>
 public void Subscribe(ISender <T> channel)
 {
     lock (_gate)
     {
         _subscriptions.Add(channel);
     }
 }
Beispiel #26
0
        private static void GetOrderedFlattenedProjectDependenciesInternal(Project.Configuration conf, UniqueList <Project.Configuration> dependencies, bool allDependencies, bool fuDependencies)
        {
            if (!conf.IsFastBuild)
            {
                return;
            }

            var confDependencies = allDependencies ? conf.ResolvedDependencies : fuDependencies ? conf.ForceUsingDependencies : conf.ConfigurationDependencies;

            if (confDependencies.Contains(conf))
            {
                throw new Error("Cyclic dependency detected in project " + conf);
            }

            if (!allDependencies)
            {
                var tmpDeps = new UniqueList <Project.Configuration>();
                foreach (Project.Configuration dep in confDependencies)
                {
                    GetOrderedFlattenedProjectDependenciesInternal(dep, tmpDeps, true, fuDependencies);
                    tmpDeps.Add(dep);
                }
                foreach (Project.Configuration dep in tmpDeps)
                {
                    if (dep.IsFastBuild && confDependencies.Contains(dep) && (conf != dep))
                    {
                        dependencies.Add(dep);
                    }
                }
            }
            else
            {
                foreach (Project.Configuration dep in confDependencies)
                {
                    if (dependencies.Contains(dep))
                    {
                        continue;
                    }

                    GetOrderedFlattenedProjectDependenciesInternal(dep, dependencies, true, fuDependencies);
                    if (dep.IsFastBuild)
                    {
                        dependencies.Add(dep);
                    }
                }
            }
        }
Beispiel #27
0
 public void KursHinzufügen(PosKurs kurs)
 {
     if (__abfahrten == null)
     {
         __abfahrten = new UniqueList <PosKurs, int>(k => k.ObjectId);
     }
     __abfahrten.Add(kurs);
 }
        public void UniqueListAdd()
        {
            UniqueList <int> list = new UniqueList <int>();

            Assert.That(list.Count, Is.EqualTo(0));
            list.Add(10);
            Assert.That(list.Count, Is.EqualTo(1));
        }
        public void UniqueListRemove()
        {
            UniqueList <int> list = new UniqueList <int>();

            Assert.That(list.Remove(10), Is.False);
            list.Add(10);
            Assert.That(list.Remove(10), Is.True);
        }
        public async Task <IViewComponentResult> InvokeAsync(UniqueList <string> modules)
        {
            modules.Add(nameof(ConfirmationDialogViewComponent).ViewComponentName());

            return(View(new DoctorPositionEditorViewModel
            {
                Positions = await _positions.Get()
            }));
        }
Beispiel #31
0
        public async Task <IViewComponentResult> InvokeAsync(UniqueList <string> modules)
        {
            modules.Add(nameof(PersonEditorViewComponent).ViewComponentName());

            return(View(new PatientSearchViewModel
            {
                Regions = await _repository.Get()
            }));
        }
Beispiel #32
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     string selectedKeysString = GetUnsecureInput<string>("SelectedValues");
     UniqueList<CKeyNLR> selectedContents = new UniqueList<CKeyNLR>();
     foreach (string keyString in selectedKeysString.Split('|')) {
         if (keyString != null && keyString.Length > 0) selectedContents.Add(new CKeyNLR(keyString));
     }
     WMContentTreeView.SetDefaultSelectedContents(selectedContents, RelHierarchical.RelationId, Session.CompleteKeyC(Session.SiteId), false);
     WMCreateContent diag = new WMCreateContent(0, false);
     return new NextCall(diag, onComplete);
 }
Beispiel #33
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     MemDefContentClass baseClassDef = WAFRuntime.Definitions.ContentClass[DiscountBase.ContentClassId];
     UniqueList<int> classesToInclude = new UniqueList<int>();
     foreach (int classId in baseClassDef.AllDescendantsIncThis) {
         if (classId != DiscountBase.ContentClassId) {
             classesToInclude.Add(classId);
         }
     }
     WMCreateContent d = new WMCreateContent(classesToInclude, false, false);
     return new NextCall(d, onComplete);
 }
Beispiel #34
0
 public override void Decode()
 {
     MemoryStream stream = new MemoryStream(Data);
     BinaryReader reader = new BinaryReader(stream);
     TotalOccurance = reader.ReadInt32();
     NumStrings = reader.ReadInt32();
     StringList = new UniqueList<string>(NumStrings);
     RichTextFormatting = new RichTextFormat[NumStrings];
     StringDecoder stringDecoder = new StringDecoder(this, reader);
     for (int i = 0; i < NumStrings; i++)
     {
         StringList.Add(stringDecoder.ReadString(16, out RichTextFormatting[i]));
     }
 }
Beispiel #35
0
        public void TestValueTypeAddInsert()
        {
            IList<int> uniqueList = new UniqueList<int>();
            uniqueList.Add(1);
            uniqueList.Add(2);
            uniqueList.Add(3);
            uniqueList.Add(3);
            uniqueList.Add(2);
            uniqueList.Add(1);

            Assert.AreEqual(3, uniqueList.Count);

            uniqueList.Insert(0, 1);
            uniqueList.Insert(0, 2);
            uniqueList.Insert(0, 3);

            Assert.AreEqual(3, uniqueList.Count);
        }
Beispiel #36
0
        public void TestReferenceTypeAddInsert()
        {
            IList<string> uniqueList = new UniqueList<string>();
            uniqueList.Add(null);
            uniqueList.Add("x");
            uniqueList.Add("X");

            Assert.AreEqual(3, uniqueList.Count);

            uniqueList.Add(null);
            uniqueList.Add("x");
            uniqueList.Add("X");

            Assert.AreEqual(3, uniqueList.Count);

            uniqueList.Insert(0, null);
            uniqueList.Insert(0, "x");
            uniqueList.Insert(0, "X");

            Assert.AreEqual(3, uniqueList.Count);
        }
Beispiel #37
0
 UniqueList<MemDefContentClass> getClassList()
 {
     DialogueMasterPage master = (DialogueMasterPage)this.Master;
     UniqueList<int> classIds = null;
     UniqueList<int> classIds2 = new UniqueList<int>();
     UniqueList<MemDefContentClass> contDefList;
     if (master.Exchange.DialogueParameters.ContainsKey("ClassIds")) {
         contDefList = new UniqueList<MemDefContentClass>();
         classIds = (UniqueList<int>)master.Exchange.DialogueParameters["ClassIds"];
         foreach (int id in classIds) {
             foreach (int id2 in WAFContext.Engine.Definition.ContentClass[id].AllDescendantsIncThis) {
                 if (!classIds2.Contains(id2)) {
                     classIds2.Add(id2);
                     contDefList.Add(WAFContext.Engine.Definition.ContentClass[id2]);
                 }
             }
         }
         classIds = classIds2;
     } else {
         contDefList = new UniqueList<MemDefContentClass>();
         foreach (MemDefContentClass classDef in WAFContext.Engine.Definition.ContentClass.Values) contDefList.Add(classDef);
     }
     return contDefList;
 }
Beispiel #38
0
 void addFiles(UniqueList<string> files, string folderPath, string[] excludes)
 {
     foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) {
         if (!files.Contains(file)) files.Add(file);
     }
     foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) {
         bool exclude = false;
         foreach (string e in excludes) {
             if (subFolder.StartsWith(e, StringComparison.OrdinalIgnoreCase)) {
                 exclude = true;
                 break;
             }
         }
         if (!exclude) addFiles(files, subFolder, excludes);
     }
 }
Beispiel #39
0
 void addFiles(UniqueList<string> files, string folderPath, string exclude, string searchPattern)
 {
     foreach (string p in searchPattern.Split(';')) {
         foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath, p.Trim(), SearchOption.TopDirectoryOnly)) {
             if (!files.Contains(file)) files.Add(file);
         }
     }
     foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) {
         if (!subFolder.StartsWith(exclude, StringComparison.OrdinalIgnoreCase)) {
             addFiles(files, subFolder, exclude, searchPattern);
         }
     }
 }
Beispiel #40
0
 void addFiles(UniqueList<string> files, string folderPath, string exclude)
 {
     foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) {
         if (!files.Contains(file)) files.Add(file);
     }
     foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) {
         if (!subFolder.StartsWith(exclude, StringComparison.OrdinalIgnoreCase)) {
             addFiles(files, subFolder, exclude);
         }
     }
 }
Beispiel #41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _key = WebDialogueContext.GetDialogueParameter<CKeyNLR>("ContentKey", null);
        _classIds = WebDialogueContext.GetDialogueParameter<UniqueList<int>>("ClassIds", null);
        _selectionMode = WebDialogueContext.GetDialogueParameter<ListSelectionMode>("SelectionMode", ListSelectionMode.Multiple);

        // add all inherited classes aswell:
        UniqueList<int> newClassIds = new UniqueList<int>();
        foreach (int id in _classIds) {
            MemDefContentClass clDef = WAFRuntime.Definitions.ContentClass[id];
            foreach (int id2 in clDef.AllDescendantsIncThis) {
                if (!newClassIds.Contains(id2)) newClassIds.Add(id2);
            }
        }
        _classIds = newClassIds;

        MainButton mb = new MainButton();

        mb.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnOk");
        mb.Click += new EventHandler(mb_Click);
        Controls.Add(mb);
        WebDialogueContext.AddDialogueButton(mb);
        _paths = new List<PropertyPath>();
        WMSelectFileToEditor.RetrieveAllRelevantPaths(WAFContext.Session.GetContent(_key), _paths, _classIds);
        _values = new List<FilePropertyValue>();
        _selectedIndexes = new UniqueList<int>();
        int n = 0;
        foreach (PropertyPath p in _paths) {
            _values.Add(WAFContext.Session.GetProperty<FilePropertyValue>(p));
            if (Request["chk" + n] != null) _selectedIndexes.Add(n);
            n++;
        }
        if (_values.Count == 0) {
           WebDialogueContext.Session.Notify(Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentNotifyThereAreNoFile"), Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentYouMustUploadAFile"));
            WebDialogueContext.SendResult(new List<PropertyPath>());
        }
        if (n > 3) {
            MainButton btnCheckAll = new MainButton();
            btnCheckAll.Click += new EventHandler(btnCheckAll_Click);

            btnCheckAll.Text = Local.Text("Web.WAF.Dialogues.Main.SelectFileFromContentBtnCheckAll");
            Controls.Add(btnCheckAll);
            WebDialogueContext.AddDialogueButton(btnCheckAll);
        }
    }
Beispiel #42
0
    void refreshTabs()
    {
        tabbedView.Visible = true;
        CKeyNLR selected = null;
        _currentUser = null;
        if (userList.GetSelectedCount() > 0) {
            selected = userList.GetSelectedKeys().GetFirst();
            if (WAFContext.Session.NodeExists(selected.NodeId, true, true)) {
                _currentUser = WAFContext.Session.GetContent<SystemUser>(selected);
            } else {
                selected = null;
                cntFrm.Content = null;
                userList.ClearFlaggedValues();
            }
        }
        if (selected == null) { tabbedView.Visible = false; return; }

        // Details
        if (cntFrm.Content == null || cntFrm.Content.RootContent.Key.lKey != _currentUser.Key.lKey) {
            cntFrm.Content = _currentUser;
        }

        // Effective memberships
        AqlQuery qm = WAFContext.Session.CreateQuery();
        qm.From<UserGroup>();
        qm.Select<UserGroup>();
        qm.Select(AqlUserGroup.NodeId);

        UniqueList<int> allGroupMembersShips;
        try {
            allGroupMembersShips = _currentUser.GetAllMembershipsById();
        } catch (CircularReferenceException error) {
            WAFContext.Session.Notify(error);
            allGroupMembersShips = new UniqueList<int>(-1);
        }
        qm.Where(Aql.In(AqlUserGroup.NodeId, allGroupMembersShips));
        listMemberships.Query = qm;

        // Effective permissions
        AqlQuery qp = WAFContext.Session.CreateQuery();
        qp.From<ContentBase>();
        qp.Select<ContentBase>();
        if (!_currentUser.IsAdmin) {
            AqlExpressionBuilder ex = new AqlExpressionBuilder();
            UniqueList<int> ms = new UniqueList<int>(allGroupMembersShips);
            ms.Add((int)SystemUserGroupType.AllUsers);
            ms.Add((int)SystemUserGroupType.Anonymous);
            AqlPropertyInteger prop = null;
            switch (rblPermissions.SelectedValue) {
                case "Read": prop = AqlContent.ReadGroupId; break;
                case "Edit": prop = AqlContent.EditGroupId; break;
                case "Publish": prop = AqlContent.PublishGroupId; break;
                default: break;
            }
            qp.Where(Aql.In(prop, ms));
        }
        listPermissions.Query = qp;

        // Relevant content
        AqlQuery qr = WAFContext.Session.CreateQuery();
        qr.From<ContentBase>();
        qr.Select<ContentBase>();
        qr.Select(AqlContent.NodeId);
        qr.IncludeUnpublished = true;
        qr.Where(
            (AqlContent.AuthorId == _currentUser.NodeId)
            | (AqlContent.CreatedById == _currentUser.NodeId)
            | (AqlContent.PublicationApprovedById == _currentUser.NodeId)
            | (AqlContent.ChangedById == _currentUser.NodeId
        ));
        listRelevant.Query = qr;
    }
Beispiel #43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DialogueMasterPage master = (DialogueMasterPage)this.Master;
        if (master.Exchange == null) return;
        contentTree.RelationId = AqlRelFilefolders.Relation.RelationId;

        List<FileLibrary> libs = WAFContext.Session.GetContents<FileLibrary>();
        if (libs.Count == 0) {
            FileLibrary newlib = WAFContext.Session.NewContent<FileLibrary>();
            newlib.UpdateChanges();
            newlib.Name = "Library";
            contentTree.RootKey = newlib.Key;
        } else {
            contentTree.RootKey = new UniqueList<FileLibrary>(libs).GetFirst().Key;
        }

        UniqueList<int> classIds = null;
        UniqueList<int> classIds2 = new UniqueList<int>();
        UniqueList<MemDefContentClass> contDefList;
        if (master.Exchange.DialogueParameters.ContainsKey("ClassIds")) {
            contDefList = new UniqueList<MemDefContentClass>();
            classIds = (UniqueList<int>)master.Exchange.DialogueParameters["ClassIds"];
            foreach (int id in classIds) {
                foreach (int id2 in WAFContext.Engine.Definition.ContentClass[id].AllDescendantsIncThis) {
                    if (!classIds2.Contains(id2)) {
                        classIds2.Add(id2);
                        contDefList.Add(WAFContext.Engine.Definition.ContentClass[id2]);
                    }
                }
            }
            classIds = classIds2;
        } else {
            contDefList = new UniqueList<MemDefContentClass>();
            foreach (MemDefContentClass classDef in WAFContext.Engine.Definition.ContentClass.Values) contDefList.Add(classDef);
        }

        if (!IsPostBack) {
            updateTypeList();
            txtSearch.Text = (string)master.Exchange.DialogueParameters["SearchString"];

            if (master.Exchange.DialogueParameters.ContainsKey("ViewMode")) {
                contentList.ViewMode = (ListViewOptions)master.Exchange.DialogueParameters["ViewMode"];
                chkThumbnails.Checked = contentList.ViewMode == ListViewOptions.Thumbnails;
            }

            //chkFilter.Checked = txtSearch.Text.Length > 0;
            chkTreeview_CheckedChanged(null, null);
            chkFilter_CheckedChanged(null, null);
            //foreach (MemDefRelation rel in WAFContext.Session.Definitions.Relation.Values) {
            //    ListItem item = new ListItem(rel.GetName(WAFContext.Session), rel.Id.ToString());
            //    lstTreeviewRelation.Items.Add(item);
            //}

        }
        if (contentList.ViewMode != ListViewOptions.List) {
            contentList.ViewMode = chkThumbnails.Checked ? ListViewOptions.Thumbnails : ListViewOptions.Details;
        }
        int nodeId = 0;
        if (int.TryParse(txtSearch.Text + "", out nodeId)) {
            if (WAFContext.Session.NodeExists(nodeId, true, true)) {
                UniqueList<CKeyNLRC> result = new UniqueList<CKeyNLRC>();
                result.Add(WAFContext.Session.GetContent(nodeId).Key);
                master.SendResult(result);
                Response.End();
            }
        }

        AqlQuery query = WAFContext.Session.CreateQuery();
        AqlAliasContentBase alias;
        int selectedFolderId = -1;
        if (chkTreeview.Checked) {
            AqlAliasFileFolder parent = new AqlAliasFileFolder();
            parent.AssignNoneAliasFields = false;
            alias = new AqlAliasContentFile();
            AqlAliasRelation relation = new AqlAliasRelation(parent, alias, AqlRelFolderFiles.Relation);
            query.From(relation);
            if (contentTree.GetSelectedCount() > 0) {
                selectedFolderId = new CKeyNLR(contentTree.GetSelectedValues().GetFirst()).NodeId;
            }
            query.Where(parent.NodeId == selectedFolderId);
        } else {
            alias = new AqlAliasContentBase(0);
            query.From(alias);
        }
        query.Select(alias);
        query.Select(alias.Name, "Name");
        query.Select(alias.ChangeDate, "ChangedDate");
        query.OrderBy(alias.Name);
        if (master.Exchange != null) {
            if (master.Exchange.DialogueParameters.ContainsKey("WhereExpression")) {
                AqlExpressionBoolean where = (AqlExpressionBoolean)master.Exchange.DialogueParameters["WhereExpression"];
                if (((object)where) != null) query.Where(where);
            }
        }
        int classId = 0;

        if (int.TryParse(ddlFilter.SelectedValue, out classId)) { // if selected
            //query.Where(AqlContent.ContentClassId == classId);
            query.Where(Aql.In(alias.ContentClassId, WAFContext.Session.Definitions.ContentClass[classId].AllDescendantsIncThis));
        } else { // if not, return all in list or omit if no class is specified to dialogue
            if (classIds != null) query.Where(Aql.In(alias.ContentClassId, classIds));
        }
        if (chkHideOtherLangs.Checked) {
            query.Where(alias.IsDerived == false);
        }
        if (txtSearch.Text.Length > 0) {
            if (int.TryParse(txtSearch.Text, out nodeId)) {
                query.Where(alias.NodeId == nodeId);
            } else {
                query.Where(Aql.Like(alias.Name, "*" + txtSearch.Text + "*"));
            }
        }
        contentList.Query = (query);

        if (!IsPostBack) {
            query.RetrieveTotalCount = true;
            query.PageSize = contentList.PageSize;
        }

        btnNewFolder.AddInputParameters("ChooseHierarchyPosition", false);
        btnNewFolder.AddInputParameters("EditAfterCreate", true);
        btnNewFolder.AddInputParameters("EditInNewWindow", true);
        btnNewFolder.AddInputParameters("ClassIds", WAFContext.Engine.Definition.ContentClass[FileFolder.ContentClassId].AllDescendantsIncThis.ToList());

        btnNewContent.AddInputParameters("ChooseHierarchyPosition", false);
        btnNewContent.AddInputParameters("EditAfterCreate", true);
        btnNewContent.AddInputParameters("EditInNewWindow", true);
        btnNewContent.AddInputParameters("ClassIds", classIds);

        bool fileUpload = (bool)master.Exchange.DialogueParameters["FileUpload"];
        if (fileUpload) {
            btnUpload.AddInputParameters("ParentFolderNodeId", selectedFolderId);
            btnUpload.AddInputParameters("FileUploadType", FileUploadType.ContentFileUpload);
            btnUpload.AddInputParameters("Multiple", true);
            btnUploadArchive.WorkflowType = typeof(WAF.Engine.Workflow.FileUpload);
            btnUploadArchive.AddInputParameters("ParentFolderNodeId", selectedFolderId);
            btnUploadArchive.AddInputParameters("FileUploadType", FileUploadType.ContentFileUploadZipped);
            btnUploadArchive.AddInputParameters("Multiple", false);
        }

        master.AddDialogueButton(btnSelect);
        // contentTree.PersistenceKey = "Tree";
    }
Beispiel #44
0
 void buildFileList(string folder, UniqueList<string> files)
 {
     foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folder)) {
         if (WFContext.BreakExecution) throw new WDCancelException();
         buildFileList(subFolder, files);
     }
     foreach (string file in WAFRuntime.FileSystem.GetFiles(folder)) {
         if (WFContext.BreakExecution) throw new WDCancelException();
         WFContext.Description = "Adding file " + files.Count + "...";
         files.Add(file);
     }
 }
Beispiel #45
0
    void btnAll_Click(object sender, EventArgs e)
    {
        ensureListDataBind();
        AqlQuery q = getQuery(true);

        // Select
        var rNodeId = q.Select(AqlContent.NodeId);
        var rLcid = q.Select(AqlContent.LCID);
        var rRev = q.Select(AqlContent.Revision);
        //var n = q.Select(AqlContent.ContentClassId);

        q.PageIndex = 0;
        q.PageSize = 0;

        // q.OrderBy(AqlContent.Name);
        UniqueList<CKeyNLR> keys = new UniqueList<CKeyNLR>();
        var rs = q.Execute();
        while (rs.Read()) {
            keys.Add(new CKeyNLR(rNodeId.Value, rLcid.Value, rRev.Value));
        }
        WebDialogueContext.SendResult(keys);
    }
Beispiel #46
0
 void btnCheckAll_Click(object sender, EventArgs e)
 {
     _selectedIndexes = new UniqueList<int>();
     int n = 0;
     foreach (FilePropertyValue f in _values) _selectedIndexes.Add(n++);
 }
Beispiel #47
0
 void addFiles(UniqueList<string> files, string folderPath)
 {
     foreach (string file in WAFRuntime.FileSystem.GetFiles(folderPath)) {
         if (!files.Contains(file)) files.Add(file);
     }
     foreach (string subFolder in WAFRuntime.FileSystem.GetDirectories(folderPath)) {
         addFiles(files, subFolder);
     }
 }
Beispiel #48
0
 void list_DblClick(object sender, EventArgs e)
 {
     ContentList list = null;
     switch (tabs.SelectedTabId) {
         case "local": list = ctlLocal; break;
         case "system": list = ctlSystem; break;
         case "internal": list = ctlInternal; break;
         default: break;
     }
     if (list.GetSelectedCount() > 1) {
         UniqueList<int> lst = new UniqueList<int>();
         foreach (string value in list.GetSelectedValues()) lst.Add(int.Parse(value));
         WebDialogueContext.SendResult(lst);
     } else if (list.GetSelectedCount() > 0) {
         WebDialogueContext.SendResult(int.Parse(list.GetSelectedValues().GetFirst()));
     } else {
         WAFContext.Session.Notify(DialogueIcon.Warning, "Please select type");
     }
 }
Beispiel #49
0
 protected void btnSelect_OnClick(object source, EventArgs e)
 {
     DialogueMasterPage master = (DialogueMasterPage)this.Master;
     UniqueList<CKeyNLRC> result = new UniqueList<CKeyNLRC>();
     foreach (string value in contentList.GetSelectedValues()) {
         result.Add(WAFContext.Session.GetContent<ContentBase>(new CKeyNLR(value)).Key);
     }
     master.SendResult(result);
 }
Beispiel #50
0
 public override UniqueList<string> GetSelectedValues()
 {
     UniqueList<string> selected = base.GetSelectedValues();
     UniqueList<string> newSelected = new UniqueList<string>();
     foreach (string s in selected) {
         string v = s;
         if (v.StartsWith("[ROOT]")) v = v.Substring("[ROOT]".Length);
         newSelected.Add(v);
     }
     return newSelected;
 }