private void SetTDForUpdate(TestCertificate tDetail) { textBoxTCID.Text = tDetail.TCID.ToString(); textBoxPatientID.Text = tDetail.PatientID.ToString(); textBoxStaffID.Text = tDetail.StafID.ToString(); dateCreate.Value = tDetail.Date; comboBoxState.SelectedIndex = tDetail.State; DataTable dtTestType = TestType.GetListTestType(); for (int i = 0; i < dtTestType.Rows.Count; i++) { TestType newTestType = new TestType(); newTestType.TestTypeID = Convert.ToInt16(dtTestType.Rows[i][0]); newTestType.TestName = dtTestType.Rows[i][1].ToString(); listTestType.Add(newTestType); comboBoxTestType.Items.Add(newTestType.TestName); } comboBoxTestType.SelectedIndex = 0; DataTable dtTestDetail = TestDetail.GetListTestDetail(tDetail.TCID); for (int i = 0; i < dtTestDetail.Rows.Count; i++) { TestDetail newTD = new TestDetail(); newTD.TCID =Convert.ToInt32(dtTestDetail.Rows[i][0]); newTD.TestTypeID = Convert.ToInt16(dtTestDetail.Rows[i][1]); newTD.Result = dtTestDetail.Rows[i][2].ToString(); listTD.Add(newTD); listSelectedTestType.Items.Add(dtTestDetail.Rows[i][3].ToString()); } if (listSelectedTestType.Items.Count > 0) listSelectedTestType.SelectedIndex = 0; }
public static TestType GetTestType(int testTypeID) { TestType newTestType = new TestType(); int tempInterger; string sqlSelect = @"SELECT TESTTYPEID, TYPENAME FROM TESTTYPE WHERE TESTTYPEID=@TESTTYPEID"; SqlParameter[] sqlParameters = { new SqlParameter("@TESTTYPEID", testTypeID) }; DataTable dataTable = SqlResult.ExecuteQuery(sqlSelect,sqlParameters); if (dataTable.Rows.Count > 0) { int.TryParse(dataTable.Rows[0][0].ToString(), out tempInterger); newTestType.TestTypeID = tempInterger; newTestType.TestName = dataTable.Rows[0][1].ToString(); } return newTestType; }
private void SetTDForInsert(int staffID, int patientID) { textBoxPatientID.Text = patientID.ToString(); textBoxStaffID.Text = staffID.ToString(); dateCreate.Value = DateTime.Today; dateCreate.Enabled = false; textBoxResult.Text = "Chưa xét nghiệm"; textBoxResult.ReadOnly = true; comboBoxState.SelectedIndex = 0; comboBoxState.Enabled = false; DataTable dtTestType = TestType.GetListTestType(); for (int i = 0; i < dtTestType.Rows.Count; i++) { TestType newTestType = new TestType(); newTestType.TestTypeID =Convert.ToInt16(dtTestType.Rows[i][0]); newTestType.TestName = dtTestType.Rows[i][1].ToString() ; listTestType.Add(newTestType); comboBoxTestType.Items.Add(newTestType.TestName); } comboBoxTestType.SelectedIndex = 0; }