Exemple #1
0
        private void BtnNext_Click(object sender, RoutedEventArgs e)
        {
            // 确认下单,员工主管刷卡后,生成订单
            // 如果用户是主管的话,不再需要管理员刷卡
            User user = Account.Instance.GetUser();

            if (user.type == Constant.USER_TYPE_ADMIN)
            {
                User loginUser = Account.Instance.GetUser();
                Page page      = new PreOrderPage(productItems, user.employee_id, user.employee_id, loginUser.changeType);
                this.NavigationService.Navigate(page);
            }
            else
            {
                Page adminPage = new AdminConfirmPage(productItems);
                this.NavigationService.Navigate(adminPage);
            }
        }
 private void dtimer_Tick(object sender, EventArgs e)
 {
     // 判断设备是否可用,不可用则继续检测
     if (CardDevice.Instance.IsDeviceOk)
     {
         String cardNo = CardDevice.Instance.GetCardNo();
         if (!String.IsNullOrEmpty(cardNo))
         {
             // CardDevice.Instance.Beep();
             User admin = CheckAdmin(cardNo);
             if (admin.type == Constant.USER_TYPE_ADMIN || admin.type == Constant.USER_TYPE_MANAGER)
             {
                 // 去下单
                 User loginUser = Account.Instance.GetUser();
                 Page page      = new PreOrderPage(productItems, Account.Instance.GetUser().employee_id, admin.employee_id, loginUser.changeType);
                 this.NavigationService.Navigate(page);
                 dtimer.Stop();
             }
             else
             {
                 labelTip.Content = "该卡不属于主管!";
             }
         }
     }
     else
     {
         CardDevice.Instance.Prepare();
         if (!CardDevice.Instance.IsDeviceOk)
         {
             labelTip.Content = "未检测到刷卡机!";
         }
         else
         {
             labelTip.Content = "";
         }
     }
 }