private void TxtBoxPasswordConfirm_Validating(object sender, CancelEventArgs e) { if (!String.IsNullOrWhiteSpace(TxtBoxPassword.Text.Trim())) { if (string.IsNullOrWhiteSpace(TxtBoxPasswordConfirm.Text.Trim())) { TxtBoxPasswordConfirm.Focus(); TxtBoxerrorProvider.SetError(TxtBoxPasswordConfirm, ClsAppMsgs.RequiredFieldErrorMsg); TxtBoxPasswordConfirm.BackColor = System.Drawing.Color.Red; TxtBoxPasswordConfirm.BorderThickness = 2; TxtBoxPasswordConfirm.BorderColor = Color.Red; TxtBoxPasswordConfirm.PlaceholderForeColor = ColorTranslator.FromHtml("#ff0033"); TxtBoxPasswordConfirm.Font = new Font("Changa", 11, FontStyle.Bold); } else { TxtBoxerrorProvider.Clear(); TxtBoxPasswordConfirm.BorderThickness = 1; TxtBoxPasswordConfirm.BorderColor = ColorTranslator.FromHtml("#0CBCB2"); TxtBoxPasswordConfirm.BackColor = ColorTranslator.FromHtml("#FFFFFF"); TxtBoxPasswordConfirm.ForeColor = ColorTranslator.FromHtml("#0CBCB2"); TxtBoxPasswordConfirm.Font = new Font("Changa", 9, FontStyle.Regular); } } }
private async void button1_Click(object sender, EventArgs e) { String SUN = txtBoxScreenUserName.Text.Trim(); String UEA = txtBoxUserEmail.Text.Trim(); String Pwd = "12345"; int URID = 1; UserAccount userAccountObj = new UserAccount { ScreenUserName = SUN, UserEmailAddress = UEA, Password = Pwd, UserRoleID = URID, }; String ErrorMsg = "!..هذا الحقل مطلوب"; if (UserInterfaceValidatorObj.TxtBoxValidator(SUN) == 1) { txtBoxScreenUserName.Focus(); TxtBoxerrorProvider.SetError(txtBoxScreenUserName, ErrorMsg); txtBoxScreenUserName.FlatAppearance.BorderSize = 2; txtBoxScreenUserName.FlatAppearance.BorderColor = Color.Red; txtBoxScreenUserName.BackColor = ColorTranslator.FromHtml("#ff0033"); txtBoxScreenUserName.ForeColor = ColorTranslator.FromHtml("#ffcdc9"); txtBoxScreenUserName.Font = new Font("", 10, FontStyle.Bold); return; } else if (UserInterfaceValidatorObj.EmailValidator(UEA)) { TxtBoxerrorProvider.Clear(); txtBoxScreenUserName.FlatAppearance.BorderSize = 1; txtBoxScreenUserName.FlatAppearance.BorderColor = ColorTranslator.FromHtml("#252526"); txtBoxScreenUserName.BackColor = ColorTranslator.FromHtml("#f0f0f0"); txtBoxScreenUserName.ForeColor = ColorTranslator.FromHtml("#000000"); txtBoxScreenUserName.Font = new Font("", 9, FontStyle.Regular); try { ClsUserAccountsServices.Insert(userAccountObj); MessageBox.Show("تم تسجيل البيانات بنجاح", "رسـالـة تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("حدثت مشكلة أثناء تخزين البيانات", "رسـالـة تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(" !..غـير صحيح " + UEA + " :هذا الإدخـال", "رسـالـة تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Common_TxtBoxValidating(object sender, CancelEventArgs e) { if (sender is Guna2TextBox ValidatingTxtBox) { if (string.IsNullOrWhiteSpace(ValidatingTxtBox.Text)) { ValidatingTxtBox.Focus(); TxtBoxerrorProvider.SetError((Guna2TextBox)sender, ClsAppMsgs.RequiredFieldErrorMsg); ValidatingTxtBox.BackColor = System.Drawing.Color.Red; ValidatingTxtBox.BorderThickness = 2; ValidatingTxtBox.BorderColor = Color.Red; ValidatingTxtBox.PlaceholderForeColor = ColorTranslator.FromHtml("#ff0033"); ValidatingTxtBox.Font = new Font("Changa", 11, FontStyle.Bold); } else { TxtBoxerrorProvider.Clear(); ValidatingTxtBox.BorderThickness = 1; ValidatingTxtBox.BorderColor = ColorTranslator.FromHtml("#0CBCB2"); ValidatingTxtBox.BackColor = ColorTranslator.FromHtml("#FFFFFF"); ValidatingTxtBox.ForeColor = ColorTranslator.FromHtml("#0CBCB2"); ValidatingTxtBox.Font = new Font("Changa", 9, FontStyle.Regular); } } if (sender is Guna2ComboBox ValidatingCombBox) { if (ValidatingCombBox.SelectedItem == null || ValidatingCombBox.SelectedIndex == -1) { ValidatingCombBox.Focus(); TxtBoxerrorProvider.SetError((Guna2ComboBox)sender, ClsAppMsgs.RequiredFieldErrorMsg); ValidatingCombBox.BackColor = System.Drawing.Color.Red; ValidatingCombBox.BorderThickness = 2; ValidatingCombBox.BorderColor = Color.Red; ValidatingCombBox.Font = new Font("Changa", 11, FontStyle.Bold); } else { TxtBoxerrorProvider.Clear(); ValidatingCombBox.BorderThickness = 1; ValidatingCombBox.BorderColor = ColorTranslator.FromHtml("#0CBCB2"); ValidatingCombBox.BackColor = ColorTranslator.FromHtml("#FFFFFF"); ValidatingCombBox.ForeColor = ColorTranslator.FromHtml("#0CBCB2"); ValidatingCombBox.Font = new Font("Changa", 9, FontStyle.Regular); } } }
internal void TxtBoxPasswordConfirmCheck() { if (TxtBoxPasswordConfirm.Text.Trim() != TxtBoxPassword.Text.Trim() && !String.IsNullOrWhiteSpace(TxtBoxPassword.Text.Trim())) { TxtBoxerrorProvider.SetError(TxtBoxPasswordConfirm, ClsAppMsgs.ConfirmPasswordErrorMsg); TxtBoxPasswordConfirm.BackColor = Color.Red; TxtBoxPasswordConfirm.BorderThickness = 2; TxtBoxPasswordConfirm.BorderColor = ColorTranslator.FromHtml("#6b1421"); TxtBoxPasswordConfirm.BorderStyle = System.Drawing.Drawing2D.DashStyle.Dash; TxtBoxPasswordConfirm.Font = new Font("Changa", 11, FontStyle.Bold); TxtBoxPasswordConfirm.Focus(); } else { TxtBoxerrorProvider.Clear(); TxtBoxPasswordConfirm.BorderThickness = 1; TxtBoxPasswordConfirm.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; TxtBoxPasswordConfirm.BorderColor = ColorTranslator.FromHtml("#0CBCB2"); TxtBoxPasswordConfirm.BackColor = ColorTranslator.FromHtml("#FFFFFF"); TxtBoxPasswordConfirm.ForeColor = ColorTranslator.FromHtml("#0CBCB2"); TxtBoxPasswordConfirm.Font = new Font("Changa", 9, FontStyle.Regular); } }