public MainWindow()
 {
     InitializeComponent();
     connection = new HubConnection(@"http://iskenxan-001-site1.btempurl.com/signalr");
     myHub      = connection.CreateHubProxy("ChatHub");
     UserNameTextBox.Focus();
 }
Beispiel #2
0
        private void LoginButton_Click_1(object sender, EventArgs e)
        {
            if (IsValid())
            {
                using (SqlConnection con = new SqlConnection(ApplicationSettings.ConnectionString1()))
                {
                    using (SqlCommand cmd = new SqlCommand("usp_Login_verifyLoginDetails", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@UserName", UserNameTextBox.Text.Trim());
                        cmd.Parameters.AddWithValue("@Password", PasswordTextBox.Text.Trim());

                        con.Open();

                        SqlDataReader sdr = cmd.ExecuteReader();
                        if (sdr.Read())
                        {
                            //MessageBox.Show("Wel Come");
                            this.Hide();
                            DashboardForm df = new DashboardForm();
                            df.Show();
                        }
                        else
                        {
                            MessageBox.Show("User Name or Password is incorrect", "login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            UserNameTextBox.Focus();
                        }
                    }
                }
                //string constring = ApplicationSettings.ConnectionString();
                //MessageBox.Show(constring);
            }
        }
Beispiel #3
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            var userName = UserNameTextBox.Text.Trim();
            var password = PasswordBox.Password;

            MessageTextBlock.Text       = string.Empty;
            MessageTextBlock.Foreground = Brushes.Red;
            if (string.IsNullOrWhiteSpace(userName))
            {
                MessageTextBlock.Text = "* 请输入用户名";
                UserNameTextBox.Focus();
                return;
            }
            else if (password.Length == 0)
            {
                PasswordBox.Focus();
                return;
            }

            string mErrorMsg = string.Empty;

            if (LoginViewModel.Instance.Login(userName, password, out mErrorMsg))
            {
                MessageTextBlock.Text       = "登录成功,正在加载数据...";
                MessageTextBlock.Foreground = Brushes.Blue;
                this.DialogResult           = true;
                Close();
            }
            else
            {
                MessageTextBlock.Text       = mErrorMsg;
                MessageTextBlock.Foreground = Brushes.Red;
            }
        }
Beispiel #4
0
 private bool IsValidated()
 {
     try {
         if ((_LoginType != LoginType.AdminLogin) && (OrganizationComboBox.SelectedIndex == -1))
         {
             MessageBox.Show(this, "Please select the Organization.", _ApplicationName.Length > 0 ? _ApplicationName : DefaultApplicationInfo.FullApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             OrganizationComboBox.Focus();
             OrganizationComboBox.DroppedDown = true;
             return(false);
         }
         if (UserNameTextBox.Text.Length == 0)
         {
             MessageBox.Show(this, "Please enter the user name.", _ApplicationName.Length > 0 ? _ApplicationName : DefaultApplicationInfo.FullApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             UserNameTextBox.Focus();
             return(false);
         }
         if (PasswordTextBox.Text.Length == 0)
         {
             MessageBox.Show(this, "Please enter the password.", _ApplicationName.Length > 0 ? _ApplicationName : DefaultApplicationInfo.FullApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             PasswordTextBox.Focus();
             return(false);
         }
         return(true);
     } catch {
         throw;
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection  conn   = new SqlConnection(@"Data Source=trung;Initial Catalog=TechShop;Integrated Security=True");
            String         query  = "Select * from Users where userName = '******' and password ='******'";
            SqlDataAdapter sda    = new SqlDataAdapter(query, conn);
            DataTable      result = new DataTable();

            sda.Fill(result);
            if (IsFormValid())
            {
                if (result.Rows.Count == 1)
                {
                    userId      = result.Rows[0][0].ToString();
                    role        = result.Rows[0][3].ToString();
                    nameDisplay = UserNameTextBox.Text;
                    this.Hide();
                    DashBoardForm db = new DashBoardForm();
                    db.Show();
                }
                else
                {
                    MessageBox.Show("User name/Password is not correct.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    UserNameTextBox.Focus();
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         UserNameTextBox.Focus();
     }
 }
        protected bool ValidarUsuario()
        {
            Usuarios u   = new Usuarios();
            bool     yes = false;

            if (u.Listado("*", " NombreUsuario = '" + UserNameTextBox.Text + "'", "").Rows.Count > 0 && u.Listado("*", " Contraseña = '" + PassTextBox.Text + "'", "").Rows.Count > 0)
            {
                u.BuscarDuplicado(UserNameTextBox.Text);
                Utilitarios.Names     = u.Nombres;
                Utilitarios.UserName  = u.NombreUsuario;
                Utilitarios.Pass      = u.Contraseña;
                Utilitarios.Img       = u.Imagen;
                Utilitarios.Tipo      = u.IdTipo;
                Utilitarios.UsuarioID = u.UsuarioId;
                yes = true;
            }
            else
            {
                Utilitarios.ShowToastr(this, "Usuario o Contraseña incorrecta", "Mensaje", "error");
                UserNameTextBox.Text = "";
                PassTextBox.Text     = "";
                UserNameTextBox.Focus();
                yes = false;
            }

            return(yes);
        }
Beispiel #8
0
 private bool InvalidAction()
 {
     UserNameTextBox.Clear();
     PasswordTextBox.Clear();
     UserNameTextBox.Focus();
     return(false);
 }
Beispiel #9
0
        private void clearButton_Click(object sender, EventArgs e)
        {
            UserNameTextBox.Focus();

            UserNameTextBox.Clear();
            passwordTextBox.Clear();
        }
        public LogonWindow()
        {
            InitializeComponent();

            Messenger.Default.Register <ExceptionCausedApplicationShutdownMessage>(this, message => OnExceptionCausedApplicationShutdown(message));

            UserNameTextBox.Focus();
        }
Beispiel #11
0
        //Code manipulates UI Elements directly, hence placed here!

        private void UserNameEditIcon_OnTapped(object sender, TappedRoutedEventArgs e)
        {
            UserNameTextBox.Visibility   = Visibility.Visible;
            UserNameTextBlock.Visibility = Visibility.Collapsed;
            UserNameEditIcon.Visibility  = Visibility.Collapsed;
            UserNameSaveIcon.Visibility  = Visibility.Visible;
            UserNameTextBox.Focus(FocusState.Pointer);
        }
Beispiel #12
0
        public LoginWindow()
        {
            InitializeComponent();
            UserNameTextBox.Focus();
            db = new hotelEntities2();
            List <Remember> r = LoginWindow.db.Remember.Select(x => x).ToList();

            UserNameTextBox.Text         = r[0].Login;
            PasswordPasswordBox.Password = r[0].Password;
        }
Beispiel #13
0
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     if (UserNameTextBox.Text == "" || PasswordBox.Password == "" || ConfirmPasswordBox.Password == "" || EmailTextBox.Text == "")
     {
         if (UserNameTextBox.Text == "")
         {
             UserNameTextBox.Background = Brushes.Red;
         }
         if (PasswordBox.Password == "")
         {
             PasswordBox.Background = Brushes.Red;
         }
         if (ConfirmPasswordBox.Password == "")
         {
             ConfirmPasswordBox.Background = Brushes.Red;
         }
         if (EmailTextBox.Text == "")
         {
             EmailTextBox.Background = Brushes.Red;
         }
         MessageBox.Show("U moet een Username en Wachtwoord invoeren!", "Let op!", MessageBoxButton.OK,
                         MessageBoxImage.Exclamation);
     }
     else
     {
         if (_userBus.UsernameExist(UserNameTextBox.Text) == false)
         {
             if (Validation.IsValidEmail(EmailTextBox.Text))
             {
                 var _user = new User();
                 _user.Username = UserNameTextBox.Text;
                 _user.Password = PasswordStorage.CreateHash(PasswordBox.Password);
                 _user.Email    = EmailTextBox.Text;
                 _user.Role     = "User";
                 _userBus.Create(_user);
                 MessageBox.Show("User created");
             }
             else
             {
                 EmailTextBox.Background = Brushes.Red;
                 EmailTextBox.SelectAll();
                 EmailTextBox.Focus();
             }
         }
         else
         {
             MessageBox.Show("Deze Username is al in gebruik!", "Let op!", MessageBoxButton.OK,
                             MessageBoxImage.Exclamation);
             UserNameTextBox.Background = Brushes.Red;
             UserNameTextBox.SelectAll();
             UserNameTextBox.Focus();
         }
     }
 }
        private LibraryClientController controller;  //Holds a reference to controller for Library Client

        /// <summary>
        /// Constructor for LogIn
        /// Initializes fields and preps window for user interaction
        /// </summary>
        /// <param name="controller">controller for Library Client</param>
        public LogIn(LibraryClientController controller)
        {
            InitializeComponent();

            //initialize field
            this.controller = controller;

            //prep controls
            ErrorLabel.Content   = string.Empty;
            UserNameTextBox.Text = string.Empty;

            UserNameTextBox.Focus();
        }
 private void UserNameTextBox_Validating(object sender, CancelEventArgs e)
 {
     if (string.IsNullOrEmpty(UserNameTextBox.Text))                        //checking wether the textbox is empty or not.
     {
         e.Cancel = true;                                                   // here e is the event .
         UserNameTextBox.Focus();
         errorProvider1.SetError(UserNameTextBox, "Please enter username"); // when username textfield is empty and on hover on the exclamation throws the above mentioned messsage.
     }
     else
     {
         e.Cancel = false;
         errorProvider1.SetError(UserNameTextBox, null);
     }
 }
Beispiel #16
0
        public LoginView()
        {
            InitializeComponent();

            if (string.IsNullOrEmpty(UserNameTextBox.Text))
            {
                UserNameTextBox.Focus();
            }

            else
            {
                Keyboard.Focus(PasswordTextBox);
            }
        }
Beispiel #17
0
 private void cFRT150010_Load(object sender, EventArgs e)
 {
     ArgumentSystem.Arguments arg = new ArgumentSystem.Arguments();
     if (arg.ValidLicense())
     {
         BussinesLayer.GlobalBLL.userML = null;
         DatetoolStripStatusLabel.Text  = DateTime.Now.ToLongDateString();
         UserNameTextBox.Focus();
     }
     else
     {
         Application.Exit();
     }
 }
        public bool Validar()
        {
            Usuarios u   = new Usuarios();
            bool     yes = true;

            if (u.Listado("*", " NombreUsuario = '" + UserNameTextBox.Text + "'", "").Rows.Count > 0)
            {
                Utilitarios.ShowToastr(this, "Nombre de Usuario en uso", "Mensaje", "info");
                yes = false;
                UserNameTextBox.Text = "";
                UserNameTextBox.Focus();
            }

            return(yes);
        }
        public LoginWindow()
        {
            InitializeComponent();

            DataContext = Noanet.XamArch.Mvvm.Services.ServiceLocator.Current.GetInstance <LogInViewModel>();

            UserNameTextBox.Focus();

            this.Subscribe <Logic.Validations.AuthenticationResult>(authenticationResult => {
                if (authenticationResult.ValidationResult == Noanet.XamArch.Logic.ValidationResult.Success)
                {
                    Close();
                }
            });
        }
Beispiel #20
0
 private bool IsValid()
 {
     if (UserNameTextBox.Text.Trim() == string.Empty)
     {
         MessageBox.Show("User Name is required!", "Form validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         UserNameTextBox.Focus();
         return(false);
     }
     if (PasswordTextBox.Text.Trim() == string.Empty)
     {
         MessageBox.Show("Password is required!", "Form validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         PasswordTextBox.Focus();
         return(false);
     }
     return(true);
 }
Beispiel #21
0
 private void AfterRegistration(bool isSucceed)
 {
     if (isSucceed)
     {
         Connection1.Stop();
         Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
         {
             SignupGrid.Visibility = Visibility.Collapsed;
             SuccessFullRegistrationtxtBlock.Visibility = Visibility.Visible;
             SuccessFullRegistrationtxtBlock.Text = "Registration successful. Login to continue.";
             LoginGrid.Visibility = Visibility.Visible;
             UserNameTextBox.Focus();
             PasswordTextBox.Focus();
         }));
     }
 }
Beispiel #22
0
        // Initialize Window and assign variables
        public LoginWindow(MainWindow mainWindow)
        {
            InitializeComponent();
            _mainWindow = mainWindow;

            UserNameTextBox.Focus();

            // Auto Login
            _useAdminCreds = false;

            if (_useAdminCreds)
            {
                UserNameTextBox.Text = "Admin";
                PasswordTextBox.Text = "Passw0rd";
            }
        }
Beispiel #23
0
        private void Bind()
        {
            UserNameTextBox.Focus();
            IdentifyingCode ic = new IdentifyingCode();

            identifyingCode = ic.IdentifyingCodeStringGenerate();
            try
            {
                IdentifyingCodePictureBox.BackgroundImage = ic.IdentifyingCodeImageGenerate(identifyingCode);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ToolTip.SetToolTip(IdentifyingCodePictureBox, "Click to change");
        }
Beispiel #24
0
 private void SignInButton_Click(object sender, EventArgs e)
 {
     if (!isValid())
     {
         MessageBox.Show("Please Fill User Name OR Password", "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         try
         {
             bool IsUserNameCurrect, IsPasswordCurrect;
             GetIsUserLoginCurrect(out IsUserNameCurrect, out IsPasswordCurrect);
             if (IsUserNameCurrect && IsPasswordCurrect)
             {
                 Expanses Exp = new Expanses();
                 Exp.Show();
                 this.Hide();
             }
             else
             {
                 if (!IsUserNameCurrect)
                 {
                     MessageBox.Show("User Name is Not Currect.", "Error",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                     UserNameTextBox.Clear();
                     PasswordTextBox.Clear();
                     UserNameTextBox.Focus();
                 }
                 else
                 {
                     MessageBox.Show("Password is Not Currect.", "Error",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                     PasswordTextBox.Clear();
                     PasswordTextBox.Focus();
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error" + ex.Message, "Error",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
 private bool IsValidated()
 {
     try {
         if (LicenseFileTextBox.Text.Length == 0)
         {
             MessageBox.Show(this, "Please enter the License File.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             LicenseFileTextBox.Focus();
             BrowseLicenseFile();
             return(false);
         }
         if (!File.Exists(LicenseFileTextBox.Text))
         {
             MessageBox.Show(this, "Can not find the License File.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             LicenseFileTextBox.Focus();
             BrowseLicenseFile();
             return(false);
         }
         if (CompanyNameTextBox.Text.Length == 0)
         {
             MessageBox.Show(this, "Please enter Company Name.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             CompanyNameTextBox.Focus();
             return(false);
         }
         if (UserNameTextBox.Text.Length == 0)
         {
             MessageBox.Show(this, "Please enter User Name.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             UserNameTextBox.Focus();
             return(false);
         }
         if (EmailTextBox.Text.Length == 0 ||
             !Regex.IsMatch(EmailTextBox.Text, @"^(([^<>()[\]\\.,;:\s@\""]+"
                            + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
                            + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
                            + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
                            + @"[a-zA-Z]{2,}))$"))
         {
             MessageBox.Show(this, "Please enter a valid Email Address.", _ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             EmailTextBox.Focus();
             return(false);
         }
         return(true);
     } catch {
         throw;
     }
 }
Beispiel #26
0
        private void ResetFormControl()
        {
            UserNameTextBox.Clear();
            PasswordTextBox.Clear();
            RolesComboBox.SelectedIndex = 0;
            IsActiveCheckBox.Checked    = true;
            DescriptionTextBox.Clear();

            UserNameTextBox.Focus();

            if (this.IsUpdate)
            {
                this.IsUpdate        = false;
                SaveButton.Text      = "Save User Information";
                DeleteButton.Enabled = false;
                this.UserName        = null;
            }
        }
        private void LoginButton_Click(object sender, EventArgs e)
        {
            //check username and password is empty or not
            if (string.IsNullOrEmpty(UserNameTextBox.Text) || string.IsNullOrEmpty(PasswordTextBox.Text))
            {
                if (string.IsNullOrEmpty(UserNameTextBox.Text))
                {
                    UserNameTextBox.Focus();
                    errorProvider1.SetError(UserNameTextBox, "Please enter username");
                }//end of string.IsNullOrEmpty(UserNameTextBox.Text))
                else
                {
                    PasswordTextBox.Focus();
                    errorProvider1.SetError(PasswordTextBox, "Please enter password");
                }////end of settinng password text box error
            }
            else
            {
                LoginDal logInDataAccess = new LoginDal(); //  created an object to invoke the login data access connection in the DAL.
                Login    _loginDetails   = new Login
                {
                    UserName = UserNameTextBox.Text,
                    PassWord = PasswordTextBox.Text
                };

                int recordsCount = logInDataAccess.GetuserDetails(_loginDetails); //this statement acts multipurpose  1)recordsCount acts as variable for checking number of rows retrived      2) for validating the entered user details

                if (recordsCount > 0)                                             // when the username and password matches one row will be retrived from the database so count is > 0
                {
                    this.Hide();

                    AdminMenuForm menuFm = new AdminMenuForm();
                    menuFm.Closed += (s, args) => this.Close(); // if username and password matches by using delegate property the current form will be hidden and admin menu form is shown.
                    menuFm.Show();
                }
                else
                {
                    ErrorMessagelabel.Visible = true;
                    //MessageBox.Show("Please enter Correct Username and Password");
                    // errorProvider1.SetError(UserNameTextBox, "User Name is Invaldi");
                }
            }
        }
        private bool IsFormValid()
        {
            if (UserNameTextBox.Text.Trim() == String.Empty)
            {
                MessageBox.Show("User name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                UserNameTextBox.Clear();
                UserNameTextBox.Focus();
                return(false);
            }

            if (PasswordTextBox.Text.Trim() == String.Empty)
            {
                MessageBox.Show("Password is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PasswordTextBox.Clear();
                PasswordTextBox.Focus();
                return(false);
            }
            return(true);
        }
Beispiel #29
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (String.IsNullOrWhiteSpace(UserNameTextBox.Text.Trim()) == false && String.IsNullOrWhiteSpace(PasswordBox.Password) == false)
     {
         App.configurationViewModel.UserName = UserNameTextBox.Text.Trim();
         App.configurationViewModel.Password = PasswordBox.Password.Trim();
     }
     else
     {
         if (String.IsNullOrWhiteSpace(UserNameTextBox.Text.Trim()))
         {
             UserNameTextBox.Focus();
         }
         else
         {
             PasswordBox.Focus();
         }
     }
 }
        private bool isFormValid()
        {
            if (UserNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("User name is not correct");
                UserNameTextBox.Clear();
                UserNameTextBox.Focus();
                return(false);
            }

            if (PasswordTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Password is not correct");
                PasswordTextBox.Clear();
                PasswordTextBox.Focus();
                return(false);
            }

            return(true);
        }