示例#1
0
        /// <summary>
        ///     设置属性值
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        protected override void SetValueInner(string property, object value)
        {
            switch (property.Trim().ToLower())
            {
            case "id":
                this.ID = (int)Convert.ToDecimal(value);
                return;

            case "pageitemid":
                this.PageItemId = (int)Convert.ToDecimal(value);
                return;

            case "roleid":
                this.RoleId = (int)Convert.ToDecimal(value);
                return;

            case "power":
                this.Power = (int)Convert.ToDecimal(value);
                return;

            case "datascope":
                if (value != null)
                {
                    if (value is int)
                    {
                        this.DataScope = (PositionDataScopeType)(int)value;
                    }
                    else if (value is PositionDataScopeType)
                    {
                        this.DataScope = (PositionDataScopeType)value;
                    }
                    else
                    {
                        var str = value.ToString();
                        PositionDataScopeType val;
                        if (PositionDataScopeType.TryParse(str, out val))
                        {
                            this.DataScope = val;
                        }
                        else
                        {
                            int vl;
                            if (int.TryParse(str, out vl))
                            {
                                this.DataScope = (PositionDataScopeType)vl;
                            }
                        }
                    }
                }
                return;
            }

            //System.Diagnostics.Trace.WriteLine(property + @"=>" + value);
        }