private void LoginApplication()
        {
            try
            {
               
                if (txtUname.Text == string.Empty)
                {
                    MessageBox.ShowBox("MessageID69", BMC_Icon.Information);
                    return;
                }
                if (txtPWD.Password == string.Empty)
                {
                    MessageBox.ShowBox("MessageID70", BMC_Icon.Information);
                    return;
                }

                if (ExchangeConfigRegistryEntities.ExchangeConnectionString == string.Empty || !isValidConnectionString ||
                    !DBSettings.GetSiteInfo() || !DBSettings.GetUserInfo())
                {
                    if (txtUname.Text.ToUpper() == "CASH" && txtPWD.Password.ToUpper() == "DESK")
                    {
                        var objMainScreen = new MainScreen { UserName = txtUname.Text };
                        objMainScreen.Show();
                        Hide();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID56", BMC_Icon.Error);
                    }
                }
                else
                {
                    var loginResult = Checkuser(txtUname.Text, txtPWD.Password);

                    if (loginResult == SecurityHelper.LoginResults.LoginSuccesful)
                    {
                        if (SecurityHelper.HasAccess("BMC.ExchangeConfig.Login"))
                        {
                            var objMainScreen = new MainScreen { UserName = SecurityHelper.CurrentUser.UserName };
                            objMainScreen.Show();
                            Hide();
                        }
                        else
                        {
                            MessageBox.ShowBox("MessageID105", BMC_Icon.Error, BMC_Button.OK);
                            return;
                        }
                       
                    }
                    else
                    {
                        if ((loginResult == SecurityHelper.LoginResults.PasswordExpired) || (loginResult == SecurityHelper.LoginResults.LoginReset))
                        {
                            if (loginResult == SecurityHelper.LoginResults.PasswordExpired)
                            {
                                MessageBox.ShowBox("MessageID71", BMC_Icon.Information);
                                this.Close();
                            }
                            else
                            {
                                MessageBox.ShowBox("MessageID72", BMC_Icon.Information);
                                this.Close();
                            }
                        }
                        else if (loginResult == SecurityHelper.LoginResults.MaxAttemptsExceeded)
                        {
                            MessageBox.ShowBox("MessageID73", BMC_Icon.Error);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.ShowBox("MessageID56", BMC_Icon.Error);
                        }
                    }
                }
            }
            catch (ArgumentNullException anex)
            {
                ExceptionManager.Publish(anex);
                MessageBox.ShowBox("MessageID87", BMC_Icon.Error);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID74", BMC_Icon.Error);
            }
        }
        private void LoginApplication()
        {
            try
            {
                if (txtUname.Text.ToUpper() == "BALLY")
                {
                    if (CheckBallyuser(txtUname.Text, txtPWD.Password))
                    {
                        var objMainScreen = new MainScreen { UserName = txtUname.Text };
                        objMainScreen.Show();
                        Hide();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID36", BMC_Icon.Error);
                    }
                }
                else
                {
                    var loginResult = Checkuser(txtUname.Text, txtPWD.Password);

                    if (loginResult == SecurityHelper.LoginResults.LoginSuccesful)
                    {
                        var objMainScreen = new MainScreen { UserName = SecurityHelper.CurrentUser.UserName };
                        objMainScreen.Show();

                        Hide();
                    }
                    else
                    {
                        if ((loginResult == SecurityHelper.LoginResults.PasswordExpired) || (loginResult == SecurityHelper.LoginResults.LoginReset))
                        {
                            if (loginResult == SecurityHelper.LoginResults.PasswordExpired)
                            {
                                MessageBox.ShowBox("MessageID30", BMC_Icon.Information);
                                this.Close();
                            }
                            else
                            {
                                MessageBox.ShowBox("MessageID31", BMC_Icon.Information);
                                this.Close();
                            }
                        }
                        else if (loginResult == SecurityHelper.LoginResults.MaxAttemptsExceeded)
                        {
                            MessageBox.ShowBox("MessageID32", BMC_Icon.Error);
                            this.Close();
                        }
                        else
                        {
                            MessageBox.ShowBox("MessageID17", BMC_Icon.Error);
                        }
                    }
                }
            }
            catch (ArgumentNullException anex)
            {
                ExceptionManager.Publish(anex);
                MessageBox.ShowBox("MessageID37", BMC_Icon.Error);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID33", BMC_Icon.Error);
            }
        }