コード例 #1
0
        protected int _setValue(string AttributeID, CMetaobjectAttributeValues Value)
        {
            Value.Context = this._context;
            if (this._values.ContainsKey(AttributeID))
                this._values[AttributeID] = Value;
            else
                this._values.Add(AttributeID, Value);

            return CErrors.ERR_SUC;
        }
コード例 #2
0
        protected CMetaobjectAttributeValues _getValue(string AttributeID)
        {
            CMetaobjectAttributeValues R = (this._values.ContainsKey(AttributeID) ? this._values[AttributeID] : null);
            if (R != null)
                return R;

            R = this.GetValuesByAttribute(this._objectKey, AttributeID, this._context);
            if (R == null)
            {
                R = new CMetaobjectAttributeValues()
                {
                    AttributeID = AttributeID,
                    ObjectKey = this._objectKey,
                    Context = this._context
                };
            }
            this._values.Add(AttributeID, R);
            return R;
        }
コード例 #3
0
        public CMetaobjectAttributeValues GetValuesByAttribute(decimal ObjectKey, string AttributeID, DataContext Context)
        {
            if (Context == null)
                return null;

            CMetaobjectAttributeValues R = new CMetaobjectAttributeValues();
            var Attributes = Context.GetTable<CMetaobjectAttributeValue>();
            var Query = from Attr in Attributes
                        where 
                            Attr.ObjectKey == ObjectKey && 
                            Attr.AttributeID == AttributeID
                        select Attr;

            if (Query.Count() == 0)
                return null;

            R.Context = Context;
            R.ObjectKey = ObjectKey;
            R.AttributeID = AttributeID;

            foreach (CMetaobjectAttributeValue Value in Query)
                R.Values.Add(Value.AttributeLocale, Value);

            return R;
        }
コード例 #4
0
        public static List<CMetaobjectAttributeValues> sGetAttributeValues(decimal ObjectKey, DataContext Context)
        {
            Dictionary<string, CMetaobjectAttributeValues> R = new Dictionary<string,CMetaobjectAttributeValues>();

            var Values = CMetaobjectAttributeValue.sGetAttributeValues(ObjectKey, Context);
            foreach (CMetaobjectAttributeValue Value in Values)
            {
                if (R.ContainsKey(Value.AttributeID))
                {
                    var AttrValues = R[Value.AttributeID];
                    AttrValues[Value.AttributeLocale] = Value;
                }
                else
                {
                    CMetaobjectAttributeValues AttrValues = new CMetaobjectAttributeValues()
                    {
                        ObjectKey = ObjectKey,
                        AttributeID = Value.AttributeID,
                        Context = Context
                    };
                    AttrValues[Value.AttributeLocale] = Value;
                    R.Add(Value.AttributeID, AttrValues);
                }
            }

            return R.Values.ToList();
        }
コード例 #5
0
        public static CMetaobjectAttributeValues sGetAttributeValues(decimal ObjectKey, string AttributeID, DataContext Context)
        {
            CMetaobjectAttributeValues R = new CMetaobjectAttributeValues()
            {
                ObjectKey = ObjectKey,
                AttributeID = AttributeID,
                Context = Context
            };
            R.AttributeValuesGet(Context);

            return R;
        }