/// <summary> /// 获取股东信息 /// </summary> /// <param name="exchangeType"></param> /// <returns></returns> private AccountInfoItem GetStockHolder(int exchangeType) { AccountInfoItem holder = null; for (int i = 0; i < this.resAccountInfo.Item.Count; i++) { if (this.resAccountInfo.Item[i].exchange_type == exchangeType.ToString()) { holder = this.resAccountInfo.Item[i]; } } return(holder); }
protected override TraderResult internalBuyStock(string code, float price, int num) { int exchange_type = StockUtil.GetExchangeType(code); AccountInfoItem holder = GetStockHolder(exchange_type); StockBuyRequest t = new StockBuyRequest { branch_no = this.resAccountInfo.branch_no, custid = this.resAccountInfo.fund_account, fund_account = this.resAccountInfo.fund_account, op_branch_no = this.resAccountInfo.branch_no, op_station = this.resAccountInfo.op_station, password = this.resAccountInfo.trdpwd, uid = this.resAccountInfo.uid, exchange_type = exchange_type.ToString(), stock_account = holder.stock_account, stock_code = StockUtil.GetShortCode(code), entrust_amount = num, entrust_price = price }; StockBuyResp resp = getResp <StockBuyResp, StockBuyRequest>(t); TraderResult ret = new TraderResult(); if (resp.cssweb_code == SuccessCode) { ret.Code = TraderResultEnum.SUCCESS; ret.EntrustNo = resp.Item[0].entrust_no; } else { ret.Code = TraderResultEnum.ERROR; ret.Message = String.Format("错误代码{0}, 错误内容{1}", resp.cssweb_code, resp.cssweb_msg); } return(ret); }