Ejemplo n.º 1
0
        public void DisplayAsThread()
        {
            Cursor.Current       = Cursors.WaitCursor;
            lbKetQuaTimDuoc.Text = "Kết quả tìm được: 0";
            if (dtpkTuNgay.Value > dtpkDenNgay.Value)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn từ ngày nhỏ hơn hoặc bằng đến ngày.", IconType.Information);
                dtpkTuNgay.Focus();
                return;
            }

            string   tenBenhNhan = txtTenBenhNhan.Text;
            DateTime tuNgay      = dtpkTuNgay.Value;
            DateTime denNgay     = dtpkDenNgay.Value;

            Result result = UserBus.GetAccountList(tuNgay, denNgay, tenBenhNhan, chkMaBenhNhan.Checked);

            if (result.IsOK)
            {
                ClearData();
                DataTable dt = result.QueryResult as DataTable;
                dgBenhNhan.DataSource = result.QueryResult as DataTable;
                lbKetQuaTimDuoc.Text  = string.Format("Kết quả tìm được: {0}", dt.Rows.Count);
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("UserBus.GetAccountList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("UserBus.GetAccountList"));
            }
        }