private void btnLoadData_Click(object sender, EventArgs e)
{
TeipiClear();
SqlConnection sqlConnection = new SqlConnection(Connect.pcnTEIPI);
sqlConnection.Open();
SqlCommand sqlCommand = new SqlCommand("usp_AttendanceDetails1", sqlConnection);
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Parameters.AddWithValue("@fullName", cboName.Text);
sqlCommand.Parameters.AddWithValue("@timeIn", dtpDateFrom.Text);
sqlCommand.Parameters.AddWithValue("@timeOut", dtpDateto.Text);
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
DataSet dataSet = new DataSet();
sqlDataAdapter.Fill(dataSet);
if (dataSet.Tables.Count > 0)
{
if (dataSet.Tables[0].Rows.Count > 0)
{
txtEmpNumber.Text = dataSet.Tables[0].Rows[0]["EmployeeNumber"].ToString();
txtLastname.Text = dataSet.Tables[0].Rows[0]["LastName"].ToString();
txtFirstname.Text = dataSet.Tables[0].Rows[0]["FirstName"].ToString();
txtType.Text = dataSet.Tables[0].Rows[0]["Type"].ToString();
txtDepartment.Text = dataSet.Tables[0].Rows[0]["Department"].ToString();
txtPosition.Text = dataSet.Tables[0].Rows[0]["Position"].ToString();
if (dataSet.Tables[1].Rows.Count > 0)
{
for (int i = 0; i <= dataSet.Tables[1].Rows.Count - 1; i++)
{
TextBox TIMEIN = this.Controls.Find("TDateINOUT" + (i + 1).ToString(), true).FirstOrDefault() as TextBox;
TIMEIN.Text = dataSet.Tables[1].Rows[i]["TDateINOUT"].ToString();
}
}
}
}
txtFrom.Text = dtpDateFrom.Text;
txtTo.Text = dtpDateto.Text;
}