示例#1
0
文件: Main.cs 项目: tuga1975/SSK
        private void Main_OnFacialRecognitionFailed()
        {
            FacialRecognition.Instance.OnFacialRecognitionFailed     -= Main_OnFacialRecognitionFailed;
            FacialRecognition.Instance.OnFacialRecognitionSucceeded  -= Main_OnFacialRecognitionSucceeded;
            FacialRecognition.Instance.OnFacialRecognitionProcessing -= Main_OnFacialRecognitionProcessing;
            FacialRecognition.Instance.OnCameraInitialized           -= Main_OnCameraInitialized;

            this.Invoke((MethodInvoker)(() =>
            {
                FacialRecognition.Instance.Dispose();
            }));
            Session session = Session.Instance;

            Trinity.BE.User user         = (Trinity.BE.User)session[CommonConstants.USER_LOGIN];
            string          errorMessage = "User '" + user.Name + "' cannot complete facial authentication";

            Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(user.UserId, "Facial authentication failed", errorMessage, EnumNotificationTypes.Error);

            // show message box to user
            CSCallJS.ShowMessage(LayerWeb, "Facial Authentication", "Facial authentication failed");
            //MessageBox.Show("Facial authentication failed", "Facial Authentication", MessageBoxButtons.OK, MessageBoxIcon.Error);

            // navigate to smartcard login page
            NavigateTo(NavigatorEnums.Authentication_SmartCard);

            // reset counter
            _fingerprintFailed = 0;
        }
示例#2
0
        private void SmartCard_OnSmartCardFailed(string message)
        {
            // increase counter
            _smartCardFailed++;

            // exceeded max failed
            if (_smartCardFailed > 3)
            {
                // Send Notification to duty officer
                //APIUtils.SignalR.SendNotificationToDutyOfficer(message, message);

                // show message box to user
                //MessageBox.Show(message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", message);

                // reset counter
                _smartCardFailed = 0;

                // display failed on UI
                LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');");

                return;
            }

            // display failed on UI
            LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader. Failed: " + _smartCardFailed + "');");
        }
示例#3
0
        public void NRICAuthentication(string nric)
        {
            DAL_User dal_User   = new DAL_User();
            var      supervisee = dal_User.GetSuperviseeByNRIC(nric);

            if (supervisee == null)
            {
                CSCallJS.ShowMessage(_web, "NRIC " + nric + " is not registered");
                System.Threading.Tasks.Task.Factory.StartNew(() => BarcodeScannerUtil.Instance.StartScanning(BarcodeScannerCallback));
                return;
            }
            else
            {
                if (supervisee.Status == EnumUserStatuses.Blocked)
                {
                    CSCallJS.ShowMessage(_web, "This supervisee was blocked");
                    System.Threading.Tasks.Task.Factory.StartNew(() => BarcodeScannerUtil.Instance.StartScanning(BarcodeScannerCallback));
                    return;
                }
                else
                {
                    // Create a session object to store Supervisee information
                    Session session = Session.Instance;
                    session.IsSmartCardAuthenticated    = true;
                    session.IsFingerprintAuthenticated  = true;
                    session[CommonConstants.SUPERVISEE] = supervisee;

                    BarcodeScannerUtil.Instance.Disconnect();

                    // raise succeeded event
                    RaiseNRICSucceededEvent();
                    //BarcodeScannerUtil.Instance.Disconnect();
                }
            }
        }
示例#4
0
 private void JSCallCS_ShowMessage(object sender, ShowMessageEventArgs e)
 {
     //MessageBox.Show(e.Message, e.Caption, e.Button, e.Icon);
     //_popupModel.Title = e.Caption;
     //_popupModel.Message = e.Message;
     //_popupModel.IsShowLoading = false;
     //_popupModel.IsShowOK = true;
     //LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel));
     CSCallJS.ShowMessage(LayerWeb, e.Caption, e.Message);
 }
示例#5
0
        private void JSCallCS_OnNRICFailed(object sender, NRICEventArgs e)
        {
            //MessageBox.Show(e.Message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //_popupModel.Title = "Authentication Failed";
            //_popupModel.Message = e.Message;
            //_popupModel.IsShowLoading = false;
            //_popupModel.IsShowOK = true;
            //LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel));

            CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", e.Message);
        }
示例#6
0
        public void NRICAuthentication(string nric)
        {
            DAL_User dal_User   = new DAL_User();
            var      supervisee = dal_User.GetByNRIC(nric);

            if (supervisee == null)
            {
                CSCallJS.ShowMessage(_web, "NRIC " + nric + " is not registered");
                System.Threading.Tasks.Task.Factory.StartNew(() => BarcodeScannerUtil.Instance.StartScanning(BarcodeScannerCallback));
                return;
            }
            else
            {
                string RoleName = supervisee.Membership_UserRoles.FirstOrDefault().Membership_Roles.Name;
                if (RoleName.Equals(EnumUserRoles.USA, StringComparison.InvariantCultureIgnoreCase) || RoleName.Equals(EnumUserRoles.Supervisee, StringComparison.InvariantCultureIgnoreCase) || RoleName.Equals(EnumUserRoles.DutyOfficer, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (supervisee.Status.Equals(EnumUserStatuses.Blocked, StringComparison.InvariantCultureIgnoreCase))
                    {
                        CSCallJS.ShowMessage(_web, "This supervisee was blocked");
                        System.Threading.Tasks.Task.Factory.StartNew(() => BarcodeScannerUtil.Instance.StartScanning(BarcodeScannerCallback));
                        return;
                    }

                    // Create a session object to store UserLogin information
                    Session session = Session.Instance;
                    session.IsSmartCardAuthenticated    = true;
                    session.IsFingerprintAuthenticated  = true;
                    session[CommonConstants.SUPERVISEE] = new Trinity.BE.User()
                    {
                        UserId                = supervisee.UserId,
                        Status                = supervisee.Status,
                        SmartCardId           = supervisee.SmartCardId,
                        RightThumbFingerprint = supervisee.RightThumbFingerprint,
                        LeftThumbFingerprint  = supervisee.LeftThumbFingerprint,
                        Name           = supervisee.Name,
                        NRIC           = supervisee.NRIC,
                        Role           = supervisee.Membership_UserRoles.FirstOrDefault().Membership_Roles.Name,
                        IsFirstAttempt = supervisee.IsFirstAttempt
                    };

                    BarcodeScannerUtil.Instance.Disconnect();

                    // raise succeeded event
                    RaiseNRICSucceededEvent();
                }
                else
                {
                    CSCallJS.ShowMessage(_web, "NRIC " + nric + " is not have access.");
                }
            }
        }
示例#7
0
        private void Fingerprint_OnFingerprintFailed()
        {
            // increase counter
            _fingerprintFailed++;

            // get USER_LOGIN
            Session session = Session.Instance;

            Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN];

            // exceeded max failed
            if (_fingerprintFailed > 3)
            {
                //string message = "Unable to read your fingerprint. Please report to the Duty Officer";
                string message = "Unable to read " + user.Name + "'s fingerprint.";
                // Send Notification to duty officer
                //APIUtils.SignalR.SendNotificationToDutyOfficer(message, message);

                // show message box to user
                //MessageBox.Show(message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", message);

                // navigate to smartcard login page
                NavigateTo(NavigatorEnums.Authentication_Facial);

                // reset counter
                _fingerprintFailed = 0;

                return;
            }

            // display failed on UI
            LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your finger on the reader. Failed: " + _fingerprintFailed + "');");

            // restart identification
            if (user != null)
            {
                List <byte[]> fingerprintTemplates = new List <byte[]>()
                {
                    user.LeftThumbFingerprint,
                    user.RightThumbFingerprint
                };

                FingerprintReaderUtil.Instance.StartIdentification(fingerprintTemplates, Fingerprint_OnIdentificationCompleted);
            }
            else
            {
                Debug.WriteLine("Fingerprint_OnFingerprintFailed warning: USER_LOGIN is null, can not restart identification.");
            }
        }
示例#8
0
文件: Main.cs 项目: tuga1975/SSK
        /// <summary>
        /// Fingerprint_OnDeviceDisconnected
        /// </summary>
        ///
        private void Fingerprint_OnDeviceDisconnected()
        {
            // set message
            string message = "The fingerprint reader is not connected. Please report to the Duty Officer!";

            // Send Notification to duty officer
            Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(null, "The fingerprint reader is not connected.", "The fingerprint reader is not connected.", EnumNotificationTypes.Error);


            // show message box to user
            CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", message);
            //MessageBox.Show(message, "Authentication failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);

            // navigate to smartcard login page
            //NavigateTo(NavigatorEnums.Authentication_SmartCard);
            NavigateTo(NavigatorEnums.Authentication_Facial);
        }
示例#9
0
文件: Main.cs 项目: tuga1975/SSK
 private void OnShowMessage(object sender, ShowMessageEventArgs e)
 {
     //MessageBox.Show(e.Message, e.Caption, e.Button, e.Icon);
     CSCallJS.ShowMessage(LayerWeb, e.Caption, e.Message);
 }
示例#10
0
文件: Main.cs 项目: tuga1975/SSK
 private void JSCallCS_OnNRICFailed(object sender, NRICEventArgs e)
 {
     //MessageBox.Show(e.Message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
     //LayerWeb.ShowMessage("Authentication failed", e.Message);
     CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", e.Message);
 }