Exemple #1
0
        static public VALUE_TYPE Lookup <P1, P2, P3, P4, VALUE_TYPE>(this LookupSet <Tuple <P1, P2, P3, P4>, VALUE_TYPE> item, P1 p1, P2 p2, P3 p3, P4 p4)
        {
            VALUE_TYPE value;

            item.TryLookup(p1, p2, p3, p4, out value);
            return(value);
        }
Exemple #2
0
        static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> > fallbacks)
        {
            VALUE_TYPE value;

            item.TryLookup(key, out value, fallbacks);
            return(value);
        }
Exemple #3
0
        static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, IEnumerable <KEY_TYPE> keys)
        {
            VALUE_TYPE value;

            item.TryLookup(out value, keys);
            return(value);
        }
Exemple #4
0
        public async Task <int> CreateLookupSetAsync(LookupSetItemViewModel lookupSet)
        {
            _sharedService.WriteLogs("CreateLookupSetAsync started by:" + _userSettings.UserName, true);

            try
            {
                var _lookupSet = new LookupSet();

                _lookupSet.LookupName   = lookupSet.LookupName;
                _lookupSet.YearId       = lookupSet.YearId;
                _lookupSet.CreatedDate  = DateTime.Now;
                _lookupSet.CreatedBy    = _userSettings.UserName;
                _lookupSet.ModifiedDate = DateTime.Now;
                _lookupSet.ModifiedBy   = _userSettings.UserName;

                await _lookupSetRepository.AddAsync(_lookupSet);

                return(_lookupSet.Id);
            }
            catch (Exception ex)
            {
                _sharedService.WriteLogs("CreateLookupSetAsync failed:" + ex.Message, false);
                return(0);
            }
        }
Exemple #5
0
        static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key)
        {
            VALUE_TYPE value;

            item.TryLookup(key, out value);
            return(value);
        }
Exemple #6
0
        static public VALUE_TYPE Lookup <P1, P2, VALUE_TYPE>(this LookupSet <Tuple <P1, P2>, VALUE_TYPE> item, P1 p1, P2 p2)
        {
            VALUE_TYPE value;

            item.TryLookup(p1, p2, out value);
            return(value);
        }
Exemple #7
0
        public override global::System.Data.DataSet Clone()
        {
            LookupSet cln = ((LookupSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemple #8
0
 static public bool LoadAsConfigurationInto(this LookupSet <string, string> item, object target, bool strict = false)
 {
     return(target.GetFilteredInstanceFields(
                Filterer_FieldInfo.HasCustomAttributeOfType <ConfigurationVariableAttribute>()
                ).ProcessAND(
                f => f.GetCustomAttributeOfType <ConfigurationVariableAttribute>(false).TryHydrateSetting(item, target, f, strict)
                ));
 }
Exemple #9
0
        static public bool IsNot <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, VALUE_TYPE value)
        {
            if (item.Is(key, value) == false)
            {
                return(true);
            }

            return(false);
        }
Exemple #10
0
        static public bool IsFalse <KEY_TYPE>(this LookupSet <KEY_TYPE, string> item, KEY_TYPE key)
        {
            if (item.IsTrue(key) == false)
            {
                return(true);
            }

            return(false);
        }
Exemple #11
0
        static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, VALUE_TYPE default_value, IEnumerable <KEY_TYPE> keys)
        {
            VALUE_TYPE value;

            if (item.TryLookup(out value, keys))
            {
                return(value);
            }

            return(default_value);
        }
Exemple #12
0
        static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, VALUE_TYPE default_value)
        {
            VALUE_TYPE value;

            if (item.TryLookup(key, out value))
            {
                return(value);
            }

            return(default_value);
        }
Exemple #13
0
        static public bool TryLookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, out VALUE_TYPE value, IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> > fallbacks)
        {
            if (item != null)
            {
                if (item.TryLookup(key, out value))
                {
                    return(true);
                }
            }

            return(fallbacks.TryLookup(key, out value));
        }
Exemple #14
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            LookupSet ds = new LookupSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Exemple #15
0
        static public bool Has <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> > fallbacks)
        {
            if (item != null)
            {
                if (item.Has(key))
                {
                    return(true);
                }
            }

            return(fallbacks.Has(key));
        }
Exemple #16
0
        public bool TryHydrateSetting(LookupSet <string, string> settings, object target, FieldInfo field, bool strict = false)
        {
            return(string_option.TryUseOptionString(settings, delegate(string option_string) {
                object option_value;

                if (TryHydrateSettingInternal(option_string, field.FieldType, out option_value))
                {
                    field.SetValue(target, option_value);
                    return true;
                }

                return false;
            }, strict));
        }
Exemple #17
0
        protected override bool TryUseOptionStringInternal(LookupSet <string, string> settings, Operation <bool, string> operation)
        {
            string option_value = settings.Lookup(default_value, GetAllNames());

            if (ValidateOptionString(option_value))
            {
                if (operation.Execute(option_value))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #18
0
        public bool TryUseOptionString(LookupSet <string, string> settings, Operation <bool, string> operation, bool strict = false)
        {
            if (TryUseOptionStringInternal(settings, operation))
            {
                return(true);
            }

            if (strict)
            {
                throw new StringOptionException("Unable to use option: " + this);
            }

            return(false);
        }
Exemple #19
0
        static public bool TryLookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, out VALUE_TYPE value, IEnumerable <KEY_TYPE> keys)
        {
            if (keys != null)
            {
                foreach (KEY_TYPE key in keys)
                {
                    if (item.TryLookup(key, out value))
                    {
                        return(true);
                    }
                }
            }

            value = default(VALUE_TYPE);
            return(false);
        }
Exemple #20
0
 public BackedSet(LookupSet <KEY_TYPE, VALUE_TYPE> m, IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> > f)
 {
     main_set      = m;
     fallback_sets = f.ToList();
 }
Exemple #21
0
 static public T Convert <KEY_TYPE, VALUE_TYPE, T>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, Operation <T, VALUE_TYPE> operation)
 {
     return(operation.Execute(item.Lookup(key)));
 }
Exemple #22
0
 static public LookupSet <KEY_TYPE, OUTPUT_TYPE> ConvertSet <KEY_TYPE, INPUT_TYPE, OUTPUT_TYPE>(this LookupSet <KEY_TYPE, INPUT_TYPE> item, Operation <OUTPUT_TYPE, INPUT_TYPE> operation)
 {
     return(new LookupSetValueConverter <KEY_TYPE, INPUT_TYPE, OUTPUT_TYPE>(item, operation));
 }
Exemple #23
0
 static public LookupSet <KEY_TYPE, OUTPUT_TYPE> ConvertSet <KEY_TYPE, INPUT_TYPE, OUTPUT_TYPE>(this LookupSet <KEY_TYPE, INPUT_TYPE> item)
 {
     return(new LookupSetValueTypeConverter <KEY_TYPE, INPUT_TYPE, OUTPUT_TYPE>(item));
 }
Exemple #24
0
 public LookupSetValueTypeConverter(LookupSet <KEY_TYPE, INPUT_TYPE> s)
 {
     set = s;
 }
Exemple #25
0
 static public VALUE_TYPE Lookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, params LookupSet <KEY_TYPE, VALUE_TYPE>[] fallbacks)
 {
     return(item.Lookup(key, (IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> >)fallbacks));
 }
Exemple #26
0
 static public bool TryLookup <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, KEY_TYPE key, out VALUE_TYPE value, params LookupSet <KEY_TYPE, VALUE_TYPE>[] fallbacks)
 {
     return(item.TryLookup(key, out value, (IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> >)fallbacks));
 }
Exemple #27
0
 static public LookupSet <KEY_TYPE, VALUE_TYPE> NarrowSet <KEY_TYPE, VALUE_TYPE>(this LookupSet <KEY_TYPE, VALUE_TYPE> item, Predicate <VALUE_TYPE> predicate)
 {
     return(new LookupSetValueNarrower <KEY_TYPE, VALUE_TYPE>(item, predicate));
 }
Exemple #28
0
 static public bool IsTrue <KEY_TYPE>(this LookupSet <KEY_TYPE, string> item, KEY_TYPE key)
 {
     return(item.Lookup(key).ParseBool());
 }
Exemple #29
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                LookupSet ds = new LookupSet();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "SymbolTableDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Exemple #30
0
 public BackedSet(LookupSet <KEY_TYPE, VALUE_TYPE> m, params LookupSet <KEY_TYPE, VALUE_TYPE>[] f) : this(m, (IEnumerable <LookupSet <KEY_TYPE, VALUE_TYPE> >)f)
 {
 }