Example #1
0
        /// Functions
        #region Functions

        /// <summary>
        ///
        /// </summary>
        private void Search()
        {
            //string date = DataValidation.DateValidation(tbFilter_Date.Text);
            string date = dtpFilter_Date.Checked ? dtpFilter_Date.Value.ToString() : "";

            testType = ((bFilter_Reading.Tag != null) ? 2 : 0) + ((bFilter_Pursuit.Tag != null) ? 1 : 0);
            dgvTests.Rows.Clear();
            DataTable dt = DataBaseWorker.SearchTest(tbFilter_PatientName.Text, tbFilter_TesterName.Text, date, testType);

            if (dt == null)
            {
                return;
            }

            int i = 0;

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    dgvTests.Rows.Add();
                    dgvTests.Rows[i].Cells["Patient"].Value   = row["Patient"].ToString();
                    dgvTests.Rows[i].Cells["PatientID"].Value = row["PatientID"].ToString();
                    dgvTests.Rows[i].Cells["Tester"].Value    = row["Tester"].ToString();
                    dgvTests.Rows[i].Cells["Date"].Value      = row["Date"].ToString();
                    dgvTests.Rows[i].Cells["DateUTC"].Value   = DataConverter.UTCDateFromLocalTime(row["DateUTC"].ToString());
                    int testTypex = int.Parse(row["TestType"].ToString());
                    dgvTests.Rows[i].Cells["Test"].Value = (TestType)testTypex;
                    i++;
                }
                catch (Exception ex)
                {
                    ErrorLog.ErrorLog.toErrorFile(ex.GetBaseException().ToString());;
                }
            }
        }