public PriceActionRequest FromLine(string line) { string[] arr = line.Split(';'); var req = new PriceActionRequest(); req.MachineCode = arr[0]; req.OccurTime = KK.ToDateTime(long.Parse(arr[1])); req.ScreenTime = KK.ToDateTime(long.Parse(arr[2])); // req.Action = (PriceAction) Enum.ToObject(typeof(PriceAction), int.Parse(arr[3])); req.Action = (PriceAction)Enum.Parse(typeof(PriceAction), arr[3]); req.ScreenPrice = int.Parse(arr[4]); req.TargetPrice = int.Parse(arr[5]); req.UsedDelayMills = int.Parse(arr[6]); req.Memo = arr.Length > 7 ? arr[7] : null; return(req); }
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); }
protected override JsonCommand DoExecute(string args) { string[] arr = args.Split(','); long mills = long.Parse(arr[0]); int basePrice = int.Parse(arr[1]); DateTime dt = KK.ToDateTime(mills); var pr = new PagePrice(dt, basePrice); if (biddingScreen.GetBiddingContext().IsPagePriceCalced(pr)) { logger.InfoFormat("price-tell price#{0} already calced", pr); return(null); } logger.InfoFormat("price-tell price#{0} still donot be calced, try to do calc rule.", pr); biddingScreen.AfterSuccessDetect(pr); return(null); }