예제 #1
0
        protected void gridKhachHang_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            string   ID = e.Keys[0].ToString();
            int      IDNhomKhachHang = Int32.Parse(e.NewValues["IDNhomKhachHang"].ToString());
            string   TenKhachHang    = e.NewValues["TenKhachHang"] == null ? "" : e.NewValues["TenKhachHang"].ToString();
            DateTime NgaySinh        = DateTime.Parse(e.NewValues["NgaySinh"] == null ? "" : e.NewValues["NgaySinh"].ToString());
            string   CMND            = e.NewValues["CMND"] == null ? "" : e.NewValues["CMND"].ToString();
            string   DiaChi          = e.NewValues["DiaChi"] == null ? "" : e.NewValues["DiaChi"].ToString();
            string   DienThoai       = e.NewValues["DienThoai"] == null ? "" : e.NewValues["DienThoai"].ToString();
            string   GhiChu          = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString();

            data = new dtKhachHang();
            if (data.KiemTraSDTKhachHang_KhacID(ID, DienThoai) == 0)
            {
                data.SuaThongTinKhachHang(Int32.Parse(ID), IDNhomKhachHang, TenKhachHang, NgaySinh, CMND, DiaChi, DienThoai, GhiChu);
                e.Cancel = true;
                KhachHangExport.CancelEdit();
                LoadGrid();
            }
            else
            {
                throw new Exception("Số điện thoại này đã được đăng ký.");
            }
        }