Beispiel #1
0
        public int delCustomerTest([PexAssumeUnderTest] BusinessPlayer target, string id)
        {
            int result = target.delCustomer(id);

            return(result);
            // TODO: add assertions to method BusinessPlayerTest.delCustomerTest(BusinessPlayer, String)
        }
Beispiel #2
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (gridView1.SelectedRowsCount <= 0)
            {
                MessageBox.Show("Vui lòng chọn tài khoản để xoá!");
                return;
            }

            if (MessageBox.Show("Lưu ý: Khi xoá tài khoản, các giao dịch trước đó sẽ bị mất?", "Bạn chắc xoá chứ?", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            DataRow row = gridView1.GetDataRow(gridView1.GetSelectedRows()[0]);

            if (business.delCustomer(row["CustomerID"].ToString()) > 0)
            {
                MessageBox.Show("Xoá thành công!");
                loadData();
            }
            else
            {
                MessageBox.Show("Xoá thất bại!");
            }
        }
Beispiel #3
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();
        }