Exemple #1
0
 public bool Equals(SafeEnum <TEnumSource> other)
 {
     if (Enum.HasValue)
     {
         if (other.Enum.HasValue)
         {
             return(Enum.Value.Equals(other.Enum.Value));
         }
         else if (other._value != null)
         {
             return(string.Equals(Enum.Value.ToString(), other._value, StringComparison.OrdinalIgnoreCase));
         }
         return(false);
     }
     else if (_value != null)
     {
         if (other.Enum.HasValue)
         {
             return(string.Equals(_value, other.Enum.Value.ToString(), StringComparison.OrdinalIgnoreCase));
         }
         else if (other._value != null)
         {
             return(string.Equals(_value, other._value, StringComparison.OrdinalIgnoreCase));
         }
         return(false);
     }
     return(other.Enum == null && other._value == null);
 }
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as ShareAccessRight;

            if (typedSource != null)
            {
                DisplayText     = typedSource.DisplayText;
                AccessRightType = typedSource.AccessRightType;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("DisplayText", out token) && token.Type != JTokenType.Null)
                {
                    DisplayText = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("AccessRightType", out token) && token.Type != JTokenType.Null)
                {
                    AccessRightType = (SafeEnum <ShareAccessRightType>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <ShareAccessRightType>));
                }
            }
        }
Exemple #3
0
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as Folder;

            if (typedSource != null)
            {
                FileCount         = typedSource.FileCount;
                Children          = typedSource.Children;
                HasRemoteChildren = typedSource.HasRemoteChildren;
                Info           = typedSource.Info;
                Redirection    = typedSource.Redirection;
                FavoriteFolder = typedSource.FavoriteFolder;
                ZoneService    = typedSource.ZoneService;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("FileCount", out token) && token.Type != JTokenType.Null)
                {
                    FileCount = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("Children", out token) && token.Type != JTokenType.Null)
                {
                    Children = (IEnumerable <Item>)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable <Item>));
                }
                if (source.TryGetProperty("HasRemoteChildren", out token) && token.Type != JTokenType.Null)
                {
                    HasRemoteChildren = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("Info", out token) && token.Type != JTokenType.Null)
                {
                    Info = (ItemInfo)serializer.Deserialize(token.CreateReader(), typeof(ItemInfo));
                }
                if (source.TryGetProperty("Redirection", out token) && token.Type != JTokenType.Null)
                {
                    Redirection = (Redirection)serializer.Deserialize(token.CreateReader(), typeof(Redirection));
                }
                if (source.TryGetProperty("FavoriteFolder", out token) && token.Type != JTokenType.Null)
                {
                    FavoriteFolder = (FavoriteFolder)serializer.Deserialize(token.CreateReader(), typeof(FavoriteFolder));
                }
                if (source.TryGetProperty("ZoneService", out token) && token.Type != JTokenType.Null)
                {
                    ZoneService = (SafeEnum <ZoneService>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <ZoneService>));
                }
            }
        }
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as CreateWorkflowParams;

            if (typedSource != null)
            {
                Participants        = typedSource.Participants;
                Message             = typedSource.Message;
                Due                 = typedSource.Due;
                IsSequenced         = typedSource.IsSequenced;
                RestartOnNewVersion = typedSource.RestartOnNewVersion;
                DistributionMethod  = typedSource.DistributionMethod;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("Participants", out token) && token.Type != JTokenType.Null)
                {
                    Participants = (IEnumerable <WorkflowParticipant>)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable <WorkflowParticipant>));
                }
                if (source.TryGetProperty("Message", out token) && token.Type != JTokenType.Null)
                {
                    Message = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("Due", out token) && token.Type != JTokenType.Null)
                {
                    Due = (DateTime)serializer.Deserialize(token.CreateReader(), typeof(DateTime));
                }
                if (source.TryGetProperty("IsSequenced", out token) && token.Type != JTokenType.Null)
                {
                    IsSequenced = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool));
                }
                if (source.TryGetProperty("RestartOnNewVersion", out token) && token.Type != JTokenType.Null)
                {
                    RestartOnNewVersion = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool));
                }
                if (source.TryGetProperty("DistributionMethod", out token) && token.Type != JTokenType.Null)
                {
                    DistributionMethod = (SafeEnum <DistributionMethod>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <DistributionMethod>));
                }
            }
        }
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as ItemDlpInfo;

            if (typedSource != null)
            {
                Status = typedSource.Status;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("Status", out token) && token.Type != JTokenType.Null)
                {
                    Status = (SafeEnum <DlpStatus>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <DlpStatus>));
                }
            }
        }
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as UserSecurity;

            if (typedSource != null)
            {
                IsDisabled             = typedSource.IsDisabled;
                IsLocked               = typedSource.IsLocked;
                LockExpires            = typedSource.LockExpires;
                LastWebAppLogin        = typedSource.LastWebAppLogin;
                LastAnyLogin           = typedSource.LastAnyLogin;
                FirstAnyLogin          = typedSource.FirstAnyLogin;
                UserIPRestrictions     = typedSource.UserIPRestrictions;
                DisableLoginBefore     = typedSource.DisableLoginBefore;
                DisableLoginAfter      = typedSource.DisableLoginAfter;
                ForcePasswordChange    = typedSource.ForcePasswordChange;
                PasswordNeverExpires   = typedSource.PasswordNeverExpires;
                LastPasswordChange     = typedSource.LastPasswordChange;
                UsernameShort          = typedSource.UsernameShort;
                LastFailedLogin        = typedSource.LastFailedLogin;
                LastFailedLoginIP      = typedSource.LastFailedLoginIP;
                FailedLoginCount       = typedSource.FailedLoginCount;
                UserAuthenticationType = typedSource.UserAuthenticationType;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("IsDisabled", out token) && token.Type != JTokenType.Null)
                {
                    IsDisabled = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("IsLocked", out token) && token.Type != JTokenType.Null)
                {
                    IsLocked = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("LockExpires", out token) && token.Type != JTokenType.Null)
                {
                    LockExpires = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("LastWebAppLogin", out token) && token.Type != JTokenType.Null)
                {
                    LastWebAppLogin = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("LastAnyLogin", out token) && token.Type != JTokenType.Null)
                {
                    LastAnyLogin = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("FirstAnyLogin", out token) && token.Type != JTokenType.Null)
                {
                    FirstAnyLogin = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("UserIPRestrictions", out token) && token.Type != JTokenType.Null)
                {
                    UserIPRestrictions = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("DisableLoginBefore", out token) && token.Type != JTokenType.Null)
                {
                    DisableLoginBefore = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("DisableLoginAfter", out token) && token.Type != JTokenType.Null)
                {
                    DisableLoginAfter = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("ForcePasswordChange", out token) && token.Type != JTokenType.Null)
                {
                    ForcePasswordChange = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("PasswordNeverExpires", out token) && token.Type != JTokenType.Null)
                {
                    PasswordNeverExpires = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("LastPasswordChange", out token) && token.Type != JTokenType.Null)
                {
                    LastPasswordChange = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("UsernameShort", out token) && token.Type != JTokenType.Null)
                {
                    UsernameShort = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("LastFailedLogin", out token) && token.Type != JTokenType.Null)
                {
                    LastFailedLogin = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?));
                }
                if (source.TryGetProperty("LastFailedLoginIP", out token) && token.Type != JTokenType.Null)
                {
                    LastFailedLoginIP = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("FailedLoginCount", out token) && token.Type != JTokenType.Null)
                {
                    FailedLoginCount = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("UserAuthenticationType", out token) && token.Type != JTokenType.Null)
                {
                    UserAuthenticationType = (SafeEnum <UserAuthenticationType>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <UserAuthenticationType>));
                }
            }
        }
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as UserPreferences;

            if (typedSource != null)
            {
                EnableFlashUpload         = typedSource.EnableFlashUpload;
                EnableJavaUpload          = typedSource.EnableJavaUpload;
                EnableJavaDownload        = typedSource.EnableJavaDownload;
                RememberCustomMessages    = typedSource.RememberCustomMessages;
                RequireLoginByDefault     = typedSource.RequireLoginByDefault;
                NotifyOnUploadByDefault   = typedSource.NotifyOnUploadByDefault;
                NotifyOnDownloadByDefault = typedSource.NotifyOnDownloadByDefault;
                CanResetPassword          = typedSource.CanResetPassword;
                CanViewMySettings         = typedSource.CanViewMySettings;
                IsSharedUserAccount       = typedSource.IsSharedUserAccount;
                TimeZone                         = typedSource.TimeZone;
                DaylightSavingMode               = typedSource.DaylightSavingMode;
                TimeZoneOffset                   = typedSource.TimeZoneOffset;
                TimeZoneOffsetMins               = typedSource.TimeZoneOffsetMins;
                DisplayUserMessage               = typedSource.DisplayUserMessage;
                UserMessageCode                  = typedSource.UserMessageCode;
                NotificationInterval             = typedSource.NotificationInterval;
                ShowTutorial                     = typedSource.ShowTutorial;
                EnableToolOverride               = typedSource.EnableToolOverride;
                IsResetSecurityQuestionRequired  = typedSource.IsResetSecurityQuestionRequired;
                TimeFormat                       = typedSource.TimeFormat;
                LongTimeFormat                   = typedSource.LongTimeFormat;
                DateFormat                       = typedSource.DateFormat;
                EnableShareConnect               = typedSource.EnableShareConnect;
                ReceiveBouncedEmailNotifications = typedSource.ReceiveBouncedEmailNotifications;
                EnablePromotions                 = typedSource.EnablePromotions;
                UserNotificationLocale           = typedSource.UserNotificationLocale;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("EnableFlashUpload", out token) && token.Type != JTokenType.Null)
                {
                    EnableFlashUpload = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("EnableJavaUpload", out token) && token.Type != JTokenType.Null)
                {
                    EnableJavaUpload = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("EnableJavaDownload", out token) && token.Type != JTokenType.Null)
                {
                    EnableJavaDownload = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("RememberCustomMessages", out token) && token.Type != JTokenType.Null)
                {
                    RememberCustomMessages = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("RequireLoginByDefault", out token) && token.Type != JTokenType.Null)
                {
                    RequireLoginByDefault = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("NotifyOnUploadByDefault", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnUploadByDefault = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("NotifyOnDownloadByDefault", out token) && token.Type != JTokenType.Null)
                {
                    NotifyOnDownloadByDefault = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("CanResetPassword", out token) && token.Type != JTokenType.Null)
                {
                    CanResetPassword = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("CanViewMySettings", out token) && token.Type != JTokenType.Null)
                {
                    CanViewMySettings = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("IsSharedUserAccount", out token) && token.Type != JTokenType.Null)
                {
                    IsSharedUserAccount = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("TimeZone", out token) && token.Type != JTokenType.Null)
                {
                    TimeZone = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("DaylightSavingMode", out token) && token.Type != JTokenType.Null)
                {
                    DaylightSavingMode = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("TimeZoneOffset", out token) && token.Type != JTokenType.Null)
                {
                    TimeZoneOffset = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("TimeZoneOffsetMins", out token) && token.Type != JTokenType.Null)
                {
                    TimeZoneOffsetMins = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("DisplayUserMessage", out token) && token.Type != JTokenType.Null)
                {
                    DisplayUserMessage = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("UserMessageCode", out token) && token.Type != JTokenType.Null)
                {
                    UserMessageCode = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("NotificationInterval", out token) && token.Type != JTokenType.Null)
                {
                    NotificationInterval = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("ShowTutorial", out token) && token.Type != JTokenType.Null)
                {
                    ShowTutorial = (SafeEnum <TypeOfTour>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <TypeOfTour>));
                }
                if (source.TryGetProperty("EnableToolOverride", out token) && token.Type != JTokenType.Null)
                {
                    EnableToolOverride = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?));
                }
                if (source.TryGetProperty("IsResetSecurityQuestionRequired", out token) && token.Type != JTokenType.Null)
                {
                    IsResetSecurityQuestionRequired = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("TimeFormat", out token) && token.Type != JTokenType.Null)
                {
                    TimeFormat = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("LongTimeFormat", out token) && token.Type != JTokenType.Null)
                {
                    LongTimeFormat = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("DateFormat", out token) && token.Type != JTokenType.Null)
                {
                    DateFormat = (string)serializer.Deserialize(token.CreateReader(), typeof(string));
                }
                if (source.TryGetProperty("EnableShareConnect", out token) && token.Type != JTokenType.Null)
                {
                    EnableShareConnect = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("ReceiveBouncedEmailNotifications", out token) && token.Type != JTokenType.Null)
                {
                    ReceiveBouncedEmailNotifications = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("EnablePromotions", out token) && token.Type != JTokenType.Null)
                {
                    EnablePromotions = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?));
                }
                if (source.TryGetProperty("UserNotificationLocale", out token) && token.Type != JTokenType.Null)
                {
                    UserNotificationLocale = (SafeEnum <NotificationLocale>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <NotificationLocale>));
                }
            }
        }