Beispiel #1
0
 public RegisterPage()
 {
     InitializeComponent();
     Username.Completed += (o, e) =>
     {
         Password.Focus();
     };
     Password.Completed += (o, e) =>
     {
         PasswordRepeat.Focus();
     };
     PasswordRepeat.Completed += (o, e) =>
     {
         Email.Focus();
     };
     Email.Completed += (o, e) =>
     {
         FirstName.Focus();
     };
     FirstName.Completed += (o, e) =>
     {
         LastName.Focus();
     };
     LastName.Completed += (o, e) =>
     {
         if (RegisterButton.IsEnabled)
         {
             RegisterButton_Clicked(o, e);
         }
     };
 }
        private void ControlLoaded(object sender, RoutedEventArgs e)
        {
            LastName.Focus();
            LastName.Focusable = true;
            Keyboard.Focus(LastName);

            MainWindowViewModel.IsNextEnabled = MainWindowViewModel.ControlValidation.LastName;
        }
Beispiel #3
0
 private void FirstName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key != Key.Enter)
     {
         return;
     }
     LastName.Focus();
     PreviewChange();
 }
    protected void FirstName_TextChanged(object sender, EventArgs e)
    {
        string Name;
        char   FirstLetter;

        Name = FirstName.Text;

        FirstLetter = Name[0];

        UserName.Text = char.ToUpper(FirstLetter).ToString();
        LastName.Focus();
    }
        private void Name__KeyDown(object sender, KeyEventArgs e)
        {
            var textbox = sender as TextBox;

            this.Handler.ErrorProvider.SetError(textbox, "");
            if (textbox != null)
            {
                if (Keys.Tab == e.KeyCode)
                {
                    LastName.Focus();
                }
            }
        }
        public SignupPageSecurity()
        {
            InitializeComponent();
            controls = new List <Entry>
            {
                FirstName, LastName, Email, Password, Mobile
            };

            FirstName.Completed      += (sender, e) => MiddleName.Focus();
            MiddleName.Completed     += (sender, e) => LastName.Focus();
            LastName.Completed       += (s, e) => Mobile.Focus();
            Mobile.Completed         += (s, e) => Email.Focus();
            Email.Completed          += (s, e) => Password.Focus();
            Password.Completed       += (s, e) => RetypePassword.Focus();
            RetypePassword.Completed += (s, e) => SubmitForm(s, e);
        }
        private void myradwizard_Next(object sender, NavigationButtonsEventArgs e)
        {
            if (this.myradwizard.SelectedPage == Page0) // Check if this is the desired page
            {
                if (LastName.Text == "")
                {
                    errormessage.Text = "Last Name cannot be empty";
                    LastName.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (FirstName.Text == "")
                {
                    errormessage.Text = "First Name cannot be empty";
                    FirstName.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (CityName.SelectedValue == null || PermanentCityName.SelectedValue == null)
                {
                    errormessage.Text        = "Please complete address";
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactPerson.Text == "")
                {
                    errormessage.Text = "Contact Person cannot be empty";
                    ContactPerson.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactPhone.Text == "")
                {
                    errormessage.Text = "Contact Phone cannot be empty";
                    ContactPhone.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (ContactAddress.Text == "")
                {
                    errormessage.Text = "Contact Address cannot be empty";
                    ContactAddress.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (BirthDate.DateTimeText == "")
                {
                    errormessage.Text = "BirthDay cannot be empty";
                    BirthDate.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (CivilStatus.SelectedValue == null)
                {
                    errormessage.Text = "Please select Civil Status";
                    CivilStatus.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Nationality.SelectedValue == null)
                {
                    errormessage.Text = "Please select Nationality";
                    Nationality.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Religion.SelectedValue == null)
                {
                    errormessage.Text = "Please select Religion";
                    Religion.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Sex.SelectedValue == null)
                {
                    errormessage.Text = "Please select Gender";
                    Sex.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (HireDate.DateTimeText == "")
                {
                    errormessage.Text = "Please select Hire Date";
                    HireDate.Focus();
                    myradwizard.SelectedPage = Page1;
                }

                else if (Department.SelectedValue == null)
                {
                    errormessage.Text = "Please select Department";
                    Department.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Section.SelectedValue == null)
                {
                    errormessage.Text = "Please select Section";
                    Section.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (Position.SelectedValue == null)
                {
                    errormessage.Text = "Please select Position";
                    Position.Focus();
                    myradwizard.SelectedPage = Page1;
                }
                else if (EmploymentStatus.SelectedValue == null)
                {
                    errormessage.Text = "Please select Employee Status";
                    EmploymentStatus.Focus();
                    myradwizard.SelectedPage = Page1;
                }

                if (EmailAddress.Text.Length == 0)
                {
                }
                else
                {
                    if (!Regex.IsMatch(EmailAddress.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]$"))
                    {
                        errormessage.Text = "Please enter a valid email.";
                        EmailAddress.Select(0, EmailAddress.Text.Length);
                        EmailAddress.Focus();
                        myradwizard.SelectedPage = Page1;
                    }
                    else
                    {
                    }
                }
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LastName.Focus();
 }
Beispiel #9
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (!Regex.IsMatch(FirstName.Text, "[a-zA-Z]{1,}"))
            {
                MessageBox.Show("Please enter proper First Name", "Warning");
                FirstName.Focus();
            }
            else if (!Regex.IsMatch(LastName.Text, "[a-zA-Z]{1,}"))
            {
                MessageBox.Show("Please enter proper Last Name", "Warning");
                LastName.Focus();
            }
            else if (!Regex.IsMatch(City.Text, @"^([a-zA-Z]+|[a-zA-Z]+\s[a-zA-Z]+)$"))
            {
                MessageBox.Show("Please enter proper City", "Warning");
                City.Focus();
            }
            else if (!Regex.IsMatch(Address.Text, @"^([a-zA-Z]+|[a-zA-Z]+\s[a-zA-Z]+)$"))
            {
                MessageBox.Show("Please enter proper Address", "Warning");
                Address.Focus();
            }
            else if (!Regex.IsMatch(State.Text, @"^([a-zA-Z]+|[a-zA-Z]+\s[a-zA-Z]+)$"))
            {
                MessageBox.Show("Please enter proper State", "Warning");
                State.Focus();
            }
            else if (!Regex.IsMatch(Zip.Text, @"^\d{5}(?:[-\s]\d{4})?$"))
            {
                MessageBox.Show("Please enter proper Zip code", "Warning");
                Zip.Focus();
            }
            else if (!Regex.IsMatch(Phone.Text, "[+(995)0-9]{10}"))
            {
                MessageBox.Show("Please enter proper Phone Number (pattern : +995 *** ***)", "Warning");
                Phone.Focus();
            }
            else if (!Regex.IsMatch(Email.Text, "^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$"))
            {
                MessageBox.Show("Please enter proper Email Address", "Warning");
                Email.Focus();
            }
            else
            {
                string[] data = new string[8];
                data[0] = FirstName.Text;
                data[1] = LastName.Text;
                data[2] = Address.Text;
                data[3] = City.Text;
                data[4] = State.Text;
                data[5] = Zip.Text;
                data[6] = Phone.Text;
                data[7] = Email.Text;
                services s = new services();

                if (Options.Enabled)
                {
                    var result = MessageBox.Show("Do you want to update information?", "Warning",
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        s.updateCustomers(data, id);
                        MessageBox.Show("You've updated information successfully");
                    }
                }
                else
                {
                    var result = MessageBox.Show("Do you want to insert information?", "Warning",
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        s.insertCustomers(data);
                        Options.Enabled = true;
                        MessageBox.Show("You've inserted information successfully");
                    }
                }
                Options.Items.Clear();
                LoadDataInCombo();
            }
        }
Beispiel #10
0
        private async void Handle_Signup(object sender, TappedRoutedEventArgs e)
        {
            this.currentMember.firstName    = this.FirstName.Text;
            this.currentMember.lastName     = this.LastName.Text;
            this.currentMember.email        = this.Email.Text;
            this.currentMember.password     = this.Password.Password.ToString();
            this.currentMember.avatar       = this.ImageUrl.Text;
            this.currentMember.phone        = this.Phone.Text;
            this.currentMember.address      = this.Address.Text;
            this.currentMember.introduction = this.Introduction.Text;

            bool validate = true;

            if (this.currentMember.email == "")
            {
                validate         = false;
                email.Text       = "Email khong duoc de trong!";
                email.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Email.Focus(FocusState.Programmatic);
            }
            else
            {
                email.Text = "";
            }
            if (this.currentMember.password == "")
            {
                validate            = false;
                password.Text       = "Mat khau khong duoc de trong!";
                password.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Password.Focus(FocusState.Programmatic);
            }
            else
            {
                password.Text = "";
            }
            if (Confirm_Password.Password.ToString() != Password.Password.ToString())
            {
                validate = false;
                Confirm_Password_Message.Text       = "Ban nhap lai mat khau khong dung";
                Confirm_Password_Message.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Confirm_Password.Focus(FocusState.Programmatic);
            }
            else
            {
                Confirm_Password_Message.Text = "";
            }

            if (this.currentMember.firstName == "")
            {
                validate             = false;
                firstName.Text       = "firstName khong duoc de trong!";
                firstName.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                FirstName.Focus(FocusState.Programmatic);
            }
            else
            {
                firstName.Text = "";
            }

            if (this.currentMember.lastName == "")
            {
                validate            = false;
                lastName.Text       = "lastName khong duoc de trong!";
                lastName.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                LastName.Focus(FocusState.Programmatic);
            }
            else
            {
                lastName.Text = "";
            }

            if (this.currentMember.avatar == "")
            {
                validate          = false;
                avatar.Text       = "avatar khong duoc de trong!";
                avatar.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                ImageUrl.Focus(FocusState.Programmatic);
            }
            else
            {
                avatar.Text = "";
            }

            if (this.currentMember.address == "")
            {
                validate           = false;
                address.Text       = "Dia chi khong duoc de trong!";
                address.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Address.Focus(FocusState.Programmatic);
            }
            else
            {
                address.Text = "";
            }

            if (this.currentMember.phone == "")
            {
                validate         = false;
                phone.Text       = "So dien thoai khong duoc de trong!";
                phone.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Phone.Focus(FocusState.Programmatic);
            }
            else
            {
                phone.Text = "";
            }
            if (validate)
            {
                if (await ApiHandle.Sign_Up(this.currentMember))
                {
                    Debug.WriteLine("Action success.");
                    Login login = new Login();
                    await login.ShowAsync();
                }
                else
                {
                    validate         = false;
                    email.Text       = "Invalid email format!";
                    email.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                    Email.Focus(FocusState.Programmatic);
                }
            }

            //if (httpResponseMessage.Result.StatusCode == HttpStatusCode.Created)
            //{
            //    Debug.WriteLine("Success");
            //}
            //else
            //{
            //    var errorJson = await httpResponseMessage.Result.Content.ReadAsStringAsync();
            //    ErrorResponse errResponse = JsonConvert.DeserializeObject<ErrorResponse>(errorJson);
            //    foreach (var errorField in errResponse.error.Keys)
            //    {
            //        TextBlock textBlock = this.FindName(errorField) as TextBlock;
            //        textBlock.Text = errResponse.error[errorField];
            //    }
            //}

            //Debug.WriteLine(jsonResult);
            //var rs = JObject.Parse(jsonResult);
            //if ((int)rs["status"] != 201)
            //{
            //    ErrorResponse errResponse = JsonConvert.DeserializeObject<ErrorResponse>(jsonResult);
            //    Debug.WriteLine(errResponse);
            //}
        }
Beispiel #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            int broj;

            if (FirstName.Text == "")
            {
                MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FirstName.Focus();
                return;
            }

            else if (LastName.Text == "")
            {
                MessageBox.Show("you did not enter the first name of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LastName.Focus();
                return;
            }

            else if (UniqueIN.Text == "")
            {
                MessageBox.Show("you did not enter the unique identifacion number of the candidate !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                UniqueIN.Focus();
                return;
            }

            else if (IDNumber.Text == "")
            {
                MessageBox.Show("you did not enter the ID number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                IDNumber.Focus();
                return;
            }

            else if (Address.Text == "")
            {
                MessageBox.Show("you did not enter the address of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Address.Focus();
                return;
            }

            else if (PhoneNumber.Text == "" && Int32.TryParse(PhoneNumber.Text, out broj))
            {
                MessageBox.Show("you did not enter the phone number of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PhoneNumber.Focus();
                return;
            }

            else if (Municipalities.Text == "")
            {
                MessageBox.Show("you did not enter the municipalities of the candidate !", "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            else if (UniqueIN.Text.Length < 13)
            {
                MessageBox.Show("Unesite isprevno JMBG");
                UniqueIN.Clear();
                UniqueIN.Focus();
            }

            else if (UniqueIN.Text.Length > 13)
            {
                MessageBox.Show("Unesite isprevno JMBG");
                UniqueIN.Clear();
                UniqueIN.Focus();
            }

            else if (IDNumber.Text.Length < 9)
            {
                MessageBox.Show("Unesite isprevno BRLK");
                IDNumber.Clear();
                IDNumber.Focus();
            }

            else if (IDNumber.Text.Length > 9)
            {
                MessageBox.Show("Unesite isprevno BRLK");
                IDNumber.Clear();
                IDNumber.Focus();
            }

            else
            {
                SqlConnection con = new SqlConnection(Form1.path);

                try
                {
                    con.Close();
                    con.Open();

                    SqlCommand command = con.CreateCommand();

                    command.CommandText = "SELECT Id FROM municipalities WHERE name = '" + Municipalities.SelectedItem.ToString() + "';";

                    SqlDataReader rdr = command.ExecuteReader();
                    rdr.Read();
                    int d = rdr.GetInt32(0);
                    rdr.Close();

                    command.CommandText = "INSERT INTO candidate ( municipalities_id, first_name, last_name, unique_identifacion_number, Id_number, address, phone_number) VALUES ( " + d + ",'" + FirstName.Text + "','" + LastName.Text + "','" + UniqueIN.Text + "','" + IDNumber.Text + "','" + Address.Text + "'," + int.Parse(PhoneNumber.Text) + ");";
                    command.ExecuteNonQuery();
                    MessageBox.Show("Successfully entered candidate");
                    FirstName.Clear();
                    LastName.Clear();
                    UniqueIN.Clear();
                    IDNumber.Clear();
                    Address.Clear();
                    PhoneNumber.Clear();
                    Municipalities.SelectedIndex = -1;
                    con.Close();
                }
                catch (Exception ee)
                {
                    MessageBox.Show("" + ee.ToString());
                    return;
                }
            }
        }