protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();

            try
            {

                Admins vcontroller = new Admins();
                Entities.Size vsize = new Entities.Size();
                string errMsg = string.Empty;
                vsize.Masize = Convert.ToInt32(lblsize.Text);
                vsize.Size1 = txttensize.Text;
                int result = vcontroller.save_Size(vsize, ref errMsg);
                if (result > 0)
                {
                    ucNotificationDialog.MessageContent = "Thêm mới size thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/Sizes.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }
            }

            catch (Exception ex)
            {
                Response.Write(ex.Message);
                ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố trong quá trình cập nhật !";
                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(txttensize.Text))
            {
                NotificationMessage("tên size không được để trống", 0);
                return;
            }
            try
            {
                Admins vcontroller = new Admins();
                Entities.Size vsize = new Entities.Size();
                string errMsg = string.Empty;
                vsize.Masize = COMM.Common.GetID_MaxForInsert("[dbo].[Size]", "[MaSize]", "");
                vsize.Size1 = txttensize.Text;
                int result = vcontroller.save_Size(vsize, ref errMsg);
                if (result > 0)
                {
                    ucNotificationDialog.MessageContent = "Thêm mới size thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/Sizes.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                NotificationMessage("Hệ thống gặp sự cố trong quá trình thêm user mới!", 0);
            }
        }
        protected void btndangnhap_Click(object sender, EventArgs e)
        {
            try
            {
                EndUser vcontroller_enduser = new EndUser();
                Admins vcontroller_admin = new Admins();
                Entities.KhachHang vkhachhang = new Entities.KhachHang();
                string errMsg = string.Empty;
                int result = vcontroller_admin.Login_khachhang(false, txtusername.Text, txtmakhau.Text, ref errMsg);

                if (result > 0)
                {
                    vkhachhang = vcontroller_admin.getby_tk_khachhang(txtusername.Text, ref errMsg);

                    if (vkhachhang != null)
                    {
                        Session.Add("KhachhangID", Convert.ToInt32(vkhachhang.MaKH));
                        Session.Add("FullName_KH", Convert.ToString(vkhachhang.Hoten));
                        Response.Redirect("~/Default.aspx");
                    }
                }
                else
                {
                    if (result == -1) { throw new Exception("Sai tên tài khoản hoặc mật khẩu!"); }
                    else { throw new Exception("Hệ thống gặp sự cố trong quá trình xác thực tài khoản!"); }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();

            try
            {
                Admins vcontroller = new Admins();
                string errMsg = string.Empty;
                string[] listid = Convert.ToString(Request.QueryString["ID"]).Split(new char[] { ',' });
                int masp = Convert.ToInt32(listid[0]);
                int masize = Convert.ToInt32(listid[1]);
                int result = vcontroller.update_soluong_sp(masp, masize, Convert.ToInt32(txtsoluong.Text), ref errMsg);
                if (result > 0)
                {
                    ucNotificationDialog.MessageContent = "cập nhập số lượng sản phẩm thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/sanphams.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }
            }

            catch (Exception ex)
            {
                Response.Write(ex.Message);
                ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố trong quá trình cập nhật !";
                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Admins vcontroller = new Admins();
                Entities.KhachHang vusers = new Entities.KhachHang();
                string errMsg = string.Empty;
                int result = vcontroller.Login_khachhang(true, txtUserName.Text, txtPassword.Text, ref errMsg);

                if (result > 0)
                {
                    vusers = vcontroller.getby_tk_khachhang(txtUserName.Text, ref errMsg);

                    if (vusers != null)
                    {
                        Session.Add("UserID", Convert.ToInt32(vusers.MaKH));
                        Session.Add("FullName", Convert.ToString(vusers.Hoten));
                        Response.Redirect("~/Admin/users.aspx");
                    }
                }
                else
                {
                    if (result == -1) { throw new Exception("Sai tên tài khoản hoặc mật khẩu!"); }
                    else { throw new Exception("Hệ thống gặp sự cố trong quá trình xác thực tài khoản!"); }
                }

            }
            catch (Exception ex)
            {
                AlertNotification.Visible = true;
                lblAlert.Text = ex.Message;
            }
        }
        protected void btndangky_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(txttenkhachhang.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtmatkhau.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txttenkhachhang.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtemail.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtsdt.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtdiachi.Text))
            {
                return;
            }
            try
            {
                Admins vcontroller = new Admins();
                Entities.KhachHang vusers = new Entities.KhachHang();
                string errMsg = string.Empty;
                vusers.Tendangnhap = txttenkhachhang.Text;
                vusers.Matkhau = txtmatkhau.Text;
                vusers.Email = txtemail.Text;
                vusers.Hoten = txttenkhachhang.Text;
                vusers.Sodienthoai = txtsdt.Text;
                vusers.Diachi = txtdiachi.Text;
                vusers.Laadmin = false;
                vusers.Trangthai = true;
                vusers.Gioitinh = Convert.ToInt32(ddlgioitinh.SelectedValue);
                int result = vcontroller.save_khachhang(vusers, ref errMsg);
                if (result > 0)
                {
                    Response.Redirect("~/dangnhap.aspx");
                }
                else
                {
                    if (result == -1) { throw new Exception("Sai tên tài khoản hoặc mật khẩu!"); }
                    else { throw new Exception("Hệ thống gặp sự cố trong quá trình xác thực tài khoản!"); }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Hệ thống gặp sự cố trong quá trình xác thực tài khoản!");
            }
        }
        private void FillData()
        {
            try
            {
                Admins vcontroller = new Admins();
                Entities.SanPham vsanpham = new Entities.SanPham();
                string errMsg = string.Empty;
                vsanpham = vcontroller.getby_sanpham(Request.QueryString["ID"], ref errMsg);
                lblsanpham.Text = vsanpham.TenSP;

            }
            catch (Exception ex) { Response.Write(ex.Message); }
        }
        private void FillData()
        {
            try
            {
                Admins vcontroller = new Admins();
                Entities.hoadon vhoadon = new Entities.hoadon();
                string errMsg = string.Empty;
                vhoadon = vcontroller.getby_hoadon(Request.QueryString["ID"], ref errMsg);
                txttenkhachhang.Text = vhoadon.Tenkhachhang;
                txtdiachi.Text = vhoadon.Diachi;
                txtsdt.Text = vhoadon.Sodienthoai;
                txtemail.Text = vhoadon.Email;
                txtngaydat.Text = vhoadon.Ngaydat.ToString("MM-dd-yyyy");
                txtngaygiao.Text = vhoadon.Ngaygiao.ToString("MM-dd-yyyy");

            }
            catch (Exception ex) { Response.Write(ex.Message); }
        }
        private void FillData(int pageIndex)
        {

            int pageSize = ucDataNavigator.PageSize;
            int rowCount = 0;
            Admins vcontroller = new Admins();

            string errMsg = string.Empty;
            try
            {
                Repeater1.DataSource = vcontroller.getall_danhthu(pageIndex, pageSize, ref rowCount, ref errMsg);
                PreparePaging(pageIndex, pageSize, rowCount);
                Repeater1.DataBind();
            }
            catch (Exception ex) { Response.Write(ex.Message); }
            finally
            {
                vcontroller = null;

            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int pageSize = ucDataNavigator.PageSize;
            int rowCount = 0;
            Admins vcontroller = new Admins();
            DateTime ngaydat = Convert.ToDateTime(txtsearch.Text);
            string errMsg = string.Empty;
            try
            {
                Repeater1.DataSource = vcontroller.getall_danhthu_para(ngaydat, 1, pageSize, ref rowCount, ref errMsg);
                PreparePaging(1, pageSize, rowCount);
                Repeater1.DataBind();
            }
            catch (Exception ex) { Response.Write(ex.Message); }
            finally
            {
                vcontroller = null;

            }
        }
 private void FillData()
 {
     try
     {
         Admins vcontroller = new Admins();
         Entities.SanPham vsanpham = new Entities.SanPham();
         string errMsg = string.Empty;
         vsanpham = vcontroller.getby_sanpham(Request.QueryString["ID"], ref errMsg);
         txttensp.Text = vsanpham.TenSP;
         Txtthongtin.Text = vsanpham.Thongtin;
         txtgiamua.Text = vsanpham.Giamua.ToString();
         txtgiaban.Text = vsanpham.Giaban.ToString();
         ddlgioitinh.SelectedIndex = vsanpham.Gioitinh;
         ddlChuDe.SelectedIndex = vsanpham.Chude;
         ddlLoaisanpham.SelectedIndex = vsanpham.LoaiSP;
         urlhinhanh = vsanpham.Hinhanh;
         Imgsp.ImageUrl = "~" + vsanpham.Hinhanh.Substring(2);
     }
     catch (Exception ex) { Response.Write(ex.Message); }
 }
 private void FillData()
 {
     try
     {
         Admins vcontroller = new Admins();
         Entities.Size vsize = new Entities.Size();
         string errMsg = string.Empty;
         vsize = vcontroller.getby_size_ID(Request.QueryString["ID"], ref errMsg);
         lblsize.Text = vsize.Masize.ToString();
         txttensize.Text = vsize.Size1;
     }
     catch (Exception ex) { Response.Write(ex.Message); }
 }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();
            string errMsg = string.Empty;
            Admins vcontroller = new Admins();
            int result = vcontroller.delete_Size(Convert.ToInt32(ucConfirmDialog.Key), ref errMsg);
            if (result > 0)
            {
                ucNotificationDialog.MessageContent = "xóa thành công!";
                ucNotificationDialog.MessageType = 1;
                ucNotificationDialog.RedirectUrl = "~/Admin/Sizes.aspx";
                ucNotificationDialog.Show();
            }
            else
            {
                if (result == -1) { ucNotificationDialog.MessageContent = "Bản ghi không tồn tại!<br/>Vui lòng kiểm tra lại."; }
                else { ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố!<br/>Vui lòng liên hệ @ để được hỗ trợ."; }

                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();
            string errMsg = string.Empty;
            Admins vcontroller = new Admins();
            Entities.KhachHang vusers = new Entities.KhachHang();
            vusers = vcontroller.getby_tk_khachhang(Convert.ToString(ucConfirmDialog.Key), ref errMsg);
            if (vusers.Trangthai == true)
            {
                vusers.Trangthai = false;
            }
            else
            {
                vusers.Trangthai = true;
            }
            int result = vcontroller.capnhap_tt_khachhang(vusers.Tendangnhap, vusers.Trangthai, ref errMsg);
            if (result > 0)
            {
                ucNotificationDialog.MessageContent = "cập nhập trạng thái thành công!";
                ucNotificationDialog.MessageType = 1;
                ucNotificationDialog.RedirectUrl = "~/Admin/users.aspx";
                ucNotificationDialog.Show();
            }
            else
            {
                if (result == -1) { ucNotificationDialog.MessageContent = "Bản ghi không tồn tại!<br/>Vui lòng kiểm tra lại."; }
                else { ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố!<br/>Vui lòng liên hệ @ để được hỗ trợ."; }

                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(txttendangnhap.Text))
            {
                NotificationMessage("tên đăng nhập không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txtmatkhau.Text))
            {
                NotificationMessage("mật khẩu không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txthoten.Text))
            {
                NotificationMessage("họ tên không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txtemail.Text))
            {
                NotificationMessage("email không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txtsdt.Text))
            {
                NotificationMessage("số điện thoại không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txtdiachi.Text))
            {
                NotificationMessage("địa chỉ không được để trống", 0);
                return;
            }
            try
            {
                Admins vcontroller = new Admins();
                Entities.KhachHang vusers = new Entities.KhachHang();
                string errMsg = string.Empty;
                vusers.Tendangnhap = txttendangnhap.Text;
                vusers.Matkhau = txtmatkhau.Text;
                vusers.Email = txtemail.Text;
                vusers.Hoten = txthoten.Text;
                vusers.Sodienthoai = txtsdt.Text;
                vusers.Diachi = txtdiachi.Text;
                vusers.Laadmin = true;
                vusers.Trangthai = true;
                vusers.Gioitinh = Convert.ToInt32(ddlgioitinh.SelectedValue);
                int result = vcontroller.save_khachhang(vusers, ref errMsg);
                if (result > 0)
                {
                    ucNotificationDialog.MessageContent = "Thêm mới user thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/users.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                NotificationMessage("Hệ thống gặp sự cố trong quá trình thêm user mới!", 0);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(txttensp.Text))
            {
                NotificationMessage("tên sản phẩm không được để trống", 0);
                return;
            }
            if (string.IsNullOrEmpty(txtgiaban.Text))
            {
                NotificationMessage("Giá bán để trống or không đúng định dạng", 0);
                return;
            }
            try
            {

                Admins vcontroller = new Admins();
                string errMsg = string.Empty;
                Entities.SanPham vsanpham = new Entities.SanPham();
                vsanpham.MaSP = COMM.Common.GetID_MaxForInsert("[dbo].[SanPham]", "[MaSP]", "");
                vsanpham.Gioitinh = Convert.ToInt32(ddlgioitinh.SelectedValue);
                if (string.IsNullOrEmpty(txtgiamua.Text))
                {
                    vsanpham.Giamua = 0;
                }
                else
                {
                    if (COMM.Common.isDouble(txtgiamua.Text))
                    {
                        vsanpham.Giaban = Convert.ToDecimal(txtgiamua.Text);
                    }
                    else
                    {
                        NotificationMessage("Không đúng định dạng", 0);
                        return;
                    }
                }
                if (string.IsNullOrEmpty(txtgiaban.Text))
                {
                    vsanpham.Giaban = 0;
                }
                else
                {
                    if (COMM.Common.isDouble(txtgiaban.Text))
                    {
                        vsanpham.Giaban = Convert.ToDecimal(txtgiaban.Text);
                    }
                    else
                    {
                        NotificationMessage("Không đúng định dạng", 0);
                        return;
                    }
                }
                int _soluong = 0;
                if (string.IsNullOrEmpty(txtsoluong.Text))
                {
                    _soluong = 0;
                }
                else
                {
                    if (COMM.Common.isInt(txtsoluong.Text))
                    {
                        _soluong = Convert.ToInt32(txtsoluong.Text);
                    }
                    else
                    {
                        NotificationMessage("Không đúng định dạng", 0);
                        return;
                    }
                }
                if (fulhinhanh.HasFile)
                {
                    vsanpham.Hinhanh = "../Img/" + fulhinhanh.FileName;
                }
                else
                {
                    if (string.IsNullOrEmpty(txthinhanh.Text))
                    {
                        NotificationMessage("Chưa có hình ảnh cho sản phẩm", 0);
                        return;
                    }
                    vsanpham.Hinhanh = txthinhanh.Text;
                }
                int result = vcontroller.sp_save_sanpham(vsanpham.MaSP, txttensp.Text, vsanpham.Giamua, vsanpham.Giaban, Convert.ToInt32(ddlLoaisanpham.SelectedValue), Convert.ToInt32(ddlChuDe.SelectedValue), Txtthongtin.Text, Convert.ToInt32(ddlgioitinh.SelectedValue), DateTime.Now, vsanpham.Hinhanh, Convert.ToInt32(ddlsize.SelectedValue), _soluong, ref errMsg);
                if (result > 0)
                {
                    if (fulhinhanh.HasFile)
                    {
                        string filename = fulhinhanh.FileName;
                        string path = "~/Img/" + Server.HtmlEncode(fulhinhanh.FileName);
                        fulhinhanh.SaveAs(Server.MapPath(path));
                    }
                    ucNotificationDialog.MessageContent = "Thêm mới sản phẩm  thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/sanphams.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                NotificationMessage("Hệ thống gặp sự cố trong quá trình thêm sản phẩm mới!", 0);
            }
        }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();

            try
            {
                Admins vcontroller = new Admins();
                string errMsg = string.Empty;
                Entities.SanPham vsanpham = new Entities.SanPham();
                vsanpham.MaSP = Convert.ToInt32(Request.QueryString["ID"]);
                vsanpham.Gioitinh = Convert.ToInt32(ddlgioitinh.SelectedValue);
                if (string.IsNullOrEmpty(txtgiamua.Text))
                {
                    vsanpham.Giamua = 0;
                }
                else
                {
                    if (COMM.Common.isDouble(txtgiamua.Text))
                    {
                        vsanpham.Giaban = Convert.ToDecimal(txtgiamua.Text);
                    }
                    else
                    {
                        NotificationMessage("Không đúng định dạng", 0);
                        return;
                    }
                }
                if (string.IsNullOrEmpty(txtgiaban.Text))
                {
                    vsanpham.Giaban = 0;
                }
                else
                {
                    if (COMM.Common.isDouble(txtgiaban.Text))
                    {
                        vsanpham.Giaban = Convert.ToDecimal(txtgiaban.Text);
                    }
                    else
                    {
                        NotificationMessage("Không đúng định dạng", 0);
                        return;
                    }
                }
                if (fulhinhanh.HasFile)
                {
                    vsanpham.Hinhanh = "../Img/" + fulhinhanh.FileName;
                }
                else
                {
                    if (string.IsNullOrEmpty(txthinhanh.Text))
                    {
                        vsanpham.Hinhanh = urlhinhanh;
                    }
                    vsanpham.Hinhanh = txthinhanh.Text;
                }
                int result = vcontroller.sp_save_sanpham(vsanpham.MaSP, txttensp.Text, vsanpham.Giamua, vsanpham.Giaban, Convert.ToInt32(ddlLoaisanpham.SelectedValue), Convert.ToInt32(ddlChuDe.SelectedValue), Txtthongtin.Text, Convert.ToInt32(ddlgioitinh.SelectedValue), DateTime.Now, vsanpham.Hinhanh, 0, 0, ref errMsg);
                if (result > 0)
                {
                    if (fulhinhanh.HasFile)
                    {
                        string filename = fulhinhanh.FileName;
                        string path = "~/Img/" + Server.HtmlEncode(fulhinhanh.FileName);
                        fulhinhanh.SaveAs(Server.MapPath(path));
                    }
                    ucNotificationDialog.MessageContent = "cập nhập sản phẩm thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/sanphams.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }
            }

            catch (Exception ex)
            {
                Response.Write(ex.Message);
                ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố trong quá trình cập nhật !";
                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }
 private void FillData()
 {
     try
     {
         Admins vcontroller = new Admins();
         Entities.SanPham vsanpham = new Entities.SanPham();
         Entities.Size vsize = new Entities.Size();
         Entities.SanPham_Size vsanpham_size = new Entities.SanPham_Size();
         string errMsg = string.Empty;
         string[] listid = Convert.ToString(Request.QueryString["ID"]).Split(new char[] { ',' });
         int masp = Convert.ToInt32(listid[0]);
         int masize = Convert.ToInt32(listid[1]);
         vsanpham = vcontroller.getby_sanpham(masp.ToString(), ref errMsg);
         lbltensanpham.Text = vsanpham.TenSP;
         vsize = vcontroller.getby_size_ID(masize.ToString(), ref errMsg);
         lblsize.Text = vsize.Size1;
         vsanpham_size = vcontroller.getby_sanpham_size(masp, masize, ref errMsg);
         txtsoluong.Text = vsanpham_size.Soluong.ToString();
     }
     catch (Exception ex) { Response.Write(ex.Message); }
 }
 private void FillData()
 {
     try
     {
         Admins vcontroller = new Admins();
         Entities.KhachHang vusers = new Entities.KhachHang();
         string errMsg = string.Empty;
         vusers = vcontroller.getby_tk_khachhang_ID(Request.QueryString["ID"], ref errMsg);
         txttendangnhap.Text = vusers.Tendangnhap;
         txttendangnhap.Enabled = false;
         txtmatkhau.Text = vusers.Matkhau;
         txtemail.Text = vusers.Email;
         ddlgioitinh.SelectedIndex = vusers.Gioitinh;
         txthoten.Text = vusers.Hoten;
         txtsdt.Text = vusers.Sodienthoai;
         txtdiachi.Text = vusers.Diachi;
         valtrangthai = vusers.Trangthai;
     }
     catch (Exception ex) { Response.Write(ex.Message); }
 }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();
            Admins vcontroller = new Admins();
            string errMsg = string.Empty;
            try
            {
                int result = vcontroller.duyet_hoadon(Convert.ToString(ucConfirmDialog.Key), true, ref  errMsg);

                if (result > 0)
                {
                    DataTable dt = new DataTable();
                    dt = vcontroller.getall_chitiet_hd(Convert.ToString(ucConfirmDialog.Key), ref  errMsg);
                    //foreach (DataRow row in dt.Rows)
                    //{
                    //    vcontroller.capnhap_soluong(row["masanpham"].ToString(), Convert.ToInt32(row["soluong"].ToString()), ref  errMsg);
                    //}
                    ucNotificationDialog.MessageContent = "duyệt hóa đơn thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/hoadons.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    if (result == -1) { ucNotificationDialog.MessageContent = "Bản ghi không tồn tại!<br/>Vui lòng kiểm tra lại."; }
                    else { ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố!<br/>Vui lòng liên hệ @ để được hỗ trợ."; }

                    ucNotificationDialog.MessageType = 0;
                    ucNotificationDialog.Show();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố!<br/>Vui lòng liên hệ @ để được hỗ trợ.";
                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
            finally
            {
                vcontroller = null;
            }
        }
        protected void ucConfirmDialog_Yes(object sender)
        {
            ucConfirmDialog.Hide();

            try
            {

                Admins vcontroller = new Admins();
                Entities.KhachHang vusers = new Entities.KhachHang();
                string errMsg = string.Empty;
                vusers.MaKH = Convert.ToInt32(Request.QueryString["ID"]);
                vusers.Tendangnhap = txttendangnhap.Text;
                vusers.Matkhau = txtmatkhau.Text;
                vusers.Email = txtemail.Text;
                vusers.Hoten = txthoten.Text;
                vusers.Sodienthoai = txtsdt.Text;
                vusers.Diachi = txtdiachi.Text;
                vusers.Laadmin = true;
                vusers.Trangthai = true;
                vusers.Gioitinh = Convert.ToInt32(ddlgioitinh.SelectedValue);
                int result = vcontroller.save_khachhang(vusers, ref errMsg);
                if (result > 0)
                {
                    ucNotificationDialog.MessageContent = "cập nhập user thành công!";
                    ucNotificationDialog.MessageType = 1;
                    ucNotificationDialog.RedirectUrl = "~/Admin/users.aspx";
                    ucNotificationDialog.Show();
                }
                else
                {
                    NotificationMessage("Vui lòng kiểm tra lại.", 0);
                }
            }

            catch (Exception ex)
            {
                Response.Write(ex.Message);
                ucNotificationDialog.MessageContent = "Hệ thống gặp sự cố trong quá trình cập nhật !";
                ucNotificationDialog.MessageType = 0;
                ucNotificationDialog.Show();
            }
        }