public static void Add(Order order, string key) { Dictionary <string, string> items = new Dictionary <string, string>(); items.Add("trade_no", order.trade_no); items.Add("trade_count", order.trade_count.ToString()); items.Add("code", order.code); items.Add("name", order.name); items.Add("price", order.price.ToString()); items.Add("count", order.count.ToString()); items.Add("type", order.type.ToString()); items.Add("unit_id", order.unit_id.ToString()); items.Add("unit_name", order.unit_name ?? UnitRA.GetName(order.unit_id)); items.Add("user_id", order.user_id.ToString()); items.Add("user_name", order.user_name ?? UserRA.Get(order.user_id.ToString(), "name")); items.Add("platform", order.platform.ToString()); items.Add("deal_count", order.deal_count.ToString()); items.Add("deal_average_price", order.deal_average_price.ToString()); items.Add("cancel_count", "0"); items.Add("status", order.status ?? ""); items.Add("state", order.state.ToString()); items.Add("time_dt", order.time_dt.Format()); items.Add("account_id", order.account_id.ToString()); items.Add("account_name", order.account_name ?? AccountRA.GetName(order.account_id)); items.Add("order_no", order.order_no ?? ""); items.Add("remark", order.remark ?? ""); TradeRA.SetFields(key, items); TradeRA.SetExpire(key); }
public static void UpdateStatus(StatusAutoOrderEnum status, int user_id, string key) { Dictionary <string, string> items = new Dictionary <string, string>(); items.Add("status", ((int)status).ToString()); if (status == StatusAutoOrderEnum.Run) { items.Add("operator_start", UserRA.Get(user_id.ToString(), "name")); } else if (status == StatusAutoOrderEnum.Pause) { items.Add("operator_stop", UserRA.Get(user_id.ToString(), "name")); } TradeRA.SetFields(key, items); if (status == StatusAutoOrderEnum.Done || status == StatusAutoOrderEnum.Stop) { TradeRA.KeyRename(key, (key.Substring(0, key.Length - 1) + "1")); } }