public override void Execute(Protocol.Clients.PosStoreClient posStoreClient, Protocol.RequestInfos.PosStorePackageInfo package) { var jsonSerializerSettings = new Newtonsoft.Json.JsonSerializerSettings(); jsonSerializerSettings.Converters.Add(new BarcodeConverter()); var shoppingcart = package.Read <ShoppingCart>(jsonSerializerSettings); if (shoppingcart != null) { var shoppingCartCache = new ShoppingCartCache(); string key = KeyFactory.MachineKeyFactory(shoppingcart.MachineInformation.CompanyToken, shoppingcart.MachineInformation.StoreId, shoppingcart.MachineInformation.MachineSn, shoppingcart.MachineInformation.DeviceSn); shoppingCartCache.Set(key, shoppingcart); } }
public override void Excute(PosStoreServer server, PosStoreSession session, PosStoreRequestInfo requestInfo) { try { var jsonSerializerSettings = new Newtonsoft.Json.JsonSerializerSettings(); jsonSerializerSettings.Converters.Add(new BarcodeConverter()); var shoppingcart = requestInfo.Read <ShoppingCart>(jsonSerializerSettings); if (shoppingcart != null) { var shoppingCartCache = new ShoppingCartCache(); string key = KeyFactory.MachineKeyFactory(shoppingcart.MachineInformation.CompanyId, shoppingcart.MachineInformation.StoreId, shoppingcart.MachineInformation.MachineSn, shoppingcart.MachineInformation.DeviceSn); shoppingCartCache.Set(key, shoppingcart); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }