internal static uint SNIAddProvider(SNIHandle pConn,
                                            ProviderEnum providerEnum,
                                            AuthProviderInfo authInfo)
        {
            UInt32 ret;
            uint   ERROR_SUCCESS = 0;
            SNIAuthProviderInfoWrapper sniAuthInfoWrapper;

            if (authInfo.clientCertificateCallback != null)
            {
                sniAuthInfoWrapper.pDelegateContext = authInfo.clientCertificateCallbackContext;
                sniAuthInfoWrapper.pSqlClientCertificateDelegate = authInfo.clientCertificateCallback;

                authInfo.clientCertificateCallbackContext = sniAuthInfoWrapper;
                authInfo.clientCertificateCallback        = SNIClientCertificateFallbackWrapper;
            }

            ret = SNIAddProviderWrapper(pConn, providerEnum, ref authInfo);

            if (ret == ERROR_SUCCESS)
            {
                // added a provider, need to requery for sync over async support
                bool fSupportsSyncOverAsync;
                ret = SNIGetInfoWrapper(pConn, QTypes.SNI_QUERY_CONN_SUPPORTS_SYNC_OVER_ASYNC, out fSupportsSyncOverAsync);
                Debug.Assert(ret == ERROR_SUCCESS, "SNIGetInfo cannot fail with this QType");
            }

            return(ret);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Body60" /> class.
 /// </summary>
 /// <param name="amount">amount (required).</param>
 /// <param name="methodId">methodId (required).</param>
 /// <param name="otherDetails">otherDetails.</param>
 /// <param name="provider">provider (required).</param>
 public Body60(string amount = default(string), string methodId = default(string), string otherDetails = default(string), ProviderEnum provider = default(ProviderEnum))
 {
     // to ensure "amount" is required (not null)
     if (amount == null)
     {
         throw new InvalidDataException("amount is a required property for Body60 and cannot be null");
     }
     else
     {
         this.Amount = amount;
     }
     // to ensure "methodId" is required (not null)
     if (methodId == null)
     {
         throw new InvalidDataException("methodId is a required property for Body60 and cannot be null");
     }
     else
     {
         this.MethodId = methodId;
     }
     // to ensure "provider" is required (not null)
     if (provider == null)
     {
         throw new InvalidDataException("provider is a required property for Body60 and cannot be null");
     }
     else
     {
         this.Provider = provider;
     }
     this.OtherDetails = otherDetails;
 }
        internal static uint SNIAddProvider(SNIHandle pConn,
                                            ProviderEnum providerEnum,
                                            CTAIPProviderInfo authInfo)
        {
            UInt32 ret;
            uint   ERROR_SUCCESS = 0;


            SNICTAIPProviderInfo ctaipInfo = new SNICTAIPProviderInfo();

            ctaipInfo.prgbAddress            = authInfo.originalNetworkAddress[0];
            ctaipInfo.cbAddress              = (byte)authInfo.originalNetworkAddress.Length;
            ctaipInfo.fFromDataSecurityProxy = authInfo.fromDataSecurityProxy;

            ret = SNIAddProviderWrapper(pConn, providerEnum, ref ctaipInfo);

            if (ret == ERROR_SUCCESS)
            {
                // added a provider, need to requery for sync over async support
                bool fSupportsSyncOverAsync;
                ret = SNIGetInfoWrapper(pConn, QTypes.SNI_QUERY_CONN_SUPPORTS_SYNC_OVER_ASYNC, out fSupportsSyncOverAsync);
                Debug.Assert(ret == ERROR_SUCCESS, "SNIGetInfo cannot fail with this QType");
            }

            return(ret);
        }
Beispiel #4
0
        public static IDbConnection CreateConnection(ProviderEnum provider, string connection_string)
        {
            var connection = CreateConnection(provider);

            connection.ConnectionString = connection_string;
            return(connection);
        }
Beispiel #5
0
 public TrendItem(string id, string title, ProviderEnum provider)
 {
     ID = TextCleaner.CleanID(id);
     Title = TextCleaner.CleanTitle(title);
     Provider = provider;
     Category = CategoryEnum.Unknown;
 }
Beispiel #6
0
        public UsersViewModel getUserInformation(string token, string userid)
        {
            UsersViewModel model = new UsersViewModel();

            if (userid == null || userid == "")
            {
                model = getDataFromProvider(ProviderEnum.Google, token, userid);
            }
            else
            {
                model = getDataFromProvider(ProviderEnum.Facebook, token, userid);
            }

            ProviderEnum provider = model.provider;

            if (_usersService.checkUserHave(model.userEmailAdress))// kullanıcı yok yarat.
            {
                model = _usersService.createSocialUser(model);
            }
            else
            {
                // kayitli kullanıcı var git onu getir.
                model = _usersService.getUserInformation(model.userEmailAdress);
            }
            model.provider = provider;
            return(model);
        }
 public SearchContext(ProviderEnum provider, SearchTypeEnum searchType, string query, int page, int count)
 {
     Provider = provider;
     SearchType = searchType;
     Query = query;
     Page = page;
     Count = count;
 }
Beispiel #8
0
 public bool Equals(ProviderEnum obj)
 {
     if ((object)obj == null)
     {
         return(false);
     }
     return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProviderFeaturesResponseDeposit" /> class.
 /// </summary>
 /// <param name="customerFee">customerFee (required).</param>
 /// <param name="dailyLimit">dailyLimit (required).</param>
 /// <param name="maxAmount">maxAmount (required).</param>
 /// <param name="minAmount">minAmount (required).</param>
 /// <param name="processingHours">processingHours (required).</param>
 /// <param name="provider">provider (required).</param>
 public ProviderFeaturesResponseDeposit(Money1 customerFee = default(Money1), Money1 dailyLimit = default(Money1), Money1 maxAmount = default(Money1), Money1 minAmount = default(Money1), int?processingHours = default(int?), ProviderEnum provider = default(ProviderEnum))
 {
     // to ensure "customerFee" is required (not null)
     if (customerFee == null)
     {
         throw new InvalidDataException("customerFee is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.CustomerFee = customerFee;
     }
     // to ensure "dailyLimit" is required (not null)
     if (dailyLimit == null)
     {
         throw new InvalidDataException("dailyLimit is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.DailyLimit = dailyLimit;
     }
     // to ensure "maxAmount" is required (not null)
     if (maxAmount == null)
     {
         throw new InvalidDataException("maxAmount is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.MaxAmount = maxAmount;
     }
     // to ensure "minAmount" is required (not null)
     if (minAmount == null)
     {
         throw new InvalidDataException("minAmount is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.MinAmount = minAmount;
     }
     // to ensure "processingHours" is required (not null)
     if (processingHours == null)
     {
         throw new InvalidDataException("processingHours is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.ProcessingHours = processingHours;
     }
     // to ensure "provider" is required (not null)
     if (provider == null)
     {
         throw new InvalidDataException("provider is a required property for ProviderFeaturesResponseDeposit and cannot be null");
     }
     else
     {
         this.Provider = provider;
     }
 }
Beispiel #10
0
        public static string Get(ProviderEnum provider)
        {
#if (!NETCOREAPP2_0)
            return(Config.Get(
                       String.Format("{0}_workgroup", provider.ToString().ToLower())));
#else
            return(Config.Get(
                       String.Format("connectionStrings:add:{0}_workgroup:connectionString", provider.ToString().ToLower())));
#endif
        }
Beispiel #11
0
        /// <summary>
        /// Converts a ProviderEnum value to a corresponding string value
        /// </summary>
        /// <param name="enumValue">The ProviderEnum value to convert</param>
        /// <returns>The representative string value</returns>
        public static string ToValue(ProviderEnum enumValue)
        {
            switch (enumValue)
            {
            //only valid enum elements can be used
            //this is necessary to avoid errors
            case ProviderEnum.IPPAY:
                return(stringValues[(int)enumValue]);

            //an invalid enum value was requested
            default:
                return(null);
            }
        }
Beispiel #12
0
        public static IDbConnection CreateConnection(ProviderEnum provider)
        {
            switch (provider)
            {
            case ProviderEnum.Oracle: return(new OracleConnection(ConnectionString.Get(provider)));

            case ProviderEnum.SqlServer: return(new SqlConnection(ConnectionString.Get(provider)));

                #if (!NETCOREAPP2_0)
            case ProviderEnum.OleDb: return(new OleDbConnection(ConnectionString.Get(provider)));

            case ProviderEnum.Odbc: return(new OdbcConnection(ConnectionString.Get(provider)));
                #endif
            }

            return(new SqlConnection(ConnectionString.Get(provider))); // SQL Server as default
        }
Beispiel #13
0
        public UsersViewModel getDataFromProvider(ProviderEnum provider, string token, string userid)
        {
            UsersViewModel model = new UsersViewModel();

            uri_facebook = uri_facebook + userid + "?fields=email,first_name,last_name&access_token=" + token;
            uri_google   = uri_google + token;
            HttpClient http = new HttpClient();
            var        data = http.GetAsync(provider == ProviderEnum.Facebook ? uri_facebook : uri_google).Result.Content.ReadAsStringAsync().Result;

            if (provider == ProviderEnum.Facebook)
            {
                UserFacebookViewModel facebookModel = JsonConvert.DeserializeObject <UserFacebookViewModel>(data);
                model = convertFacebook(facebookModel);
            }
            else
            {
                UserGoogleViewModel googleModel = JsonConvert.DeserializeObject <UserGoogleViewModel>(data);
                model = convertGoogle(googleModel);
            }

            return(model);
        }
		public static uint SNIRemoveProvider (SafeHandle handle, ProviderEnum e)
		{
			throw new NotSupportedException (msg);
		}
		public static uint SNIAddProvider (SafeHandle handle, ProviderEnum e, ref uint result)
		{
			throw new NotSupportedException (msg);
		}
 private static uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ProviderEnum provNum)
 {
     return(s_is64bitProcess ?
            SNINativeManagedWrapperX64.SNIGetInfoWrapper(pConn, QType, out provNum) :
            SNINativeManagedWrapperX86.SNIGetInfoWrapper(pConn, QType, out provNum));
 }
 internal static uint SniGetProviderNumber(SNIHandle pConn, ref ProviderEnum provNum)
 {
     return(SNIGetInfoWrapper(pConn, QTypes.SNI_QUERY_CONN_PROVIDERNUM, out provNum));
 }
 internal static uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo)
 {
     return(s_is64bitProcess ?
            SNINativeManagedWrapperX64.SNIAddProviderWrapper(pConn, ProvNum, ref pInfo) :
            SNINativeManagedWrapperX86.SNIAddProviderWrapper(pConn, ProvNum, ref pInfo));
 }
 internal static uint SNIRemoveProvider(SNIHandle pConn, ProviderEnum ProvNum)
 {
     return(s_is64bitProcess ?
            SNINativeManagedWrapperX64.SNIRemoveProvider(pConn, ProvNum) :
            SNINativeManagedWrapperX86.SNIRemoveProvider(pConn, ProvNum));
 }
 public ProviderMapping(ProviderEnum provider, string category)
 {
     Provider = provider;
     Category = category;
 }
 public SuggestionsContext(ProviderEnum provider, string query)
 {
     Provider = provider;
     Query = query;
 }
 internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);
 internal static extern uint SNIRemoveProvider(SNIHandle pConn, ProviderEnum ProvNum);
Beispiel #24
0
 public VideoItem(string id, string title, ProviderEnum provider)
 {
     ID = TextCleaner.CleanID(id);
     Title = TextCleaner.CleanTitle(title);
     Provider = provider;
 }
 public static uint SNIAddProvider(SafeHandle handle, ProviderEnum e, ref uint result)
 {
     throw new NotSupportedException(msg);
 }
Beispiel #26
0
 internal static extern uint SNIAddProvider(SNIHandle pConn, ProviderEnum ProvNum, [In] ref uint pInfo);
Beispiel #27
0
 internal static extern uint SNIAddProviderWrapper(SNIHandle pConn, ProviderEnum ProvNum, [In] ref AuthProviderInfo pInfo);
 public TopicWorkerThread(ProviderEnum provider, TopicItem topicItem, ManualResetEvent doneEvent)
 {
     this.provider = provider;
     this.topicItem = topicItem;
     this.DoneEvent = doneEvent;
 }
Beispiel #29
0
 internal static extern uint SNIGetInfoWrapper([In] SNIHandle pConn, SNINativeMethodWrapper.QTypes QType, out ProviderEnum provNum);
 public static uint SNIRemoveProvider(SafeHandle handle, ProviderEnum e)
 {
     throw new NotSupportedException(msg);
 }
Beispiel #31
0
 internal static extern uint SNIRemoveProvider(SNIHandle pConn, ProviderEnum ProvNum);
        /// <summary>
        /// https://stackoverflow.com/questions/15177443/parsing-a-single-statement-boolean-expression-tree
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="providerEnum"></param>
        /// <returns>where clause string</returns>
        public static string GetSqlExpression(Expression expression, ProviderEnum providerEnum)
        {
            if (expression is BinaryExpression)
            {
                return(string.Format("({0} {1} {2})",
                                     GetSqlExpression(((BinaryExpression)expression).Left, providerEnum),
                                     GetBinaryOperator((BinaryExpression)expression),
                                     GetSqlExpression(((BinaryExpression)expression).Right, providerEnum)));
            }

            var memberExpression = expression as MemberExpression;

            if (memberExpression != null)
            {
                MemberExpression member = memberExpression;

                // it is somewhat naive to make a bool member into "Member = TRUE"
                // since the expression "Member == true" will turn into "(Member = TRUE) = TRUE"
                if (member.Type == typeof(bool))
                {
                    switch (providerEnum)
                    {
                    case ProviderEnum.MySql: return($"(`{member.Member.Name}` = TRUE)");

                    case ProviderEnum.SqlServer: return($"([{member.Member.Name}] = TRUE)");
                    }
                }
                switch (providerEnum)
                {
                case ProviderEnum.MySql: return($"(`{member.Member.Name}`)");

                case ProviderEnum.SqlServer: return($"([{member.Member.Name}])");
                }
            }

            var constantExpression = expression as ConstantExpression;

            if (constantExpression != null)
            {
                ConstantExpression constant = constantExpression;

                // create a proper SQL representation for each type
                if (constant.Type == typeof(int))
                {
                    return(constant.Value.ToString());
                }
                if (constant.Type == typeof(string))
                {
                    return($"'{constant.Value}'");
                }

                if (constant.Type == typeof(bool))
                {
                    return((bool)constant.Value ? "TRUE" : "FALSE");
                }

                throw new ArgumentException();
            }
            var unaryExpression = expression as UnaryExpression;

            if (unaryExpression == null)
            {
                throw new ArgumentException();
            }

            var unary = unaryExpression;

            return(GetSqlExpression(unary.Operand, providerEnum));
        }