private void btnLuu_Click(object sender, EventArgs e) { if (!Check()) { return; } try { if (tinh_trang == "them") { NHOM_HANG nh = new NHOM_HANG { Ma_Nhom_Hang = txtMaNhomHang.Text, Ten_Nhom_Hang = txtTenNhomHang.Text, Ghi_Chu = txtGhiChu.Text }; db.NHOM_HANGs.InsertOnSubmit(nh); } else { var nh = (from n in db.NHOM_HANGs where n.Ma_Nhom_Hang == txtMaNhomHang.Text select n).FirstOrDefault(); nh.Ma_Nhom_Hang = txtMaNhomHang.Text; nh.Ten_Nhom_Hang = txtTenNhomHang.Text; nh.Ghi_Chu = txtGhiChu.Text; } db.SubmitChanges(); RaiseReloadEventHander(); Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
partial void UpdateNHOM_HANG(NHOM_HANG instance);
partial void DeleteNHOM_HANG(NHOM_HANG instance);
partial void InsertNHOM_HANG(NHOM_HANG instance);