private void LoadEmployee(string BarCodeID) { int employeeID = 0; txtBarCodeID.Text = BarCodeID; swipeDO = new SwipeDO(); DataSet dataSet = swipeDO.GetEmployeeInfoByBarCode(BarCodeID); if (dataSet != null) { DataTable dbtable = dataSet.Tables[0]; if (dbtable.Rows.Count == 0) { lblError.Text = "Nhân viên này không tồn tại trong hệ thống !"; lblError.Visible = true; //btnImport.Visible = false; tmrUpdateMessage.Enabled = true; //txtEmployeeName.Text = "Nhân viên này không tồn tại trong hệ thống !"; //txtBarCodeID.Text = string.Empty; txtEmployeeName.Text = ""; lblTime.Text = ""; txtDepartment.Text = ""; picEmployee.Image = Image.FromFile(Application.StartupPath + "/IMAGES/noimage3.jpg"); Sound.Play(Application.StartupPath + "/IMAGES/wReadError.wav", PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_ASYNC); } else { lblError.Visible = false; foreach (DataRow dataRow in dbtable.Rows) { employeeID = (int)dataRow["EmployeeID"]; txtEmployeeName.Text = dataRow["EmployeeName"].ToString(); txtDepartment.Text = dataRow["DepartmentName"].ToString(); if (dataRow["Picture"] != DBNull.Value) { string PictureFileName = Utils.settings.PicturePath + '\\' + dataRow["Picture"].ToString(); try { picEmployee.Image = Image.FromFile(PictureFileName); } catch { picEmployee.Image = Image.FromFile(Application.StartupPath + "/IMAGES/noimage3.jpg"); } } else { picEmployee.Image = Image.FromFile(Application.StartupPath + "/IMAGES/noimage3.jpg"); } } int ret = ProcessCardData(employeeID); if (ret != 0) { // Sound.Play("IMAGES\\wGoodRead.wav", PlaySounáolags.SND_FILENAME | PlaySoundFlags.SND_ASYNC); Sound.Play(Application.StartupPath + "/IMAGES/wGoodRead.wav", PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_ASYNC); txtBarCodeID.Text = string.Empty; txtBarCodeID.Focus(); } else { //if (checkConnection) //{ MessageBox.Show("Không thể lưu thông tin vào ra của nhân viên này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); //} } } } else { MessageBox.Show("Không kết nối được cơ sở dữ liệu, hãy xem lại cấu hình hệ thống ?", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtEmployeeName.Text = ""; lblTime.Text = ""; txtDepartment.Text = ""; picEmployee.Image = Image.FromFile(Application.StartupPath + "/IMAGES/noimage3.jpg"); Sound.Play(Application.StartupPath + "/IMAGES/wReadError.wav", PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_ASYNC); } }