private void ButtonRegister_Click(object sender, EventArgs e) { if (!ValidateRegister()) { MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxName.Focus(); return; } Manager.Name = TextBoxName.Text; Manager.Username = TextBoxUsername.Text; Manager.Password = TextBoxPassword.Text; Manager.Enabled = true; Manager.CreatedAt = DateTime.Now; Manager.UpdatedAt = DateTime.Now; try { DAO.Managers.Add(Manager); MessageBox.Show("Bem-vindo a Prophet Shop, " + Manager.Name + "!", "", MessageBoxButtons.OK); Close(); } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxUsername.Focus(); return; } }
private bool ValidateLogin() { try { if (!ValidateUsername()) { MessageBox.Show("Nome de usuário indisponível.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); TextBoxUsername.Focus(); return(false); } } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxUsername.Focus(); return(false); } if (!ValidateCurrentPassword()) { MessageBox.Show("A senha atual não confere.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); TextBoxUsername.Focus(); return(false); } return(true); }
private void ButtonPopup_Click(object sender, RoutedEventArgs e) { ApplicationTitle.Text = " "; popupCredentails.IsOpen = true; LayoutRoot.IsHitTestVisible = false; ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true; ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true; TextBoxUsername.Focus(); }
private void metroTileChange_Click(object sender, EventArgs e) { int rows = 0; if (TextBoxUsername.Text == "" || !isUsernameValid()) { MessageBox.Show("Username is not valid"); TextBoxUsername.Focus(); } else if (!isCurrentUser()) { MessageBox.Show("You can't change password for " + TextBoxUsername.Text + "\nYou should logon as " + TextBoxUsername.Text + " to change its password"); } else if (TextBoxOldPword.Text == "" || !isOldPasswordValid()) { MessageBox.Show("Old password is not valid"); TextBoxOldPword.Focus(); } else if (TextBoxNewPword.Text == "") { MessageBox.Show("You should enter new password"); TextBoxNewPword.Focus(); } else if (TextBoxConfirmPword.Text == "") { MessageBox.Show("You should confirm new password"); TextBoxConfirmPword.Focus(); } else if (TextBoxNewPword.Text != TextBoxConfirmPword.Text) { MessageBox.Show("Passwords do not match"); TextBoxConfirmPword.Focus(); } else { try { rows = changePTA.UpdatePassword(TextBoxNewPword.Text, TextBoxUsername.Text); } catch (Exception ex) { MessageBox.Show("Error changing password:\n" + ex.Message.ToString()); } if (rows > 0) { MessageBox.Show("Password has been changed successfully"); ClearControls(); } else { MessageBox.Show("Password not updated"); } } }
protected void BtnResetUserPassword_Click(object sender, EventArgs e) { string UserName2 = TextBoxUsername.Text.Trim(); string EmailEntered = TextBoxEmail.Text.Trim(); if (UserName2.Equals("")) { ShowMessage("Please Enter your System Username", true); TextBoxUsername.Focus(); } else if (EmailEntered.Equals("")) { ShowMessage("Please Enter Your System Email", true); TextBoxEmail.Focus(); } else { dataTable = datafile.GetUserPassword(UserName2, EmailEntered); SystemUser user = new SystemUser(); if (dataTable.Rows.Count > 0) { user.Userid = int.Parse(dataTable.Rows[0]["Userid"].ToString()); user.Email = dataTable.Rows[0]["UserEmail"].ToString(); user.Fname = dataTable.Rows[0]["FirstName"].ToString(); user.Uname = dataTable.Rows[0]["UserName"].ToString(); user.Sname = dataTable.Rows[0]["SurName"].ToString(); user.Oname = dataTable.Rows[0]["OtherName"].ToString(); string passwd = bll.PasswdString(8); user.Passwd = bll.EncryptString(passwd); /// Reset Password datafile.ResetPassword(user); // DataLogin gg = new DataLogin(); string Subject = "New PegPay Portal Credentials"; string Body = "Hello\t" + user.Fname + "\t" + user.Sname + "\t" + user.Oname + "<br></br><br></br>" + "Please Find Below your New Portal Credentials" + "<br></br><br></br>" + "Username:\t" + user.Uname + "<br></br><br></br>" + "Password:\t" + passwd + "<br></br><br></br><br></br>Thank You" + "<br></br><b></br><b></br>Pegasus Technologies"; SendMail mm = new SendMail(); mm.SendUserEmail(user.Email, Subject, Body); ShowMessage1("Hello\t" + user.Fname + "\t" + user.Sname + "\t" + user.Oname + "\t your new credentials have been sent to your Email", true); MultiView1.ActiveViewIndex = 0; } else { ShowMessage("Your Username and Email are not corresponding", true); ClearControls(); MultiView1.ActiveViewIndex = 2; } } }
protected void Page_Load(object sender, EventArgs e) { objMedicationLogin = new Streamline.UserBusinessServices.MedicationLogin(); try { DataSet datasetSystemConfigurationKeys = null; Streamline.DataService.SharedTables objSharedTables = new Streamline.DataService.SharedTables(); datasetSystemConfigurationKeys = objSharedTables.GetSystemConfigurationKeys(); _logoPath = objSharedTables.GetSystemConfigurationKeys("CustomLogoPath", datasetSystemConfigurationKeys.Tables[0]); if (_logoPath == null) { _logoPath = "App_Themes/Includes/Images/logo.gif"; } ButtonOk.Attributes.Add("onclick", "var varValidate=Validates(); return varValidate;"); //-----------Code Adedd by Pradeep as per task#3329 on 3 March 2011 Start over here Session["DataSetPrescribedClientMedications"] = null; //-----------Code Adedd by Pradeep as per task#3329 on 3 March 2011 End over here if (!IsPostBack) { CommonFunctions.Event_Trap(this); //TextBoxUsername.Text = objMedicationLogin.getLastUserName().Trim(); TextBoxUsername.Focus(); HiddenFieldUseName.Value = TextBoxUsername.Text; //TextBoxPassword.Focus(); DivLogin.Style.Add("display", "block"); } } catch (Exception ex) { if (ex.Data["CustomExceptionInformation"] == null) { ex.Data["CustomExceptionInformation"] = "###Source Function Name - MedicationLogin--Page_Load(), ParameterCount -0 ###"; } else { ex.Data["CustomExceptionInformation"] = ""; } if (ex.Data["DatasetInfo"] == null) { ex.Data["DatasetInfo"] = null; } Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this); } finally { objMedicationLogin = null; } //Below code was added by Vithobha for Engineering Improvement Initiatives- NBL(I): #283 In Rx login page(Chrome) after entering Usernae/Password and on enter Key, Password was clearing Page.Form.DefaultFocus = TextBoxUsername.UniqueID; Page.Form.DefaultButton = ButtonLogon.UniqueID; }
private void ButtonSave_Click(object sender, EventArgs e) { if (!ValidateProfile()) { MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } if (!ValidateLogin()) { return; } if (!ValidateInfo()) { return; } Customer.Username = TextBoxUsername.Text; if (!TextBoxNewPassword.Text.Equals("") && TextBoxNewPassword.Text != null) { Customer.Password = Util.Encryptor.MD5Hash(TextBoxNewPassword.Text); } Customer.Name = TextBoxName.Text; Customer.Document = TextBoxDocument.Text; Customer.Email = TextBoxEmail.Text; Customer.Phone = TextBoxPhone.Text; Customer.Address.Name = TextBoxAddressName.Text; Customer.Address.ZipCode = TextBoxAddressZipCode.Text; Customer.Address.City = ComboBoxAddressCity.GetItemText(ComboBoxAddressCity.SelectedItem); Customer.Address.State = ComboBoxAddressState.GetItemText(ComboBoxAddressState.SelectedItem); try { DAO.Customers.Update(Customer); Main.Menu.Customer = Customer; Main.Menu.UpdateView(); Close(); } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxUsername.Focus(); return; } }
private void Login() { var online = true; if (TextBoxUsername.Text == "") { labelLogin.Text = "Username cannot be empty"; return; } if (TextBoxPassword.Text == "") { labelLogin.Text = "Password cannot be empty"; return; } try { _user = Database.SearchByUsername(TextBoxUsername.Text) ?? null; } catch (SqlException) { online = false; _user = new User { Name = TextBoxUsername.Text }; } if (_user == null) { labelLogin.Text = "user '" + TextBoxUsername.Text + "' not found"; TextBoxUsername.Clear(); TextBoxPassword.Clear(); TextBoxUsername.Focus(); return; } if (online && !_user.CheckPassword(TextBoxPassword.Text)) { labelLogin.Text = "wrong password :("; TextBoxPassword.Text = ""; TextBoxPassword.Focus(); return; } StartGame(online); }
private void ButtonLogin_Click(object sender, EventArgs e) { if (!ValidateUsername()) { MessageBox.Show("Insira seu nome de usuário.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } if (!ValidatePassword()) { MessageBox.Show("Insira sua senha.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } try { Manager manager = DAO.Managers.FindOneByLogin(TextBoxUsername.Text, TextBoxPassword.Text); if (manager != null) { Session.Login(manager); FormDashboard dashboard = new FormDashboard(); Main.Hide(); Hide(); dashboard.ShowDialog(); Main.Reset(); Main.Show(); Close(); } else { MessageBox.Show("Nome de usuário e/ou senha inválidos.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } TextBoxUsername.Focus(); }
private void ButtonLogin_Click(object sender, EventArgs e) { if (!ValidateUsername()) { MessageBox.Show("Insira seu nome de usuário.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } if (!ValidatePassword()) { MessageBox.Show("Insira sua senha.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } try { Customer customer = DAO.Customers.FindOneByLogin(TextBoxUsername.Text, TextBoxPassword.Text); if (customer != null) { Session.Login(customer); Main.Menu.Customer = (Customer)Session.User; Main.Menu.UpdateView(); if (Login != null) { Hide(); Login(this, EventArgs.Empty); } Close(); } else { MessageBox.Show("Nome de usuário e/ou senha inválidos.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } TextBoxUsername.Focus(); }
private void ButtonStepOne_Click(object sender, EventArgs e) { if (!ValidateStepOne()) { MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxUsername.Focus(); return; } try { if (!ValidateUsername()) { MessageBox.Show("Nome de usuário indisponível.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); TextBoxUsername.Focus(); return; } } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxUsername.Focus(); return; } if (!ValidateEqualityPasswords()) { MessageBox.Show("As senhas não conferem.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); TextBoxUsername.Focus(); return; } Customer.Username = TextBoxUsername.Text; Customer.Password = TextBoxPassword.Text; PanelStepOne.Visible = false; PanelStepTwo.Visible = true; AcceptButton = ButtonStepTwo; }
private void ButtonRegister_Click(object sender, EventArgs e) { if (!ValidateStepThree()) { MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxAddressName.Focus(); return; } TextBoxAddressName.Focus(); Customer.Address = new Address(); Customer.Address.Name = TextBoxAddressName.Text; Customer.Address.ZipCode = TextBoxAddressZipCode.Text; Customer.Address.City = ComboBoxAddressCity.GetItemText(ComboBoxAddressCity.SelectedItem); Customer.Address.State = ComboBoxAddressState.GetItemText(ComboBoxAddressState.SelectedItem); Customer.Enabled = true; Customer.CreatedAt = DateTime.Now; Customer.UpdatedAt = DateTime.Now; try { DAO.Customers.Add(Customer); MessageBox.Show("Bem-vindo " + Customer.Name + "!", "", MessageBoxButtons.OK); Session.Login(Customer); Main.Menu.Customer = Customer; Main.Menu.UpdateView(); Close(); } catch { MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxUsername.Focus(); return; } }
private async void btLogin_Click(object sender, RoutedEventArgs e) { var sc = ServerConnection.CurrentInstance ?? new ServerConnection(); UserClient = new Client(); SettingHandler.SetIpPort(TbIpPort.Text); if (TextBoxUsername.Text.Length == 0) { Errormessage.Text = "Please enter a Username."; TextBoxUsername.Focus(); return; } Errormessage.Text = ""; BiBusy.IsBusy = true; //Force UI Redraw Dispatcher.Invoke(() => { }, DispatcherPriority.ContextIdle); UserClient.UserName = TextBoxUsername.Text; UserClient.EncPassword = new Encryption(PasswordBox1.Password).EncryptStringToBytes(PasswordBox1.Password); var successfullLogin = await sc.TryLogin(UserClient); if (successfullLogin) { var mw = new MainWindow { LocalCient = UserClient }; SettingHandler.SetIsLoggedIn(true); mw.Show(); Close(); } else { BiBusy.IsBusy = false; } }
protected void RepeaterTransaksi_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Batal") { HiddenFieldIDTransaksi.Value = e.CommandArgument.ToString(); LabelKeterangan.Text = "Batal Transaksi #" + e.CommandArgument.ToString(); PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"]; Konfigurasi_Class Konfigurasi_Class = new Konfigurasi_Class(Pengguna.IDGrupPengguna); if (Konfigurasi_Class.ValidasiKonfigurasi(EnumKonfigurasi.MembatalkanTransaksi)) { BatalTransaksi(); } else { TextBoxUsername.Text = string.Empty; TextBoxPassword.Text = string.Empty; TextBoxUsername.Focus(); ModalPopupExtenderSupervisor.Show(); } } }
private void ButtonCreercompte_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //Exceptions if (TextBoxUserFirstname.Text.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox TextBoxUserFirstname.Focus(); } else if (TextBoxUserSecondname.Text.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox TextBoxUserSecondname.Focus(); } else if (TextBoxUsername.Text.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox TextBoxUsername.Focus(); } else if (PasswordBoxMotdepasse.Password.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox PasswordBoxMotdepasse.Focus(); } else if (PasswordBoxMotdepasseC.Password.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox PasswordBoxMotdepasseC.Focus(); } else if (TextBoxEmail.Text.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox TextBoxEmail.Focus(); } else if (TextBoxNumerodetelephone.Text.Length == 0) { //Envoyez une notification //Concentrez sur ce textbox TextBoxNumerodetelephone.Focus(); } //else if ((!Regex.IsMatch(TextBoxEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) // { //Envoyez une notification // MessageBox.Show("Enter a valid email."); // TextBoxEmail.Select(0, TextBoxEmail.Text.Length); // TextBoxEmail.Focus(); //} //Verification des mots de passe else { string _password = PasswordBoxMotdepasse.Password; string _passwordC = PasswordBoxMotdepasseC.Password; if (_password != _passwordC) { //Concentrez sur ce PasswordBox PasswordBoxMotdepasse.Focus(); MessageBox.Show("Mot de passe différent dans le deuxième champ"); return; } //Création du compte string UserFirstname = TextBoxUserFirstname.Text; string UserSecondname = TextBoxUserSecondname.Text; string Username = TextBoxUsername.Text; string mail = TextBoxEmail.Text; string phonenumber = TextBoxNumerodetelephone.Text; string password = PasswordBoxMotdepasse.Password; User user = new User(); user.userFirstName = UserFirstname; user.userSecondName = UserSecondname; user.userName = Username; user.userMail = mail; user.phoneNumber = phonenumber; user.pathOfPicture = this.profilePicTextBox.Text; if (user.pathOfPicture != "" && !File.Exists(user.pathOfPicture)) { MessageBox.Show("Veuillez introduire un lien correct vers l'image"); return; } user.Activities["Activité scolaire"] = "#ff5722"; bool b = DataSupervisor.ds.CreateAccount(user, password); if (b == false) { MessageBox.Show("Nom d'utilisateur déjà existant"); return; } TextBoxNumerodetelephone.Text = ""; TextBoxEmail.Text = ""; TextBoxUserFirstname.Text = ""; TextBoxUsername.Text = ""; TextBoxUserSecondname.Text = ""; profilePicTextBox.Text = ""; PasswordBoxMotdepasse.Password = ""; PasswordBoxMotdepasseC.Password = ""; MainWindow.mw.SignIn(); } }
protected void Page_Load(object sender, EventArgs e) { TextBoxUsername.Focus(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region GENERATE STORE KEY using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true); ClassStoreKey.Generate(); EnumAlert enumAlert = ClassStoreKey.Validasi(); if (enumAlert == EnumAlert.danger) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ClassStoreKey.MessageDanger); } else if (enumAlert == EnumAlert.warning) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Warning, ClassStoreKey.MessageWarning); } else { LiteralWarning.Text = ""; } } #endregion TextBoxUsername.Focus(); if (Request.QueryString["do"] == "logout") { PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"]; if (Pengguna != null) { //menambah LogPengguna tipe Logout : 2 LogPengguna.Tambah(2, Pengguna.IDPengguna); //MENGHAPUS SESSION Session.Abandon(); //MENGHAPUS COOKIES Response.Cookies["WITEnterpriseSystem"].Value = string.Empty; Response.Cookies["WITEnterpriseSystem"].Expires = DateTime.Now.AddDays(-1); if (Pengguna.PointOfSales == TipePointOfSales.Retail) //RETAIL KEMBALI KE HALAMAN LOGIN { Response.Cookies["WMSLogin"].Value = string.Empty; Response.Cookies["WMSLogin"].Expires = DateTime.Now.AddDays(-1); } else if (Pengguna.PointOfSales == TipePointOfSales.Restaurant) //RESTAURANT KEMBALI KE HALAMAN LOGIN PIN { //JIKA VALUE COOKIES ADA MELAKUKAN ENCRYPT string[] value = EncryptDecrypt.Decrypt(Request.Cookies["WMSLogin"].Value).Split('|'); //AMBIL VALUE TANGGAL DAN TANGGAL HARI INI HARUS LEBIH KECIL DARI VALUE COOKIES if (DateTime.Now <= value[0].ToDateTime()) { Response.Redirect("LoginPIN.aspx"); } } } } else { Redirect(); } } }