/*
         * - Khi bấm cập nhật khách thì sẽ kiểm tra thông tin đầy đủ với chính xác chưa nếu chưa thì sẽ xuất ra messagbox
         * - Ngược lại sẽ lưu dữ liệu vào model customer và thực hiện việc cập nhật qua class CustomerDao
         * - Nếu thực hiện thành công thì sẽ load lại dữ liệu và trả lại trạng thái ban đầu của các textbox và button
         * - Nếu thực hiện không thành công thì sẽ xuất ra MessageBox
         */
        private void bt_capNhatKhachHang_quanLyKhachHangVaSuKien_Click(object sender, EventArgs e)
        {
            if (!checkInfoCustomer())
            {
                MessageBox.Show("Hãy điền đủ và chính xác thông tin");
                return;
            }
            else
            {
                model.Customer customer = new model.Customer();
                customer.phone_customer = tb_sdt_quanLyKhachHangVaSuKien.Text;
                customer.name_customer  = tb_hoVaTen_quanLyKhachHangVaSuKien.Text;

                customer.address_customer = tb_diaChi_quanLyKhachHangVaSuKien.Text;

                if (customer_dao.updateByTelephone(customer, phone_customer))
                {
                    MessageBox.Show("Cập nhật khách hàng thành công");
                    dgv_khachHang_quanLyKhachHangVaSuKien.ClearSelection();
                    loadData();
                    dgv_suKien_quanLyKhachHangVaSuKien.ClearSelection();
                    bt_refreshKhachHang_quanLyKhachHangVaSuKien_Click(null, null);
                    commandButtonManagementKhachHang.notAdjustItem();

                    return;
                }
                else
                {
                    MessageBox.Show("Số điện thoại đã tồn tại");
                    return;
                }
            }
        }
Beispiel #2
0
 public Sale(model.Merchant merchant, model.Bill bill, CardData card_data, model.Customer customer)
 {
     // TODO: Complete member initialization
     this.merchant  = merchant;
     this.bill      = bill;
     this.card_data = card_data;
     this.customer  = customer;
 }
Beispiel #3
0
        //Add new Customer
        public bool addCustomer(model.Customer customer)
        {
            String sql = "insert into CUSTOMER values(@phoneNumber, @name, @address)";

            DbParameter param1 = df.createParam("@phoneNumber", customer.phone_customer);
            DbParameter param2 = df.createParam("@name", customer.name_customer);
            DbParameter param3 = df.createParam("@address", customer.address_customer);

            DbParameter[] parameters = { param1, param2, param3 };

            int rows = customer_helper.insertUpdateDelete(sql, parameters);

            return(rows == 1);
        }
Beispiel #4
0
        //update customer by telephone
        public bool updateByTelephone(model.Customer customer, String phoneOld)
        {
            String sql = "update CUSTOMER set PHONE_NUMBER_CUSTOMER = @phoneNew, CUSTOMERNAME = @name, " +
                         "CUSTOMER_ADDRESS = @address where PHONE_NUMBER_CUSTOMER like @phoneOld ";

            DbParameter param1 = df.createParam("@phoneNew", customer.phone_customer);
            DbParameter param2 = df.createParam("@name", customer.name_customer);
            DbParameter param3 = df.createParam("@address", customer.address_customer);
            DbParameter param4 = df.createParam("@phoneOld", phoneOld);

            DbParameter[] parameters = { param1, param2, param3, param4 };

            int rows = customer_helper.insertUpdateDelete(sql, parameters);

            return(rows == 1);
        }