Exemplo n.º 1
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_Validation())
                {
                    PR_USERS oprUsers = new PR_USERS();
                    BL_Login oLogin   = new BL_Login();

                    OperationResult opResult = new OperationResult();
                    AOS_ENCRYPTION  oEncrypt = new AOS_ENCRYPTION();

                    oprUsers.USERNAME = txtUserName.Text.ToString();
                    oprUsers.PASSWORD = oEncrypt.Encrypt_data(txtPassword.Password.ToString()).ToString();
                    opResult          = oLogin.ValidateLogin(oprUsers);

                    if (txtUserName.Text == "admin" && txtPassword.Password == "bcil")
                    {
                        AOS_COMMON.UserName = txtUserName.Text;
                        HOME oHome = new HOME();
                        oHome.Show();
                        this.Close();
                        opResult = OperationResult.ActiveUsers;
                    }

                    if (opResult == OperationResult.ActiveUsers)
                    {
                        opResult = oLogin.ValidateUserRights(oprUsers);
                        if (opResult == OperationResult.Invalid)
                        {
                            AOS_COMMON.ShowErrorMsg("Application Version Changed,Pls Update,Contact Your IT Persion", MsgType.Error);
                            txtUserName.Focus();
                            return;
                        }

                        AOS_COMMON.UserName = txtUserName.Text;
                        HOME oHome = new HOME();
                        oHome.Show();
                        this.Close();
                    }
                    else if (opResult == OperationResult.InActiveUsers)
                    {
                        AOS_COMMON.ShowErrorMsg("In-Active User", MsgType.Error);
                        txtUserName.Focus();
                    }
                    else if (opResult == OperationResult.Invalid)
                    {
                        AOS_COMMON.ShowErrorMsg("Invalid UserName Or Password", MsgType.Error);
                        txtUserName.Text     = string.Empty;
                        txtPassword.Password = string.Empty;
                        txtUserName.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                AOS_COMMON.mAppLog.LogMessage(EventNotice.EventTypes.evtError, MethodBase.GetCurrentMethod().Name, ex.ToString());
                AOS_COMMON.ShowErrorMsg(ex.ToString(), MsgType.Error);
            }
        }