Example #1
0
        public override bool Equals(object o)
        {
            if (!(o is FtpAccount))
            {
                return(false);
            }
            FtpAccount v = o as FtpAccount;

            if (!AccountId.Equals(v.AccountId))
            {
                return(false);
            }
            if (!AuthenticationType.Equals(v.AuthenticationType))
            {
                return(false);
            }
            if (!FtpConnectionType.Equals(v.FtpConnectionType))
            {
                return(false);
            }
            if (!KeyFileRequiresPass.Equals(v.KeyFileRequiresPass))
            {
                return(false);
            }
            if (!Password.Equals(v.Password))
            {
                return(false);
            }
            if (!PrivateKeyFile.Equals(v.PrivateKeyFile))
            {
                return(false);
            }
            if (!Server.Equals(v.Server))
            {
                return(false);
            }
            if (!UserName.Equals(v.UserName))
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// Check if web.config embed parameters have valid values.
        /// </summary>
        /// <returns>Null if web.config parameters are valid, otherwise returns specific error string.</returns>
        private string GetWebConfigErrors()
        {
            // Application Id must have a value.
            if (string.IsNullOrWhiteSpace(ApplicationId))
            {
                return
                    ("ApplicationId is empty. please register your application as Native app in https://dev.powerbi.com/apps and fill client Id in web.config.");
            }

            // Application Id must be a Guid object.
            Guid result;

            if (!Guid.TryParse(ApplicationId, out result))
            {
                return
                    ("ApplicationId must be a Guid object. please register your application as Native app in https://dev.powerbi.com/apps and fill application Id in web.config.");
            }

            // Workspace Id must have a value.
            if (string.IsNullOrWhiteSpace(WorkspaceId))
            {
                return("WorkspaceId is empty. Please select a group you own and fill its Id in web.config");
            }

            // Workspace Id must be a Guid object.
            if (!Guid.TryParse(WorkspaceId, out result))
            {
                return
                    ("WorkspaceId must be a Guid object. Please select a workspace you own and fill its Id in web.config");
            }

            if (AuthenticationType.Equals("MasterUser"))
            {
                // Username must have a value.
                if (string.IsNullOrWhiteSpace(Username))
                {
                    return("Username is empty. Please fill Power BI username in web.config");
                }

                // Password must have a value.
                if (string.IsNullOrWhiteSpace(Password))
                {
                    return("Password is empty. Please fill password of Power BI username in web.config");
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(ApplicationSecret))
                {
                    return
                        ("ApplicationSecret is empty. please register your application as Web app and fill appSecret in web.config.");
                }

                // Must fill tenant Id
                if (string.IsNullOrWhiteSpace(Tenant))
                {
                    return("Invalid Tenant. Please fill Tenant ID in Tenant under web.config");
                }
            }

            return(null);
        }