public IOperation <IContainer> Get(OPERATIONS operation, String ticker)
        {
            OPERATION_CONTEXT = operation;

            IOperation <IContainer> container =
                _kernel.Get <IOperation <IContainer> >(new Ninject.Parameters.ConstructorArgument("container", _kernel.Get <IContainer>())
                                                       );

            switch (operation)
            {
            case OPERATIONS.STOCK:
                container.Get("criterias").Set <String>("*");
                container.Get("symbols").Set <String>(ticker);
                break;

            case OPERATIONS.OPTION:
                container.Get("criterias").Set <String>("*");
                container.Get("symbol").Set <String>(ticker);
                break;

            case OPERATIONS.HISTORY:
                container.Get("symbol").Set <String>(ticker);
                break;

            case OPERATIONS.NEWS:
                container.Get("symbol").Set <String>(ticker);
                break;
            }

            return(container);
        }
        private void AsyncEx(object data)
        {
            String     ticker = ((List <Object>)data)[0].ToString();
            OPERATIONS action = (OPERATIONS)(((List <Object>)data)[1]);

            ESGI.Entity.Interfaces.IContainer container = Logic.Instance.Execute(
                ticker, action);
            container.RegisterProperty <String>("c_id", ticker + action.ToString());
            AsyncCallback(container);
        }
Example #3
0
        private Object send(String endpoint, OPERATIONS operation, JObject request)
        {
            // Create REST client
            RestClient client = new RestClient(url);

            // Set authentication credentials
            client.Authenticator = new HttpBasicAuthenticator(username, password);

            //Encript Credentials to base64
            string autorice = Base64Encode(username + ":" + password);

            // Create REST request
            RestRequest rest = null;

            switch (operation)
            {
            case OPERATIONS.PUT: rest = new RestRequest(endpoint, Method.PUT); break;

            case OPERATIONS.GET: rest = new RestRequest(endpoint, Method.GET); break;

            case OPERATIONS.POST: rest = new RestRequest(endpoint, Method.POST); break;

            case OPERATIONS.DELETE: rest = new RestRequest(endpoint, Method.DELETE); break;
            }

            rest.RequestFormat = DataFormat.Json;
            rest.AddHeader("Content-Type", "application/json");
            rest.AddHeader("Authorization", "Basic " + autorice);

            String data = (request != null) ? request.ToString() : "";

            rest.AddParameter("application/json", data, ParameterType.RequestBody);
            IRestResponse  response = client.Execute(rest);
            JsonTextReader jsreader = new JsonTextReader(new StringReader(response.Content));

            try
            {
                return(new JsonSerializer().Deserialize(jsreader));
            }
            catch (JsonReaderException jx)
            {
                return(null);
            }
        }
Example #4
0
        private T send <T>(string endpoint, OPERATIONS operation, JObject request) where T : new()
        {
            // Create REST client
            RestClient client = new RestClient(url);

            // Set authentication credentials
            client.Authenticator = new HttpBasicAuthenticator(username, password);

            //Encript Credentials to base64
            string autorice = Base64Encode(username + ":" + password);

            // Create REST request
            RestRequest rest = null;

            switch (operation)
            {
            case OPERATIONS.PUT: rest = new RestRequest(endpoint, Method.PUT); break;

            case OPERATIONS.GET: rest = new RestRequest(endpoint, Method.GET); break;

            case OPERATIONS.POST: rest = new RestRequest(endpoint, Method.POST); break;

            case OPERATIONS.DELETE: rest = new RestRequest(endpoint, Method.DELETE); break;
            }

            rest.RequestFormat = DataFormat.Json;
            rest.AddHeader("Content-Type", "application/json");
            rest.AddHeader("Authorization", "Basic " + autorice);

            String data = (request != null) ? request.ToString() : "";

            rest.AddParameter("application/json", data, ParameterType.RequestBody);
            IRestResponse response = client.Execute(rest);
            var           result   = client.Execute <T>(rest);

            return(result.Data);
        }
 public WSNumericFFilter(WSTableParam _Field, Expression _member, WSOperation _Operation)
     : base(_Field, _member)
 {
     operation = _Operation != null ? _Operation : OPERATIONS.GetOperation(null);
 }
Example #6
0
 public WSEntityFilter(WSTableSource _Source, Expression _member, WSOperation _Operation) : base(_Source?.ReturnType, _member)
 {
     Source    = _Source;
     operation = _Operation != null ? _Operation : OPERATIONS.GetOperation(null);
 }
       public IOperation<IContainer> Get(OPERATIONS operation, String ticker)
       {

           OPERATION_CONTEXT = operation;

           IOperation<IContainer> container = 
               _kernel.Get<IOperation<IContainer>>(new Ninject.Parameters.ConstructorArgument ("container",_kernel.Get<IContainer>())
                   );

           switch (operation)
           {
               case OPERATIONS.STOCK:
                   container.Get("criterias").Set<String>("*");
                   container.Get("symbols").Set<String>(ticker);
                   break;
               case OPERATIONS.OPTION:
                   container.Get("criterias").Set<String>("*");
                   container.Get("symbol").Set<String>(ticker);
                   break;
               case OPERATIONS.HISTORY:
                   container.Get("symbol").Set<String>(ticker);
                   break;
               case OPERATIONS.NEWS:
                   container.Get("symbol").Set<String>(ticker);
                   break;
           }

           return container;
       }
Example #8
0
 public IContainer Execute(String ticker, OPERATIONS operation)
 {
     return(Register.Instance.Get(operation, ticker)
            .Execute());
 }
 public IContainer Execute(String ticker, OPERATIONS operation)
 {
     return Register.Instance.Get(operation, ticker)
                    .Execute();
 }
Example #10
0
 private void OpComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     Operation = (OPERATIONS)(OpComboBox.SelectedItem as ComboboxMember).ItemNumber;
 }