Example #1
0
        public override void ReadJson(JObject obj)
        {
            base.ReadJson(obj);
            try
            {
                if (obj["UserType"] != null && ((JValue)obj["UserType"]).Value != null)
                {
                    UserType = (UserTypes)Enum.Parse(typeof(UserTypes), ((JValue)obj["UserType"]).Value.ToString());
                }

                if (obj["Status"] != null && ((JValue)obj["Status"]).Value != null)
                {
                    Status = (UserStatuses)Enum.Parse(typeof(UserStatuses), ((JValue)obj["Status"]).Value.ToString());
                }

                if (obj["Firstname"] != null && ((JValue)obj["Firstname"]).Value != null)
                {
                    Firstname = ((JValue)obj["Firstname"]).Value.ToString();
                }

                if (obj["Email"] != null && ((JValue)obj["Email"]).Value != null)
                {
                    Email = ((JValue)obj["Email"]).Value.ToString();
                }

                if (obj["Lastname"] != null && ((JValue)obj["Lastname"]).Value != null)
                {
                    Lastname = ((JValue)obj["Lastname"]).Value.ToString();
                }

                if (obj["IsAdmin"] != null && ((JValue)obj["IsAdmin"]).Value != null)
                {
                    IsAdmin = bool.Parse(((JValue)obj["IsAdmin"]).Value.ToString());
                }

                if (obj["Deleted"] != null && ((JValue)obj["Deleted"]).Value != null)
                {
                    Deleted = bool.Parse(((JValue)obj["Deleted"]).Value.ToString());
                }

                if (obj["Enabled"] != null && ((JValue)obj["Enabled"]).Value != null)
                {
                    Enabled = bool.Parse(((JValue)obj["Enabled"]).Value.ToString());
                }

                if (obj["Password"] != null && ((JValue)obj["Password"]).Value != null)
                {
                    Password = ((JValue)obj["Password"]).Value.ToString();
                }

                if (obj["UserName"] != null && ((JValue)obj["UserName"]).Value != null)
                {
                    UserName = ((JValue)obj["UserName"]).Value.ToString();
                }

                if (obj["Usercode"] != null && ((JValue)obj["Usercode"]).Value != null)
                {
                    Usercode = ((JValue)obj["Usercode"]).Value.ToString();
                }

                if (obj["ConfigurationId"] != null && ((JValue)obj["ConfigurationId"]).Value != null)
                {
                    ConfigurationId = ((JValue)obj["ConfigurationId"]).Value.ToString();
                }

                if (obj["ClientId"] != null && ((JValue)obj["ClientId"]).Value != null)
                {
                    ClientId = ((JValue)obj["ClientId"]).Value.ToString();
                }


                if (obj["UserRights"] != null && obj["UserRights"].HasValues)
                {
                    JArray userRightsObj = JArray.FromObject(obj["UserRights"]);

                    if (userRightsObj != null)
                    {
                        UserRights.ReadJson(obj);
                    }
                }

                ObjectState = ObjectStates.None;
                SetOriginal();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
 private void Init()
 {
     UserRights = new UserRights(this);
 }