Exemple #1
0
        private void ResisterButtonClicked(object sender, EventArgs e)
        {
            if (textBoxPassword.Text == textBoxRepass.Text)
            {
                string errors = "";
                errors += textBoxName.Text.Length == 0 ? "Please Provide Name": "";
                errors += textBoxPassword.Text.Length == 0 ? "\nPlease Provide Password" : "";
                errors += textBoxRepass.Text.Length == 0 ? "\nPlease provide Retype password" : "";
                errors += pictureBoxProfilePicture == null ? "\nPlease upload profile picture" : "";
                errors += textBoxUsername.Text.Length == 0 ? "\nPlease Provide User Name" : "";
                errors += textBoxAddress.Text.Length == 0 ? "\nPlease Provide Address" : "";
                errors += textBoxEmail.Text.Length == 0 ? "\nPlease Provide Gmail" : "";
                errors += comboBoxBloodGroup.Text == null ? "\nPlease Provide Blood Group":"";
                if (!radioButtonFemale.Checked && !radioButtonMale.Checked)
                {
                    errors += "\nPlease Provide Gender";
                }
                errors += (textBoxMobileNumber.Text.Length == 0 || textBoxMobileNumber.Text.Length != 11) ? "\nPlease Provide a Valid Mobile Number" : "";
                errors += textBoxProfession.Text.Length == 0 ? "\n Please Provide Profession" : "";

                if (errors.Length != 0)
                {
                    MessageBox.Show(errors, "Filled the flowing!");
                    return;
                }
                else
                {
                    string gend = radioButtonFemale.Checked ? "Female" : "Male";


                    byte[]       img    = null;
                    string       imgLoc = pictureBoxProfilePicture.ImageLocation;
                    FileStream   fs     = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
                    BinaryReader br     = new BinaryReader(fs);
                    img = br.ReadBytes((int)fs.Length);
                    var res = ResisterController.ResisterMember(textBoxName.Text, textBoxUsername.Text, textBoxPassword.Text, comboBoxBloodGroup.Text, dateTimePickerDob.Value, textBoxMobileNumber.Text, textBoxProfession.Text, gend, textBoxEmail.Text, textBoxAddress.Text, img);
                    if (!res)
                    {
                    }
                    else
                    {
                        MessageBox.Show("Successfully registered", "Message");
                        this.Hide();
                        Login f1 = new Login();
                        f1.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Password and Re-enter password must be same!", "Allert");
            }
        }
        private void RegisterClickEvent(object sender, EventArgs e)
        {
            if (textBoxPassword.Text == textBoxRepass.Text)
            {
                string errors = "";
                errors += textBoxName.Text.Length == 0 ? "Please Provide Name" : "";
                errors += textBoxPassword.Text.Length == 0 ? "\nPlease Provide Password" : "";
                errors += textBoxRepass.Text.Length == 0 ? "\nPlease provide Retype password" : "";
                errors += textBoxUsername.Text.Length == 0 ? "\nPlease Provide User Name" : "";
                errors += textBoxAddress.Text.Length == 0 ? "\nPlease Provide Address" : "";
                errors += textBoxEmail.Text.Length == 0 ? "\nPlease Provide Gmail" : "";
                errors += comboBoxBloodGroup.SelectedItem == null ? "\nPlease Provide Blood Group" : "";
                if (!radioButtonFemale.Checked && !radioButtonMale.Checked)
                {
                    errors += "\nPlease Provide Gender";
                }

                errors += textBoxProfession.Text.Length == 0 ? "\n Please Provide Profession" : "";

                if (errors.Length != 0)
                {
                    MessageBox.Show(errors, "Filled the flowing!");
                    return;
                }
                else
                {
                    string gend = radioButtonFemale.Checked ? "Female" : "Male";


                    string a   = dateTimePickerDob.Text;
                    var    res = ResisterController.ResisterMember(textBoxName.Text, textBoxUsername.Text, textBoxPassword.Text, comboBoxBloodGroup.Text, dateTimePickerDob.Value, textBoxProfession.Text, gend, textBoxEmail.Text, textBoxAddress.Text, a);
                    if (!res)
                    {
                    }
                    else
                    {
                        MessageBox.Show("Successfully registered", "Message");
                        this.Hide();
                        Login f1 = new Login();
                        f1.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Password and Re-enter password must be same!", "Allert");
            }
        }