Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            RESTServices service = new RESTServices();

            serviceHost = new WebServiceHost(service, new Uri("http://localhost:8000/"));
            serviceHost.Open();

            m_yuanta_ord = new YuantaOrdClass();

            m_yuanta_ord.OnLogonS += new _DYuantaOrdEvents_OnLogonSEventHandler(m_yuanta_ord_OnLogonS);

            m_yuanta_ord.OnUserDefinsFuncResult += new _DYuantaOrdEvents_OnUserDefinsFuncResultEventHandler(m_yuanta_ord_OnUserDefinsFuncResult);

            int ret_code = m_yuanta_ord.SetFutOrdConnection("", "", "api.yuantafutures.com.tw", int.Parse("80"));
        }
 public ActionResult DoUntil(Number input)      // using hybrid model binding extension to catch everything and put it into model
 {
     /* var a = input.ToString();
      * int number = JObject.Parse(a)["until"];*/// using JOBject and parsing it to get the value i/o class
     logServices.SaveToDatabase(new Log(HttpContext.Request.RouteValues["action"].ToString(), JsonSerializer.Serialize(input)));
     if (input.Until == null)
     {
         return(StatusCode(400, new { error = "Please provide a number!" }));
     }
     else if (input?.Act == "sum")
     {
         return(StatusCode(200, new { result = RESTServices.Sum((int)input.Until) }));
     }
     else if (input?.Act == "factor")
     {
         return(StatusCode(200, new { result = RESTServices.Factor((int)input.Until) }));
     }
     else
     {
         return(StatusCode(400, new { error = "Please provide valid operation in URL. /Sum or /Factor. " }));
     }
 }
 public HomeController(RESTServices services, LogServices logServices)
 {
     this.restServices = services;
     this.logServices  = logServices;
 }