예제 #1
0
        public bool TryParseJSON(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            dynamic dobj = null;

            if (obj is string)
            {
                FrameDLRObject.TryParse(ComFunc.nvlNotrim(obj), FrameDLRFlags.SensitiveCase, dobj);
                if (dobj == null)
                {
                    return(false);
                }
            }
            else if (obj is FrameDLRObject)
            {
                dobj = (FrameDLRObject)obj;
            }
            else
            {
                return(false);
            }


            UserID    = dobj.UserID;
            UserName  = dobj.UserName;
            RoleID    = dobj.RoleID;
            RoleName  = dobj.RoleName;
            GroupID   = dobj.GroupID;
            GroupName = dobj.GroupName;
            TeamID    = dobj.TeamID;
            TeamName  = dobj.TeamName;
            AgentID   = dobj.AgentID;
            AgentName = dobj.AgentName;
            if (dobj.Actions is FrameDLRObject)
            {
                var actions = new ActionCollection();
                if (actions.TryParseJSON(dobj.Actions))
                {
                    SetValue("Actions", actions);
                }
            }
            LoginTime          = dobj.LoginTime;
            ForceLogoutTimeOut = dobj.ForceLogoutTimeOut;
            LoginIPAddress     = dobj.LoginIPAddress;
            UserSex            = dobj.UserSex == null ? SexType.Male : ComFunc.EnumParse <SexType>(ComFunc.nvl(dobj.UserSex));

            return(true);
        }
예제 #2
0
        /// <summary>
        /// 给Express加载对应的参数
        /// </summary>
        /// <param name="express"></param>
        /// <param name="json"></param>
        /// <returns></returns>
        public static void Load(DBExpress express, FrameDLRObject json)
        {
            var rtn        = express;
            var acttypekey = "$acttype";

            if (ComFunc.nvl(json.GetValue(acttypekey)) != "")
            {
                rtn.acttype = ComFunc.EnumParse <ActType>(ComFunc.nvl(json.GetValue(acttypekey)));
                json.Remove(acttypekey);
            }
            else
            {
                rtn.acttype = ActType.Query;
            }

            rtn.express = json;
        }
예제 #3
0
        /// <summary>
        /// 创建一个DBExpress对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="json"></param>
        /// <returns></returns>
        public static T Create <T>(FrameDLRObject json) where T : DBExpress
        {
            T   rtn        = (T)Activator.CreateInstance(typeof(T), true);
            var acttypekey = json.IgnoreCase ? "$acttype" : "$ActType";

            if (ComFunc.nvl(json.GetValue(acttypekey)) != "")
            {
                rtn.acttype = ComFunc.EnumParse <ActType>(ComFunc.nvl(json.GetValue(acttypekey)));
                json.Remove(acttypekey);
            }
            else
            {
                rtn.acttype = ActType.Query;
            }

            rtn.express = json;
            return(rtn);
        }
예제 #4
0
 public void SetContentType(string ct)
 {
     _logic.CallContext_DataCollection.ContentType = ComFunc.EnumParse <GoResponseDataType>(ct);
 }
예제 #5
0
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     return(ComFunc.EnumParse <PropertiesByAction>(ComFunc.nvl(value)));
 }