Exemple #1
0
        public int addAddressTest(
            [PexAssumeUnderTest] BusinessPlayer target,
            string country,
            string province,
            string district,
            string location
            )
        {
            int result = target.addAddress(country, province, district, location);

            return(result);
            // TODO: add assertions to method BusinessPlayerTest.addAddressTest(BusinessPlayer, String, String, String, String)
        }
Exemple #2
0
        private void simpleButton7_Click(object sender, EventArgs e)
        {
            if (firstname.Text.Equals("") || lastname.Text.Equals("") || username.Text.Equals("") ||
                password.Text.Equals("") || phone.Text.Equals("") || birth.Text.Equals("") ||
                gender.Text.Equals("") || country.Text.Equals("") || province.Text.Equals("") ||
                district.Text.Equals("") || addess.Text.Equals("")
                )
            {
                MessageBox.Show("Vui lòng điền đầy đủ thông tin!");
                return;
            }

            if (username.Text.Contains(" "))
            {
                MessageBox.Show("Tài khoản không được chứa khoảng trắng!");
                return;
            }

            if (password.Text.Length < 6)
            {
                MessageBox.Show("Mật khẩu phải chứa ít nhất 6 ký tự!");
                return;
            }

            if (password.Text.Contains(" "))
            {
                MessageBox.Show("Mật khẩu không được chứa khoảng trắng!");
                return;
            }

            if (!IsValidEmail(email.Text))
            {
                MessageBox.Show("Email sai định dạng!");
                this.ActiveControl = email;
                return;
            }

            if (business.delCustomer(ID) > 0)
            {
                Console.WriteLine("Xoá thành công!");
            }
            else
            {
                Console.WriteLine("Xoá thất bại!");
            }

            int idAdress = business.addAddress(country.Text, province.Text, district.Text, addess.Text);

            if (idAdress <= 0)
            {
                MessageBox.Show("Thêm địa chỉ lỗi!");
                return;
            }

            int idCustomer = business.AddCustomer(firstname.Text, lastname.Text,
                                                  image, email.Text, phone.Text, birth.Text, gender.Text, idAdress.ToString());

            if (idCustomer <= 0)
            {
                MessageBox.Show("Thêm người dùng lỗi!");
                if (business.delAddress(idAdress.ToString()) <= 0)
                {
                    Console.WriteLine("Xoá địa chỉ lỗi!");
                }
                return;
            }

            int idAccount = business.AddAccount(username.Text, password.Text, idCustomer.ToString());

            if (idAccount <= 0)
            {
                MessageBox.Show("Thêm tài khoản lỗi!");
                if (business.delAddress(idAdress.ToString()) <= 0)
                {
                    Console.WriteLine("Xoá địa chỉ lỗi!");
                }

                if (business.delCustomer(idCustomer.ToString()) <= 0)
                {
                    Console.WriteLine("Xoá người dùng lỗi!");
                }
                return;
            }



            MessageBox.Show("Chỉnh sửa thành công!");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }