private void displayNameAndImage(EmployeeData empData)
        {
            lblName.Text = empData.getEmployeeName();
            txtRole.Text = empData.deptStr;

            if (lblName.Text != "")
            {
                updateImage(empData.empId);
            }
            else
            {
                picBoxEmployee.Image = null;
            }
        }
示例#2
0
        private void displayNameAndImage(EmployeeData empData)
        {
            try
            {
                lblName.Text = empData.getEmployeeName();
                txtRole.Text = empData.deptStr;

                // Motorbike number
                string motorNum = "";
                this.OpenConnection();
                string          selectCmd = "select num from bienso where emp_no='" + empData.empId + "';";
                MySqlCommand    command3  = new MySqlCommand(selectCmd, connection);
                MySqlDataReader reader3   = command3.ExecuteReader();
                if (reader3.HasRows)
                {
                    while (reader3.Read())
                    {
                        if (!reader3.IsDBNull(0))
                        {
                            motorNum = reader3.GetString(0);
                        }
                    }
                }
                lblMotorNum.Text = motorNum;
                CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (lblName.Text != "")
            {
                updateEmployeeImage(empData.empId);
            }
            else
            {
                picBoxEmployee.Image = null;
            }
        }