Exemple #1
0
        public bool IsReadOnly(EMemberInfo member)
        {
            if (_isReadOnlyCache.ContainsKey(member))
            {
                return(_isReadOnlyCache[member]);
            }
            var isReadOnly = member.ParentType.GetCustomAttribute <ReadOnlyAttribute>() != null ||
                             member.GetCustomAttribute <ReadOnlyAttribute>() != null;

            _isReadOnlyCache[member] = isReadOnly;
            return(isReadOnly);
        }
Exemple #2
0
        public UIElement GetControl(object objectToEdit, EMemberInfo member)
        {
            var editableType = GetEditableType(member.MemberType);
            // create control
            var isReadOnly = _memberResolver.IsReadOnly(member);
            var control    = editableType.GetControl(member.MemberType, isReadOnly) as UIElement;

            // set control value
            editableType.SetValue(control, member.GetValue(objectToEdit), member.MemberType);
            // save control for later
            _memberControls[member] = control;

            if (_memberResolver.HasLabel(member))
            {
                return(CreateControlWithLabel(control, member.Name));
            }
            return(control);
        }
Exemple #3
0
        public static void test()
        {
            EOrderLine  order = null;
            EMemberInfo mi    = null;

            using (TransactionScope sc = new TransactionScope())
            {
                using (UserContent db = new UserContent())
                {
                    string openId = "orKUAw16WK0BmflDLiBYsR-Kh5bE";

                    db.UpdateToMemberLevel2(openId);
                    mi = db.GetMemberInfoByOpenId(openId);
                    db.SaveChanges();
                }
                using (OrderContent odb = new OrderContent())
                {
                    order = odb.UpdateToPaidOrder(mi);
                }
            }
        }
Exemple #4
0
        public bool HasLabel(EMemberInfo member)
        {
            var isReadOnly = member.GetCustomAttribute <NoLabelAttribute>() == null;

            return(isReadOnly);
        }