public int getMaBaiVietLichLamViec() { int ma = -1; using (LinQDataContext db = new LinQDataContext(global::DAOAuction.Properties.Settings.Default.webdoantruongConnectionString)) { ISingleResult<TAPTINBAIVIET_getmabaivietlichlamviecResult> lp = db.TAPTINBAIVIET_getmabaivietlichlamviec(); foreach (TAPTINBAIVIET_getmabaivietlichlamviecResult lichlamviec in lp) { ma = lichlamviec.MaBaiViet; } try { // Save the changes. db.SubmitChanges(); } // Detect concurrency conflicts. catch (ChangeConflictException) { // Resolve conflicts. db.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges); } } return ma; }