Ejemplo n.º 1
0
        private void btnSaveKH_Click(object sender, EventArgs e)
        {
            KhachHangDTO dto = new KhachHangDTO();

            addData(dto);
            if (txtTenKH.Text.Length <= 0)
            {
                lblThongBao.Text = "Chưa nhập Tên Khách Hàng !";
            }
            else if (txtDiaChi.Text.Length <= 0)
            {
                lblThongBao.Text = "Chưa nhập Địa Chỉ !";
            }
            else if (txtSDT.Text.Length <= 0)
            {
                lblThongBao.Text = "Chưa nhập SĐT !";
            }
            else if (txtSDT.Text.Length < 10)
            {
                lblThongBao.Text = "SĐT nhập chưa đủ số !";
            }
            else if (txtSoNo.Text.Length <= 0)
            {
                lblThongBao.Text = "Chưa nhập Số Nợ !";
            }
            else
            {
                if (khachhangBus.AddData(dto))
                {
                    MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Thêm Lại đê bạn ơi,wrong rùi :>", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }