示例#1
0
        /// <summary>
        /// Subscription data reader takes a subscription request, loads the type, accepts the data source and enumerate on the results.
        /// </summary>
        /// <param name="config">Subscription configuration object</param>
        /// <param name="dataRequest">The data request</param>
        /// <param name="mapFileProvider">Used for resolving the correct map files</param>
        /// <param name="factorFileProvider">Used for getting factor files</param>
        /// <param name="dataCacheProvider">Used for caching files</param>
        /// <param name="dataProvider">The data provider to use</param>
        public SubscriptionDataReader(SubscriptionDataConfig config,
                                      BaseDataRequest dataRequest,
                                      IMapFileProvider mapFileProvider,
                                      IFactorFileProvider factorFileProvider,
                                      IDataCacheProvider dataCacheProvider,
                                      IDataProvider dataProvider)
        {
            //Save configuration of data-subscription:
            _config = config;

            //Save Start and End Dates:
            _periodStart        = dataRequest.StartTimeLocal;
            _periodFinish       = dataRequest.EndTimeLocal;
            _mapFileProvider    = mapFileProvider;
            _factorFileProvider = factorFileProvider;
            _dataCacheProvider  = dataCacheProvider;

            //Save access to securities
            _tradeableDates = dataRequest.TradableDays.GetEnumerator();
            _dataProvider   = dataProvider;
        }
示例#2
0
        public IActionResult PUserCheckMail(UserRegisterRequest userRegisterRequest)
        {
            var baseDataR = new BaseDataRequest {
                Email = userRegisterRequest.Email
            };

            WebRequest request = WebRequest.Create("http://localhost:55106/api/user/IsEmailTaken");

            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;


            // Set the Method property of the request to POST.
            request.Method = "POST";

            // Create POST data and convert it to a byte array.
            byte[] byteArray = Encoding.UTF8.GetBytes(baseDataR.ToString());

            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;


            // Get the response.
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            // Display the status.
            Console.WriteLine(response.StatusDescription);
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd();

            return(View("Index"));
        }
示例#3
0
 public IActionResult IsEmailTaken([FromBody] BaseDataRequest request) =>
 request == null ||
 string.IsNullOrWhiteSpace(request.Email) ||
 !Regex.IsMatch(request.Email, AppSettings.EmailExpression)
         ? (IActionResult)BadRequest()
         : new OkObjectResult(_usersDataService.IsEmailTaken(request.Email));