Ejemplo n.º 1
0
        public override void Execute(PosStoreClient posStoreClient, PosStorePackageInfo package)
        {
            var      datas    = package.Read <MemberNoDto>();
            MemberNo memberNo = new MemberNo(datas.CompanyId, datas.StoreId);

            if (memberNo.GetNumber() <= datas.Number)
            {
                memberNo.Reset(datas.Number);
            }
            else
            {
                posStoreClient.SendObject(this.CmdCode, new MemberNoDto()
                {
                    CompanyId = memberNo.CompanyId, StoreId = memberNo.StoreId, Name = memberNo.Name, Number = memberNo.GetNumber(), SwiftNumberMode = memberNo.SwiftNumberMode
                });
            }
        }
Ejemplo n.º 2
0
        public static void Sub()
        {
            new EventAggregator().Subscribe <SyncMemberNoEvent>("SyncMemberNoEventForServer", (o) =>
            {
                MemberNo memberNo = new MemberNo(o.CompanyId, o.StoreId);
                if (memberNo.GetNumber() < o.Number)
                {
                    memberNo.Reset(o.Number);
                }
            });

            new EventAggregator().Subscribe <SyncOnlineEvent>("SyncOnlineEventForServer", (o) =>
            {
                var cache = new OnlineCache();
                var key   = KeyFactory.MachineKeyFactory(o.CompanyToken, o.StoreId, o.MachineSn, o.DeviceSn);
                cache.Set(key, new MachineInformation()
                {
                    CashierName        = o.CashierName,
                    CashierOperateAuth = o.CashierOperateAuth,
                    CashierUid         = o.CashierUid,
                    CashierUserCode    = o.CashierUserCode,
                    CompanyToken       = o.CompanyToken,
                    DeviceSn           = o.DeviceSn,
                    InTestMode         = o.InTestMode,
                    MachineSn          = o.MachineSn,
                    StoreId            = o.StoreId,
                    StoreName          = o.StoreName
                });
            });

            new EventAggregator().Subscribe <SyncSerialNumberEvent>("SyncSerialNumberEventForServer", (o) =>
            {
                PaySn customOrderSn = new PaySn(o.CompanyToken, o.StoreId, o.MachineSn);
                if (customOrderSn.GetNumber() < o.Number)
                {
                    customOrderSn.ResetSerialNumber(o.Number);
                }
            });
        }
Ejemplo n.º 3
0
 public override void Excute(PosStoreServer server, PosStoreSession session, PosStoreRequestInfo requestInfo)
 {
     try
     {
         var      datas    = requestInfo.Read <MemberNoDto>();
         MemberNo memberNo = new MemberNo(datas.CompanyId, datas.StoreId);
         if (memberNo.GetNumber() <= datas.Number)
         {
             memberNo.Reset(datas.Number);
         }
         else
         {
             session.SendObject(this.CmdCode, new MemberNoDto()
             {
                 CompanyId = memberNo.CompanyId, StoreId = memberNo.StoreId, Name = memberNo.Name, Number = memberNo.GetNumber(), SwiftNumberMode = memberNo.SwiftNumberMode
             });
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }