Exemplo n.º 1
0
        private bool referForCheck()
        {
            IStaffService staffService = new StaffService(Settings.Default.db);
            Staff         staff        = staffService.FindByStaffId(ID.Text);

            if (staff == null)
            {
                if (BaseConfig.Sound)
                {
                    player.Play();
                }
                MessageBoxResult result = MessageBox.Show("请前往网页端创建后扫描", "不存在该身份证信息", MessageBoxButton.OK, MessageBoxImage.Hand);
                return(false);
            }
            else
            {
                if (staff.name != Name.Text)
                {
                    if (BaseConfig.Sound)
                    {
                        player.Play();
                    }
                    withErrorMessage[0] = staff.name;
                    withErrorMessage[1] = staff.id;
                    WarningWindow win = new WarningWindow();
                    win.ShowDialog();
                }
                else
                {
                    if (staff.isIdChecked)
                    {
                        msgBlock.Text       = "通 过";
                        msgBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#2786E4"));
                        return(true);
                    }
                    else
                    {
                        if (BaseConfig.AutoCheckin)
                        {
                            if (upDate())
                            {
                                msgBlock.Text       = "通 过";
                                msgBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#2786E4"));
                                return(true);
                            }
                            else
                            {
                                msgBlock.Text       = "待更新";
                                msgBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#EA0000"));
                            }
                        }
                        else
                        {
                            // win.ShowDialog();
                            MessageBoxResult result = MessageBox.Show("       是否更新?", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Hand);
                            if (result == MessageBoxResult.OK)
                            {
                                if (upDate())
                                {
                                    msgBlock.Text       = "通 过";
                                    msgBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#2786E4"));
                                    return(true);
                                }
                                else
                                {
                                    msgBlock.Text       = "待更新";
                                    msgBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#EA0000"));
                                }
                            }
                        }
                    }
                }
                return(false);
            }
        }