private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        if (!String.IsNullOrEmpty(txtAnswer.Text))
                        {
                            var getanswer = db.SecurityQuestionUsers.Where(m => m.EmployeeID == App.EmployeeID && m.SecurityQuestionID == QuestionID).FirstOrDefault();

                            if (getanswer != null)
                            {
                                string inputAnswer = txtAnswer.Text;
                                if (inputAnswer.TrimStart().Trim().TrimEnd().ToLower() == getanswer.Answer.TrimStart().Trim().TrimEnd().ToLower())
                                {
                                    ChangePasswordWindow cp = new ChangePasswordWindow();
                                    cp.Show();
                                    var audit = new AuditTrailModel
                                    {
                                        Activity   = "User answer a security question for Forgot Password.",
                                        ModuleName = this.GetType().Name,
                                        EmployeeID = App.EmployeeID
                                    };

                                    SystemClass.InsertLog(audit);
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("Incorrect answer.");
                                    return;
                                }
                            }
                            else
                            {
                                MessageBox.Show("Question not available.");
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please input answer.");
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        private void loginbtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (String.IsNullOrEmpty(usernametb.Text) || String.IsNullOrEmpty(passwordpb.Password))
                {
                    MessageBox.Show("Please input your sign-in credentials");
                }
                else
                {
                    if (SystemClass.CheckConnection())
                    {
                        using (var db = new ImusCityHallEntities())
                        {
                            var    passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher();
                            string pass           = "";
                            var    asp            = db.AspNetUsers.Where(m => m.UserName == usernametb.Text).FirstOrDefault();

                            if (asp != null)
                            {
                                pass = passwordHasher.VerifyHashedPassword(asp.PasswordHash, passwordpb.Password).ToString();
                            }
                            else
                            {
                                MessageBox.Show("Log-in failed!");
                                Mouse.OverrideCursor = null;
                                return;
                            }

                            if (pass == "Success")
                            {
                                Mouse.OverrideCursor = Cursors.Wait;
                                var emp = db.Employees.FirstOrDefault(m => m.EmployeeNo == usernametb.Text);
                                App.EmployeeID = emp.EmployeeID;

                                if (passwordpb.Password == "imuscitygov")
                                {
                                    Mouse.OverrideCursor = null;
                                    MessageBox.Show("Please change your default password.");
                                    ChangePasswordWindow password = new ChangePasswordWindow();
                                    password.Show();
                                }
                                else if (emp.SecurityQuestionUsers.Count < 3 && emp.EmployeeNo != "123456")
                                {
                                    Mouse.OverrideCursor = null;
                                    MessageBox.Show("Please set-up your security questions.");
                                    SecurityQuestion secquestion = new SecurityQuestion();
                                    secquestion.Show();
                                    //
                                }
                                else
                                {
                                    var audit = new AuditTrailModel
                                    {
                                        Activity   = "Log-in to the system",
                                        ModuleName = this.GetType().Name,
                                        EmployeeID = App.EmployeeID
                                    };

                                    SystemClass.InsertLog(audit);
                                    MainWindow mw = new MainWindow();
                                    mw.Password = passwordpb.Password;
                                    mw.Show();
                                    this.Close();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Log-in failed!");
                                Mouse.OverrideCursor = null;
                                return;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(SystemClass.DBConnectionErrorMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            Mouse.OverrideCursor = null;
        }