Beispiel #1
0
        //button after click save the information to array, then, this information will be send to admin for confirm
        private void Confirm_Click(object sender, EventArgs e)
        {
            Connect2DB register = new Connect2DB();

            firstName    = FirstName.Text;
            lastName     = LastName.Text;
            dateOfBirth  = DateOfBirth.Value;
            password     = PasswordReg.Text;
            email        = EmailReg.Text;
            telephone    = int.Parse(Telephone.Text);
            street       = Street.Text;
            streetNumber = Number.Text;
            city         = City.Text;
            postalCode   = int.Parse(PostalCode.Text);
            int age;

            if (System.DateTime.Today.Month == dateOfBirth.Month && System.DateTime.Today.Day == dateOfBirth.Day)
            {
                age = System.DateTime.Today.Year - dateOfBirth.Year;
            }
            else
            {
                age = System.DateTime.Today.Year - dateOfBirth.Year - 1;
            }
            if (register.writeUserAsInactive(firstName, lastName, email, password, telephone, age, dateOfBirth, street, streetNumber, city, postalCode))
            {
                Info.Text    = "Your request was send successfully.";
                Info.Visible = true;
            }
            else
            {
                Info.Text    = "Your request wasn't send successfully.\nPlease try again later.";
                Info.Visible = true;
            }
        }
Beispiel #2
0
        //button after click save the information to array, then, this information will be send to admin for confirm
        private void Confirm_Click(object sender, EventArgs e)
        {
            Connect2DB register = new Connect2DB();

            if (FirstName.Text.Trim() != "" && LastName.Text.Trim() != "" && PasswordReg.Text.Trim() != "" &&
                EmailReg.Text.Trim() != "" && (Telephone1.Text + Telephone2.Text.Trim()) != "" &&
                Street.Text.Trim() != "" && Number.Text.Trim() != "" && City.Text.Trim() != "" &&
                PostalCode.Text.Trim() != "" && Country.Text.Trim() != "")
            {
                firstName    = FirstName.Text;
                lastName     = LastName.Text;
                dateOfBirth  = DateOfBirth.Value;
                password     = PasswordReg.Text;
                email        = EmailReg.Text;
                telephone    = Telephone1.Text + Telephone2.Text;
                street       = Street.Text;
                streetNumber = Int32.Parse(Number.Text);
                city         = City.Text;
                postalCode   = PostalCode.Text;
                country      = Country.Text;
                if (register.isEmailTaken(email) == 0)
                {
                    if (register.writeUserAsInactive(firstName, lastName, email, password, telephone, dateOfBirth, street, streetNumber, city, postalCode, country))
                    {
                        Info.Text    = "Your request was send successfully.";
                        Info.Visible = true;
                    }
                    else
                    {
                        Info.Text    = "Your request wasn't send successfully.\nPlease try again later.";
                        Info.Visible = true;
                    }
                }
                else if (register.isEmailTaken(email) == 1)
                {
                    Info.Text    = "Email is already taken.";
                    Info.Visible = true;
                }
                else
                {
                    Info.Text    = "Error! Cannot connect to database.\nPlease try again later.";
                    Info.Visible = true;
                }
            }
            else
            {
                Info.Text    = "Enter your data!";
                Info.Visible = true;
            }
        }