Ejemplo n.º 1
0
 private void AddRecord()
 {
     records[lastRecord].scopeCount = lastScopes;
     lastRecord++;
     if (lastRecord == records.Length)
     {
         ScopeRecord[] newRecords = new ScopeRecord[lastRecord * 2];
         Array.Copy(records, 0, newRecords, 0, lastRecord);
         records = newRecords;
     }
     lastScopes = 0;
 }
Ejemplo n.º 2
0
 private void AddRecord()
 {
     // Store cached fields:
     _records[_lastRecord].scopeCount = _lastScopes;
     // Extend record buffer:
     if (++_lastRecord == _records.Length)
     {
         ScopeRecord[] newRecords = new ScopeRecord[_lastRecord * 2];
         Array.Copy(_records, newRecords, _lastRecord);
         _records = newRecords;
     }
     // reset scope count:
     _lastScopes = 0;
 }
Ejemplo n.º 3
0
 private void AddRecord()
 {
     // Store cached fields:
     records[lastRecord].scopeCount = lastScopes;
     // Extend record buffer:
     if (++lastRecord == records.Length)
     {
         ScopeRecord[] newRecords = new ScopeRecord[lastRecord * 2];
         Array.Copy(records, 0, newRecords, 0, lastRecord);
         records = newRecords;
     }
     // reset scope count:
     lastScopes = 0;
 }
        public void TestCreateAsync()
        {
            Scope record = new Scope()
            {
                Name = "SCOPENAME:" + 0
            };
            ScopeRecord scopeRecord = new ScopeRecord(new ScopeHandle(record));
            Guid        id          = scopeRecord.Id;
            var         result      = _scopeStore.RetrieveAsync(id);

            scopeRecord = new ScopeRecord(result.Result);


            Assert.AreEqual(scopeRecord.Id, id);
        }
        private void AddRecord(string ncName, string uri, V value)
        {
            Debug.Assert(uri != null);

            records[lastRecord].scopeCount = lastScopes;
            if (++lastRecord == records.Length)
            {
                ScopeRecord[] newRecords = new ScopeRecord[lastRecord * 2];
                Array.Copy(records, 0, newRecords, 0, lastRecord);
                records = newRecords;
            }
            lastScopes = 0;

            records[lastRecord].ncName = ncName;
            records[lastRecord].nsUri  = uri;
            records[lastRecord].value  = value;
        }
        public void TestUpdateAsync()
        {
            Scope record = new Scope()
            {
                Name = "SCOPENAME:" + 0
            };
            ScopeRecord scopeRecord = new ScopeRecord(new ScopeHandle(record));
            Guid        id          = scopeRecord.Id;
            var         result      = _scopeStore.RetrieveAsync(id);

            scopeRecord = new ScopeRecord(result.Result);
            string testData = Guid.NewGuid().ToString();

            scopeRecord.Record.ClaimsRule = testData;

            _scopeStore.UpdateAsync(scopeRecord.Record);
            result = _scopeStore.RetrieveAsync(id);

            Assert.AreEqual(testData, result.Result.ClaimsRule);
        }
        public static List <ScopeRecord> InsertTestData(ScopeStore store, int count = 1)
        {
            List <ScopeRecord> scopeRecords = new List <ScopeRecord>();

            for (int i = 0; i < count; ++i)
            {
                Scope record = new Scope()
                {
                    Name = "SCOPENAME:" + i,
                    AllowUnrestrictedIntrospection = true,
                    Claims = new List <ScopeClaim>
                    {
                        new ScopeClaim()
                        {
                            AlwaysIncludeInIdToken = true,
                            Description            = "SCOPECLAIMDESCRIPTION:" + i,
                            Name = "SCOPECLAIMNAME:" + i
                        }
                    },
                    ClaimsRule              = "CLAIMSRULE:" + i,
                    Description             = "CLAIMSRULE:" + i,
                    DisplayName             = "DISPLAYNAME:" + i,
                    Emphasize               = true,
                    Enabled                 = true,
                    IncludeAllClaimsForUser = true,
                    Required                = true,
                    ScopeSecrets            = new List <Secret>()
                    {
                        new Secret("SECRET:" + i), new Secret("SECRET:" + i)
                    },
                    ShowInDiscoveryDocument = (i % 2 == 1)
                };
                var scopeRecord = new ScopeRecord(new ScopeHandle(record));
                store.CreateAsync(scopeRecord.Record);
                scopeRecords.Add(scopeRecord);
            }
            return(scopeRecords);
        }
Ejemplo n.º 8
0
        protected virtual void AddNewRecords()
        {
            ArrayList newRecordList = new ArrayList();

            System.Collections.Generic.List<Hashtable> newUIDataList = new System.Collections.Generic.List<Hashtable>();
            // Loop though all the record controls and if the record control
            // does not have a unique record id set, then create a record
            // and add to the list.
            if (!this.ResetData)
            {
            System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "ScopeTableControlRepeater"));
            if (rep == null){return;}

            foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
            {
            // Loop through all rows in the table, set its DataSource and call DataBind().
            ScopeTableControlRow recControl = (ScopeTableControlRow)(repItem.FindControl("ScopeTableControlRow"));

                    if (recControl.Visible && recControl.IsNewRecord) {
                      ScopeRecord rec = new ScopeRecord();

                        if (recControl.ScopeDescription.Text != "") {
                            rec.Parse(recControl.ScopeDescription.Text, ScopeTable.ScopeDescription);
                  }

                        if (recControl.ScopeGlobal.Text != "") {
                            rec.Parse(recControl.ScopeGlobal.Text, ScopeTable.ScopeGlobal);
                  }

                        if (recControl.ScopeName.Text != "") {
                            rec.Parse(recControl.ScopeName.Text, ScopeTable.ScopeName);
                  }

                        if (recControl.ScopePricePerUOM.Text != "") {
                            rec.Parse(recControl.ScopePricePerUOM.Text, ScopeTable.ScopePricePerUOM);
                  }

                        if (recControl.Status1.Text != "") {
                            rec.Parse(recControl.Status1.Text, ScopeTable.Status);
                  }

                        newUIDataList.Add(recControl.PreservedUIData());
                        newRecordList.Add(rec);
                    }
                }
            }

            // Add any new record to the list.
            for (int count = 1; count <= this.AddNewRecord; count++) {

                newRecordList.Insert(0, new ScopeRecord());
                newUIDataList.Insert(0, new Hashtable());

            }
            this.AddNewRecord = 0;

            // Finally, add any new records to the DataSource.
            if (newRecordList.Count > 0) {

                ArrayList finalList = new ArrayList(this.DataSource);
                finalList.InsertRange(0, newRecordList);

                Type myrec = typeof(FPCEstimate.Business.ScopeRecord);
                this.DataSource = (ScopeRecord[])(finalList.ToArray(myrec));

            }

            // Add the existing UI data to this hash table
            if (newUIDataList.Count > 0)
                this.UIData.InsertRange(0, newUIDataList);
        }
Ejemplo n.º 9
0
 private static ScopeFlags GetName(ref ScopeRecord re, out string?prefix, out string?nsUri)
 {
     prefix = re.ncName;
     nsUri  = re.nsUri;
     return(re.flags);
 }
Ejemplo n.º 10
0
 private void AddRecord() {
     records[lastRecord].scopeCount = lastScopes;
     lastRecord ++;
     if (lastRecord == records.Length) {
         ScopeRecord[] newRecords = new ScopeRecord[lastRecord * 2];
         Array.Copy(records, 0, newRecords, 0, lastRecord);
         records = newRecords;
     }
     lastScopes = 0;
 }