示例#1
0
        public string CFDValidateOrder(string encryptedPIN, string counterId, string orderType, string action1, string timeInForce, string expireTime, string limitPrice, string quantity
                                       , string ifDoneLimitOrderNo, string ocoStopLimitPrice, string ocoStopLimitQuantity, string stopPrice, string trailingStep
                                       , string limitSpread, string triggerPriceType, string conditionOperator, string conditionCompanyCode, string conditionPrice)
        {
            Response.Buffer          = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.CacheControl    = "no-cache";
            string tradeEnable = ConfigurationManager.AppSettings["tradeEnable"];

            if (tradeEnable != "1")
            {
                return("{\"msg\":\"Sorry,you don't have permission to trade.\",\"code\":-1}");
            }

            JObject json = new JObject();

            try
            {
                string   deviceId = Session["openid"].ToString();
                UserInfo user     = (UserInfo)Session["User"];

                string language = Session["language"].ToString();
                string result   = tradeMgr.getCFDValidateOrder(deviceId, user.accountNo, user.sessionID, language, encryptedPIN, counterId
                                                               , orderType, action1, timeInForce, expireTime, limitPrice, quantity
                                                               , ifDoneLimitOrderNo, ocoStopLimitPrice, ocoStopLimitQuantity, stopPrice, trailingStep
                                                               , limitSpread, triggerPriceType, conditionOperator, conditionCompanyCode, conditionPrice);

                STReturn ret = Global.chkJsonStats(result);
                if (int.Parse(ret.retCode) != (int)MsgCode.PARSE_JSON_ERROR)
                {
                    return(result);
                }
                else
                {
                    json.Add("code", ret.retCode);
                    json.Add("msg", ret.retMsg);
                    return(json.ToString());
                }
            }
            catch (WeChatException ex)
            {
                json.RemoveAll();
                json.Add("code", ex.WeChatErrorCode);
                json.Add("msg", ex.WeChatErrorMessage);
                return(json.ToString());
            }
            catch (Exception)
            {
                json.RemoveAll();
                json.Add("code", (int)MsgCode.SESSION_EXPIRED_ERR);
                json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SESSION_EXPIRED_ERR]);
                return(json.ToString());
            }
        }