private void txtBarcode_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Enter) { boardNo = txtBarcode.Text; var models = modelsService.Get("FujiXerox"); // test time performent sw.Start(); if (boardNo != string.Empty && boardNo.Length >= 10) { DefaultMessage(); foreach (var item in models) { if (boardNo.Contains(item.ModelName)) { quantity = item.Quantity; lblCount.Text = $"{count}/{quantity}"; _model = item; break; } } var checkExists = testLogService.GetSingle(boardNo); if (Program.CurrentUser.OperationID == 1) { if (checkExists != null) { ErrorMessage("NG", $"PCB [{boardNo}] đã có trong hệ thống. Vui lòng kiểm tra lại\n" + $"Box ID: {checkExists.BoxID}"); txtBarcode.SelectAll(); txtBarcode.Focus(); } else { DefaultMessage(); InsertLog(boxId, boardNo); } } if (Program.CurrentUser.OperationID == 2) { } } else { ErrorMessage("NG", "Barcode không đúng. Vui lòng nhập lại Barcode!"); txtBarcode.SelectAll(); txtBarcode.Focus(); } } }