protected void grvNhomChucDanh_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            switch (e.Item.OwnerTableView.Name)
            {
            case "tbl_NhomChucDanh":
                NhomChucDanh nhomchucdanh = new NhomChucDanh();
                nhomchucdanh.NgayTao  = nhomchucdanh.NgayCapNhat = DateTime.Now;
                nhomchucdanh.NguoiTao = nhomchucdanh.NguoiCapNhat = idNhanVien;
                item.UpdateValues(nhomchucdanh);
                _entities.AddToNhomChucDanhs(nhomchucdanh);
                _entities.SaveChanges();
                break;

            case "tbl_ChucDanhChuyenMon":
                ChucDanh chucdanh = new ChucDanh();
                item.UpdateValues(chucdanh);
                GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
                if (parentItem != null)
                {
                    var idNhomChucDanh = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["IDNhomChucDanh"].ToString();
                    chucdanh.IDNhomChucDanh = Convert.ToInt32(idNhomChucDanh);
                    chucdanh.NgayTao        = chucdanh.NgayCapNhat = DateTime.Now;
                    chucdanh.NguoiTao       = chucdanh.NguoiCapNhat = idNhanVien;
                    _entities.AddToChucDanhs(chucdanh);
                    _entities.SaveChanges();
                }
                break;
            }
        }