public ActionResult ChuanBiSuaKH(int idKH)
        {
            IKhachHangService serviceKH = new KhachHangService();
            KhachHangModel    khModel   = serviceKH.GetKhachHangById(baseAddress, $"khachhang/getKhById?idKH={idKH}");

            return(View(khModel));
        }
        public ActionResult SuaKhachHang(KhachHangModel2 model)
        {
            try
            {
                IKhachHangService serviceKH = new KhachHangService();
                serviceKH.SuaKhachHang(baseAddress, "khachhang/suakhachhang", model);
                KhachHangModel khModel = serviceKH.GetKhachHangById(baseAddress, $"khachhang/getKhById?idKH={model.id}");
                Session["KhachHang"] = khModel;

                return(Json(1));
            }
            catch (Exception ex)
            {
                return(Json(0));
            }
        }
Пример #3
0
        private void btnTimMaKhachHang_Click(object sender, EventArgs e)
        {
            KhachHangService khs = new KhachHangService();

            try
            {
                kh = khs.GetKhachHangById(Convert.ToInt32(txtMaKhachHang.Text));
                txtTenKhachHang.Text = kh.Ho + " " + kh.Ten;
                txtEmail.Text        = kh.Email;
                txtSoDienThoai.Text  = kh.SoDienThoai;
                txtDiaChi.Text       = kh.DiaChi;
            }
            catch
            {
                MessageBox.Show("Không tìm thấy!");
            }
        }
        //16/12/2019
        public ActionResult ChuanBiSuaKhachHang()
        {
            int idKH = 0;

            if (Session["KhachHang"] != null)
            {
                idKH = ((KhachHangModel)Session["KhachHang"]).id;
            }
            else
            {
                return(RedirectToAction("DangNhap", "KhachHang"));
            }
            IKhachHangService serviceKH = new KhachHangService();
            KhachHangModel    khModel   = serviceKH.GetKhachHangById(baseAddress, $"khachhang/getKhById?idKH={idKH}");

            return(Json(khModel));
        }
Пример #5
0
        private void btnTimKH_Tra_Click(object sender, EventArgs e)
        {
            KhachHangService khs = new KhachHangService();

            try
            {
                KhachHang k = new KhachHang();
                k = khs.GetKhachHangById(Convert.ToInt32(txtMaKH_TraSach.Text));
                txtTen_Tra.Text    = k.Ho + " " + k.Ten;
                txtEmail_Tra.Text  = k.Email;
                txtSDT_Tra.Text    = k.SoDienThoai;
                txtDiaChi_Tra.Text = k.DiaChi;
            }
            catch
            {
                MessageBox.Show("Không tìm thấy!");
            }
        }