Ejemplo n.º 1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            KhachHangObj khObj = new KhachHangObj();

            addData(khObj);
            if (flag == 0)
            {   // them moi
                if (khctr.addData(khObj))
                {
                    MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Thêm thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                // sua
                if (khctr.updData(khObj))
                {
                    MessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Sửa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            frmKhachHang_Load(sender, e);
        }
Ejemplo n.º 2
0
 private void btnluu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     addData(khObj);
     if (txtmakh.Text == "" || txttenkh.Text == "" || txtdiachi.Text == "" || txtsdt.Text == "")
     {
         MessageBox.Show("Bạn chưa nhập đủ thông tin yêu cầu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (flagLuu == 0)
         {
             if (khCtrl.addData(khObj))
             {
                 MessageBox.Show("Thêm thành công thông tin khách hàng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Không thêm được thông tin khách hàng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             if (khCtrl.updData(khObj))
             {
                 MessageBox.Show("Sửa thành công thông tin khách hàng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Không sửa được thông tin khách hàng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         ucKhachHang_Load(sender, e);
         DisEnl(false);
     }
 }
Ejemplo n.º 3
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            KhachHangObj khobj = new KhachHangObj();

            ganData(khobj);

            if (khCtr.addData(khobj))
            {
                MessageBox.Show("Thêm thành công ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Thêm thất bại ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            frmKhachHang_Load(sender, e);
        }