private void xpButton18_Click(object sender, EventArgs e) { if (txtPassword.Text == txtConfirm.Text) { User us = new User(); if (userId != 0) { us.LoadByPrimaryKey(userId); string userName = us.UserName; us.GetUserByAccountInfo(userName, txtOldPass.Text);// .LoadByPrimaryKey(userId); if (us.RowCount > 0) { if (txtPassword.Text != "") { us.SavePassword(txtPassword.Text); } //us.Password = txtPassword.Text; us.Save(); XtraMessageBox.Show(@"Password changed!", @"Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("Old Password is not correct!", "Invaild Password", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Password doesnt match!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click(object sender, EventArgs e) { try { //string connectionString = GenerateConnString.GetFromRegistry(); string connectionString = Program.ConnStringManager.GetFromRegistry(); if(string.IsNullOrEmpty(connectionString)) //If the connection string hasn't been set, let's assume that the database is installed in the default location (ApplicationStartUpPath\Database\PharmInventory.mdf) { connectionString = Program.ConnStringManager.GenerateDefaultConnectionString(@".\SQLExpress", @"C:\Databases\FE\PharmInventory.mdf",false); Program.ConnStringManager.SaveToRegistry(connectionString); } MyGeneration.dOOdads.BusinessEntity.RegistryConnectionString = connectionString; User us = new User(); us.GetUserByAccountInfo(txtUsername.Text, txtPassword.Text); if (us.RowCount > 0) { //check for last date of backup and if old just do another one GeneralInfo info = new GeneralInfo(); info.LoadAll(); TimeSpan spanAfterBackup; int daysSinceBackup = -1; if (!info.IsColumnNull("LastBackUp")) { spanAfterBackup = DateTime.Now.Subtract(info.LastBackUp); daysSinceBackup = spanAfterBackup.Days; } if (daysSinceBackup > 7 || daysSinceBackup == -1) { HelperClasses.DatabaseHelpers.AutoBackUp(); } DatabaseHelpers.FixInconsistencies(); //Clean any database inconsistencies //XtraMessageBox.Show("Would you please chose the FE Settings", "Warning"); var mw = new MainWindow {UserId = MainWindow.LoggedinId = us.ID}; UsId = us.ID; mw.Show(); try { HelperClasses.RegistrationHelper.SendAdditionalData("LastLogin", DateTime.Now.ToString()); } catch { } YearEnd yEnd = new YearEnd(); if (yEnd.InventoryRequired(true)) { XtraMessageBox.Show("Inventory information has not been filled for the past fiscal year!", "Inventory Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.Hide(); } else { XtraMessageBox.Show("Invalid Username or Password!", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Stop); txtPassword.Text = ""; txtPassword.Focus(); } } catch { //Tools.GenerateConnString generator = new Tools.GenerateConnString(); //generator.ShowDialog(); Program.ConnStringManager.ShowDialog(); } }
private void BtnLoginClick(object sender, EventArgs e) { UserInformation userInfo = null; try { if (BLL.Settings.UseNewUserManagement) { userInfo = Auth.Authenticate(txtUsername.Text, txtPassword.Text); if (userInfo == null) { //errorLogger.SaveError(0, 1, 1, 2, "Login Attempt", "Warehouse", new InvalidCredentialException("Invalid credentials, Username = "******"", "", true, txtUsername.Text, Program.HCMISVersionString); if (XtraMessageBox.Show(@"Invalid Username or Password!", @"Login Failed", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.Cancel) { Application.Exit(); } else { } } } catch { if (System.Diagnostics.Debugger.IsAttached) { //ConnectionStringManager.ConnectionStringManager connMgr = // new ConnectionStringManager.ConnectionStringManager(Program.RegKey, // Program.PrevConnectionStringKey); //connMgr.ShowDialog(); } else { XtraMessageBox.Show("Network error. Please make sure your network connection is working.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Clear the login form txtPassword.Text = ""; txtUsername.Text = ""; txtUsername.Focus(); }
private void BtnLoginClick(object sender, EventArgs e) { UserInformation userInfo = null; try { if (BLL.Settings.UseNewUserManagement) { userInfo = Auth.Authenticate(txtUsername.Text, txtPassword.Text); if (userInfo == null) { //errorLogger.SaveError(0, 1, 1, 2, "Login Attempt", "Warehouse", new InvalidCredentialException("Invalid credentials, Username = "******"", "", true, txtUsername.Text, Program.HCMISVersionString); if (XtraMessageBox.Show(@"Invalid Username or Password!", @"Login Failed", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.Cancel) { Application.Exit(); } else { } } } catch { if (System.Diagnostics.Debugger.IsAttached) { //ConnectionStringManager.ConnectionStringManager connMgr = // new ConnectionStringManager.ConnectionStringManager(Program.RegKey, // Program.PrevConnectionStringKey); //connMgr.ShowDialog(); } else { XtraMessageBox.Show("Network error. Please make sure your network connection is working.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Clear the login form txtPassword.Text = ""; txtUsername.Text = ""; txtUsername.Focus(); }