private void btnOK_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtOldPassword.Password))
                {
                    MessageBox.ShowBox("MessageID270", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }

                if (CryptoHelper.CreateHash(txtOldPassword.Password) != SecurityHelper.CurrentUser.Password)
                {
                    MessageBox.ShowBox("MessageID271", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtNewPassword.Password))
                {
                    MessageBox.ShowBox("MessageID272", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }
                if (txtNewPassword.Password.Length < 5)
                {
                    MessageBox.ShowBox("MessageID273", BMC_Icon.Warning);
                    txtNewPassword.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtRetypePassword.Password))
                {
                    MessageBox.ShowBox("MessageID274", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }
                //else if (txtRetypePassword.Password.Length < 5)
                //{
                //    MessageBox.ShowBox("Password length should be atleast 5 characters.", BMC_Icon.Warning, true);
                //    txtRetypePassword.Focus();
                //    return;
                //}
                if (txtOldPassword.Password == txtNewPassword.Password)
                {
                    MessageBox.ShowBox("MessageID276", BMC_Icon.Warning);
                    txtNewPassword.Focus();
                    return;
                }
                if (txtOldPassword.Password == txtRetypePassword.Password)
                {
                    MessageBox.ShowBox("MessageID276", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }
                if (txtNewPassword.Password != txtRetypePassword.Password)
                {
                    MessageBox.ShowBox("MessageID277", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }

                if (!PasswordHelper.CheckPasswordStrength(txtNewPassword.Password))
                {
                    MessageBox.ShowBox("MessageID278", BMC_Icon.Warning);
                    txtNewPassword.Password    = "";
                    txtRetypePassword.Password = "";
                    txtNewPassword.Focus();
                    return;
                }

                try
                {
                    _user.Password = txtNewPassword.Password;
                    bChanged       = _userManager.ChangePassword(_user);

                    if (bChanged)
                    {
                        SecurityHelper.CurrentUser.Password = txtNewPassword.Password;

                        userDataContext uDC = new userDataContext(oCommonUtilities.CreateInstance().GetConnectionString());
                        uDC.Export_History(_securityID.ToString(), "", "CHANGEPASSWORD", null);
                        MessageBox.ShowBox("MessageID279", BMC_Icon.Information);
                        txtOldPassword.Password    = "";
                        txtNewPassword.Password    = "";
                        txtRetypePassword.Password = "";

                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = ModuleName.Password,
                            Audit_Screen_Name  = "ChangePassword",
                            Audit_Desc         = "Password changed by user.",
                            AuditOperationType = OperationType.MODIFY
                        });

                        this.DialogResult = true;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID301", BMC_Icon.Information);
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {
                            AuditModuleName    = ModuleName.Password,
                            Audit_Screen_Name  = "ChangePassword",
                            Audit_Desc         = "Unable to change password.",
                            AuditOperationType = OperationType.MODIFY
                        });
                    }
                }
                catch (Exception ex)
                {
                    ExceptionManager.Publish(ex);

                    MessageBox.ShowBox("MessageID301", BMC_Icon.Information);
                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {
                        AuditModuleName    = ModuleName.Password,
                        Audit_Screen_Name  = "ChangePassword",
                        Audit_Desc         = "Unable to change password.",
                        AuditOperationType = OperationType.MODIFY
                    });
                }
            }
            finally
            {
                btnOK.IsEnabled = true;
            }
        }
        private void btnOK_Click(object sender, System.Windows.RoutedEventArgs e)
        {

            try
            {
                if (string.IsNullOrEmpty(txtOldPassword.Password))
                {
                    MessageBox.ShowBox("MessageID270", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }

                if (CryptoHelper.CreateHash(txtOldPassword.Password) != SecurityHelper.CurrentUser.Password)
                {
                    MessageBox.ShowBox("MessageID271", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtNewPassword.Password))
                {
                    MessageBox.ShowBox("MessageID272", BMC_Icon.Warning);
                    txtOldPassword.Focus();
                    return;
                }
                if (txtNewPassword.Password.Length < 5)
                {
                    MessageBox.ShowBox("MessageID273", BMC_Icon.Warning);
                    txtNewPassword.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtRetypePassword.Password))
                {
                    MessageBox.ShowBox("MessageID274", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }
                //else if (txtRetypePassword.Password.Length < 5)
                //{
                //    MessageBox.ShowBox("Password length should be atleast 5 characters.", BMC_Icon.Warning, true);
                //    txtRetypePassword.Focus();
                //    return;
                //}
                if (txtOldPassword.Password == txtNewPassword.Password)
                {
                    MessageBox.ShowBox("MessageID276", BMC_Icon.Warning);
                    txtNewPassword.Focus();
                    return;
                }
                if (txtOldPassword.Password == txtRetypePassword.Password)
                {
                    MessageBox.ShowBox("MessageID276", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }
                if (txtNewPassword.Password != txtRetypePassword.Password)
                {
                    MessageBox.ShowBox("MessageID277", BMC_Icon.Warning);
                    txtRetypePassword.Focus();
                    return;
                }

                if (!PasswordHelper.CheckPasswordStrength(txtNewPassword.Password))
                {
                    MessageBox.ShowBox("MessageID278", BMC_Icon.Warning);
                    txtNewPassword.Password = "";
                    txtRetypePassword.Password = "";
                    txtNewPassword.Focus();
                    return;
                }

                try
                {
                    _user.Password = txtNewPassword.Password;
                    bChanged = _userManager.ChangePassword(_user);

                    if (bChanged)
                    {
                        SecurityHelper.CurrentUser.Password = txtNewPassword.Password;

                        userDataContext uDC = new userDataContext(oCommonUtilities.CreateInstance().GetConnectionString());
                        uDC.Export_History(_securityID.ToString(), "", "CHANGEPASSWORD", null);
                        MessageBox.ShowBox("MessageID279", BMC_Icon.Information);
                        txtOldPassword.Password = "";
                        txtNewPassword.Password = "";
                        txtRetypePassword.Password = "";

                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {

                            AuditModuleName = ModuleName.Password,
                            Audit_Screen_Name = "ChangePassword",
                            Audit_Desc = "Password changed by user.",
                            AuditOperationType = OperationType.MODIFY
                        });

                        this.DialogResult = true;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID301", BMC_Icon.Information);
                        AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                        {

                            AuditModuleName = ModuleName.Password,
                            Audit_Screen_Name = "ChangePassword",
                            Audit_Desc = "Unable to change password.",
                            AuditOperationType = OperationType.MODIFY
                        });
                    }


                }
                catch (Exception ex)
                {
                    ExceptionManager.Publish(ex);

                    MessageBox.ShowBox("MessageID301", BMC_Icon.Information);
                    AuditViewerBusiness.InsertAuditData(new Audit.Transport.Audit_History
                    {

                        AuditModuleName = ModuleName.Password,
                        Audit_Screen_Name = "ChangePassword",
                        Audit_Desc = "Unable to change password.",
                        AuditOperationType = OperationType.MODIFY
                    });
                }

            }
            finally
            {
                btnOK.IsEnabled = true;
            }
          }