private void DoPriceAction(PriceAction action, int screenPrice, int targetPrice, DateTime screenTime, int usedDelayMills, DateTime occurTime, string memo = "") { PriceActionRequest req = new PriceActionRequest(); req.MachineCode = clientService.GetMachineCode(); req.OccurTime = occurTime == null ? DateTime.Now : occurTime; req.ScreenTime = screenTime; req.UsedDelayMills = usedDelayMills; req.Action = action; req.ScreenPrice = screenPrice; req.TargetPrice = targetPrice; JsonCommand comm = JsonCommands.OK(CommandDirective.PRICE_TELL, req.ToLine()); RawMessage msg = MessageUtils.BuildJsonMessage(ClientService.AssignedClientNo, comm); socketClient.Send(msg); logger.InfoFormat("report price#{0}#{1}action#{2} at screenTime#{3} occurTime{4}, usedDelayMills#{5}", screenPrice, targetPrice, action, screenTime, req.OccurTime, usedDelayMills); }
public void ToJsonTest() { DateTime dt = DateTime.Now; long mills = KK.ToMills(dt); DateTime dt2 = KK.ToDateTime(mills); Console.Out.WriteLine("mills is " + mills); PriceActionRequest req = new PriceActionRequest(); req.MachineCode = "123456"; req.OccurTime = DateTime.Now; req.ScreenTime = DateTime.Now; req.UsedDelayMills = 23; string json = Jsons.ToJson(req); string reqText = req.ToLine(); Console.Out.WriteLine("json is " + json); }