コード例 #1
0
        private void OnDisplayKetQuaXetNghiemList()
        {
            Result result = XetNghiem_Hitachi917Bus.GetKetQuaXetNghiemList(_fromDate, _toDate, _tenBenhNhan, _isMaBenhNhan);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    dgXetNghiem.DataSource = result.QueryResult;
                    SetCurrentXetNghiem(_xetNghiemGUID);
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetKetQuaXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetKetQuaXetNghiemList"));
            }
        }
コード例 #2
0
        private void OnDisplayXetNghiemList()
        {
            Result result = XetNghiem_Hitachi917Bus.GetDanhSachXetNghiem();

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    _dataSource = result.QueryResult as DataTable;
                    OnSearchXetNghiem();
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetXetNghiemList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetXetNghiemList"));
            }
        }
コード例 #3
0
        private void OnSaveInfo()
        {
            try
            {
                MethodInvoker method = delegate
                {
                    _chiTietKQXN.TestResult = numKetQua.Value.ToString();
                    if (chkFromValue.Checked)
                    {
                        _chiTietKQXN.FromValue = (double)numFromValue.Value;
                    }

                    if (chkToValue.Checked)
                    {
                        _chiTietKQXN.ToValue = (double)numToValue.Value;
                    }

                    _chiTietKQXN.DonVi = txtDonVi.Text;

                    _chiTietKQXN.LamThem = chkLamThem.Checked;

                    Result result = XetNghiem_Hitachi917Bus.UpdateChiSoKetQuaXetNghiem(_chiTietKQXN);

                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdateChiSoKetQuaXetNghiem"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdateChiSoKetQuaXetNghiem"));
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                    }
                    else
                    {
                        _binhThuong = result.QueryResult.ToString();
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
コード例 #4
0
        private void OnDisplayChiTietKetQuaXetNghiem(string ketQuaXetNghiemGUID)
        {
            Result result = XetNghiem_Hitachi917Bus.GetChiTietKetQuaXetNghiem(ketQuaXetNghiemGUID);

            if (result.IsOK)
            {
                dgChiTietKQXN.DataSource = result.QueryResult;
                RefreshHighlight();
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetChiTietKetQuaXetNghiem"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.GetChiTietKetQuaXetNghiem"));
            }
        }
コード例 #5
0
        private void OnCapNhatBenhNhan()
        {
            if (dgXetNghiem.SelectedRows == null || dgXetNghiem.SelectedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn 1 xét nghiệm để cập nhật bệnh nhân.", IconType.Information);
                return;
            }

            DataRow row = (dgXetNghiem.SelectedRows[0].DataBoundItem as DataRowView).Row;

            if (row == null)
            {
                return;
            }

            dlgSelectPatient dlg = new dlgSelectPatient(PatientSearchType.BenhNhan);

            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                DataRow patientRow = dlg.PatientRow;
                if (patientRow != null)
                {
                    KetQuaXetNghiem_Hitachi917 kqxn = new KetQuaXetNghiem_Hitachi917();
                    kqxn.KQXN_Hitachi917GUID = Guid.Parse(row["KQXN_Hitachi917GUID"].ToString());
                    kqxn.PatientGUID         = Guid.Parse(patientRow["PatientGUID"].ToString());
                    Result result = XetNghiem_Hitachi917Bus.UpdatePatient(kqxn);
                    if (result.IsOK)
                    {
                        row["PatientGUID"] = patientRow["PatientGUID"];
                        row["FileNum"]     = patientRow["FileNum"];
                        row["FullName"]    = patientRow["FullName"];
                        row["DobStr"]      = patientRow["DobStr"];
                        row["GenderAsStr"] = patientRow["GenderAsStr"];

                        OnDisplayChiTietKetQuaXetNghiem(row["KQXN_Hitachi917GUID"].ToString());
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdatePatient"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdatePatient"));
                    }
                }
            }
        }
コード例 #6
0
        private void OnDeleteChiTietKetQuaXetNghiem()
        {
            List <string>  deletedCTKQXNList = new List <string>();
            List <DataRow> deletedRows       = new List <DataRow>();
            DataTable      dt = dgChiTietKQXN.DataSource as DataTable;

            foreach (DataRow row in dt.Rows)
            {
                if (Boolean.Parse(row["Checked"].ToString()))
                {
                    deletedCTKQXNList.Add(row["ChiTietKQXN_Hitachi917GUID"].ToString());
                    deletedRows.Add(row);
                }
            }

            if (deletedCTKQXNList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những chi tiết kết quả xét nghiệm bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = XetNghiem_Hitachi917Bus.DeleteChiTietKetQuaXetNghiem(deletedCTKQXNList);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            dt.Rows.Remove(row);
                        }
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.DeleteChiTietKetQuaXetNghiem"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.DeleteChiTietKetQuaXetNghiem"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những chi tiết kết quả xét nghiệm cần xóa.", IconType.Information);
            }
        }
コード例 #7
0
        private void port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            try
            {
                SerialPort port       = (SerialPort)sender;
                PortConfig portConfig = Global.PortConfigCollection.GetPortConfigByPortName(port.PortName);
                if (portConfig == null)
                {
                    return;
                }

                LoadConfig();

                string data = port.ReadExisting();

                if (portConfig.LoaiMay == LoaiMayXN.Hitachi917)
                {
                    List <TestResult_Hitachi917> testResults = ParseTestResult_Hitachi917(data, port.PortName);
                    Result result = XetNghiem_Hitachi917Bus.InsertKQXN(testResults);
                    if (!result.IsOK)
                    {
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.InsertKQXN"));
                    }
                }
                else if (portConfig.LoaiMay == LoaiMayXN.CellDyn3200)
                {
                    List <TestResult_CellDyn3200> testResults = ParseTestResult_CellDyn3200(data, port.PortName);
                    Result result = XetNghiem_CellDyn3200Bus.InsertKQXN(testResults);
                    if (!result.IsOK)
                    {
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_CellDyn3200Bus.InsertKQXN"));
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.WriteToTraceLog(string.Format("Serial Port: {0}", ex.Message));
            }
        }
コード例 #8
0
        private void OnSaveInfo()
        {
            try
            {
                MethodInvoker method = delegate
                {
                    List <ChiTietXetNghiem_Hitachi917> ctxns = new List <ChiTietXetNghiem_Hitachi917>();
                    if (raChung.Checked)
                    {
                        ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                        ctxn.DoiTuong = (byte)DoiTuong.Chung;
                        if (chkFromValue_Chung.Checked)
                        {
                            ctxn.FromValue = (double)numFromValue_Chung.Value;
                        }
                        if (chkToValue_Chung.Checked)
                        {
                            ctxn.ToValue = (double)numToValue_Chung.Value;
                        }
                        ctxn.DonVi = txtDonVi_Chung.Text;
                        ctxns.Add(ctxn);

                        ctxn          = new ChiTietXetNghiem_Hitachi917();
                        ctxn.DoiTuong = (byte)DoiTuong.Chung_Sau2h;
                        if (chkFromValue_Chung_Sau2h.Checked)
                        {
                            ctxn.FromValue = (double)numFromValue_Chung_Sau2h.Value;
                        }
                        if (chkToValue_Chung_Sau2h.Checked)
                        {
                            ctxn.ToValue = (double)numToValue_Chung_Sau2h.Value;
                        }
                        ctxn.DonVi = txtDonVi_Chung_Sau2h.Text;
                        ctxns.Add(ctxn);
                    }
                    else if (raNamNu.Checked)
                    {
                        if (chkNam.Checked)
                        {
                            ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.Nam;
                            if (chkFromValue_Nam.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_Nam.Value;
                            }
                            if (chkToValue_Nam.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_Nam.Value;
                            }
                            ctxn.DonVi = txtDonVi_Nam.Text;
                            ctxns.Add(ctxn);

                            ctxn          = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.Nam_Sau2h;
                            if (chkFromValue_Nam_Sau2h.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_Nam_Sau2h.Value;
                            }
                            if (chkToValue_Nam_Sau2h.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_Nam_Sau2h.Value;
                            }
                            ctxn.DonVi = txtDonVi_Nam_Sau2h.Text;
                            ctxns.Add(ctxn);
                        }

                        if (chkNu.Checked)
                        {
                            ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.Nu;
                            if (chkFromValue_Nu.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_Nu.Value;
                            }
                            if (chkToValue_Nu.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_Nu.Value;
                            }
                            ctxn.DonVi = txtDonVi_Nu.Text;
                            ctxns.Add(ctxn);

                            ctxn          = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.Nu_Sau2h;
                            if (chkFromValue_Nu_Sau2h.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_Nu_Sau2h.Value;
                            }
                            if (chkToValue_Nu_Sau2h.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_Nu_Sau2h.Value;
                            }
                            ctxn.DonVi = txtDonVi_Nu_Sau2h.Text;
                            ctxns.Add(ctxn);
                        }
                    }
                    else
                    {
                        if (chkTreEm.Checked)
                        {
                            ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.TreEm;
                            if (chkFromValue_TreEm.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_TreEm.Value;
                            }
                            if (chkToValue_TreEm.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_TreEm.Value;
                            }
                            ctxn.DonVi = txtDonVi_TreEm.Text;
                            ctxns.Add(ctxn);

                            ctxn          = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.TreEm_Sau2h;
                            if (chkFromValue_TreEm_Sau2h.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_TreEm_Sau2h.Value;
                            }
                            if (chkToValue_TreEm_Sau2h.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_TreEm_Sau2h.Value;
                            }
                            ctxn.DonVi = txtDonVi_TreEm_Sau2h.Text;
                            ctxns.Add(ctxn);
                        }

                        if (chkNguoiLon.Checked)
                        {
                            ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.NguoiLon;
                            if (chkFromValue_NguoiLon.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_NguoiLon.Value;
                            }
                            if (chkToValue_NguoiLon.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_NguoiLon.Value;
                            }
                            ctxn.DonVi = txtDonVi_NguoiLon.Text;
                            ctxns.Add(ctxn);

                            ctxn          = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.NguoiLon_Sau2h;
                            if (chkFromValue_NguoiLon_Sau2h.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_NguoiLon_Sau2h.Value;
                            }
                            if (chkToValue_NguoiLon_Sau2h.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_NguoiLon_Sau2h.Value;
                            }
                            ctxn.DonVi = txtDonVi_NguoiLon_Sau2h.Text;
                            ctxns.Add(ctxn);
                        }

                        if (chkNguoiCaoTuoi.Checked)
                        {
                            ChiTietXetNghiem_Hitachi917 ctxn = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.NguoiCaoTuoi;
                            if (chkFromValue_NguoiCaoTuoi.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_NguoiCaoTuoi.Value;
                            }
                            if (chkToValue_NguoiCaoTuoi.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_NguoiCaoTuoi.Value;
                            }
                            ctxn.DonVi = txtDonVi_NguoiCaoTuoi.Text;
                            ctxns.Add(ctxn);

                            ctxn          = new ChiTietXetNghiem_Hitachi917();
                            ctxn.DoiTuong = (byte)DoiTuong.NguoiCaoTuoi_Sau2h;
                            if (chkFromValue_NguoiCaoTuoi_Sau2h.Checked)
                            {
                                ctxn.FromValue = (double)numFromValue_NguoiCaoTuoi_Sau2h.Value;
                            }
                            if (chkToValue_NguoiCaoTuoi_Sau2h.Checked)
                            {
                                ctxn.ToValue = (double)numToValue_NguoiCaoTuoi_Sau2h.Value;
                            }
                            ctxn.DonVi = txtDonVi_NguoiCaoTuoi_Sau2h.Text;
                            ctxns.Add(ctxn);
                        }
                    }

                    Result result = XetNghiem_Hitachi917Bus.UpdateXetNghiem(_xetNghiem, ctxns);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdateXetNghiem"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_Hitachi917Bus.UpdateXetNghiem"));
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, "Lưu chỉ số xét nghiệm thành công.", IconType.Information);
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(Application.ProductName, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
コード例 #9
0
        public void DisplayInfo(DataRow drXetNghiem)
        {
            try
            {
                ClearData();
                _xetNghiem.XetNghiemGUID = Guid.Parse(drXetNghiem["XetNghiemGUID"].ToString());
                Result result = XetNghiem_Hitachi917Bus.GetChiTietXetNghiemList(_xetNghiem.XetNghiemGUID.ToString());
                if (result.IsOK)
                {
                    DataTable dt = result.QueryResult as DataTable;
                    foreach (DataRow row in dt.Rows)
                    {
                        switch ((DoiTuong)Convert.ToByte(row["DoiTuong"]))
                        {
                        case DoiTuong.Chung:
                            raChung.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Chung.Checked = true;
                                numFromValue_Chung.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Chung.Checked = true;
                                numToValue_Chung.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Chung.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.Chung_Sau2h:
                            raChung.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Chung_Sau2h.Checked = true;
                                numFromValue_Chung_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Chung_Sau2h.Checked = true;
                                numToValue_Chung_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Chung_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.Nam:
                            raNamNu.Checked = true;
                            chkNam.Checked  = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Nam.Checked = true;
                                numFromValue_Nam.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Nam.Checked = true;
                                numToValue_Nam.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Nam.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.Nam_Sau2h:
                            raNamNu.Checked = true;
                            chkNam.Checked  = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Nam_Sau2h.Checked = true;
                                numFromValue_Nam_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Nam_Sau2h.Checked = true;
                                numToValue_Nam_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Nam_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.Nu:
                            raNamNu.Checked = true;
                            chkNu.Checked   = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Nu.Checked = true;
                                numFromValue_Nu.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Nu.Checked = true;
                                numToValue_Nu.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Nu.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.Nu_Sau2h:
                            raNamNu.Checked = true;
                            chkNu.Checked   = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_Nu_Sau2h.Checked = true;
                                numFromValue_Nu_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_Nu_Sau2h.Checked = true;
                                numToValue_Nu_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_Nu_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.TreEm:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkTreEm.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_TreEm.Checked = true;
                                numFromValue_TreEm.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_TreEm.Checked = true;
                                numToValue_TreEm.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_TreEm.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.TreEm_Sau2h:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkTreEm.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_TreEm_Sau2h.Checked = true;
                                numFromValue_TreEm_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_TreEm_Sau2h.Checked = true;
                                numToValue_TreEm_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_TreEm_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.NguoiLon:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkNguoiLon.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_NguoiLon.Checked = true;
                                numFromValue_NguoiLon.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_NguoiLon.Checked = true;
                                numToValue_NguoiLon.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_NguoiLon.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.NguoiLon_Sau2h:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkNguoiLon.Checked = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_NguoiLon_Sau2h.Checked = true;
                                numFromValue_NguoiLon_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_NguoiLon_Sau2h.Checked = true;
                                numToValue_NguoiLon_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_NguoiLon_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.NguoiCaoTuoi:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkNguoiCaoTuoi.Checked             = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_NguoiCaoTuoi.Checked = true;
                                numFromValue_NguoiCaoTuoi.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_NguoiCaoTuoi.Checked = true;
                                numToValue_NguoiCaoTuoi.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_NguoiCaoTuoi.Text = row["DonVi"].ToString();
                            }
                            break;

                        case DoiTuong.NguoiCaoTuoi_Sau2h:
                            raTreEmNguoiLonNguoiCaoTuoi.Checked = true;
                            chkNguoiCaoTuoi.Checked             = true;
                            if (row["FromValue"] != null && row["FromValue"] != DBNull.Value)
                            {
                                chkFromValue_NguoiCaoTuoi_Sau2h.Checked = true;
                                numFromValue_NguoiCaoTuoi_Sau2h.Value   = (Decimal)Convert.ToDouble(row["FromValue"]);
                            }

                            if (row["ToValue"] != null && row["ToValue"] != DBNull.Value)
                            {
                                chkToValue_NguoiCaoTuoi_Sau2h.Checked = true;
                                numToValue_NguoiCaoTuoi_Sau2h.Value   = (Decimal)Convert.ToDouble(row["ToValue"]);
                            }

                            if (row["DonVi"] != null && row["DonVi"] != DBNull.Value)
                            {
                                txtDonVi_NguoiCaoTuoi_Sau2h.Text = row["DonVi"].ToString();
                            }
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(Application.ProductName, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }