private void LoadQheDichvuCLS() { QheNhanvienDanhmucCollection lstQhenhanviendanhmucdichvucls = new Select().From(QheNhanvienDanhmuc.Schema) .Where(QheNhanvienDanhmuc.Columns.IdNhanvien).IsEqualTo(Utility.Int32Dbnull(txtID.Text)) .And(QheNhanvienDanhmuc.Columns.Loai).IsEqualTo(0) .ExecuteAsCollection <QheNhanvienDanhmucCollection>(); foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdDichvuCls.GetDataRows()) { gridExRow.BeginEdit(); var query = from kho in lstQhenhanviendanhmucdichvucls.AsEnumerable() where kho.IdDichvu == Utility.sDbnull(gridExRow.Cells[DmucChung.Columns.Ma].Value) select kho; if (query.Count() > 0) { gridExRow.IsChecked = true; } else { gridExRow.IsChecked = false; } gridExRow.EndEdit(); } }
private void LoadQuanHeNhanVienKho() { QheNhanvienKhoCollection objNhanvienKhoCollection = new Select().From(QheNhanvienKho.Schema) .Where(QheNhanvienKho.Columns.IdNhanvien).IsEqualTo(Utility.Int32Dbnull(txtID.Text)). ExecuteAsCollection <QheNhanvienKhoCollection>(); foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdKhoThuoc.GetDataRows()) { gridExRow.BeginEdit(); var query = from kho in objNhanvienKhoCollection.AsEnumerable() where kho.IdKho == Utility.Int32Dbnull(gridExRow.Cells[TDmucKho.Columns.IdKho].Value) select kho; if (query.Count() > 0) { gridExRow.Cells["IsChon"].Value = 1; gridExRow.IsChecked = true; } else { gridExRow.Cells["IsChon"].Value = 0; gridExRow.IsChecked = false; } gridExRow.EndEdit(); } }
private void LoadQheBS_khoanoitru() { QheBacsiKhoaphongCollection lstQheBacsiKhoaphong = new Select().From(QheBacsiKhoaphong.Schema) .Where(QheBacsiKhoaphong.Columns.IdBacsi).IsEqualTo(Utility.Int32Dbnull(txtID.Text)) .And(QheBacsiKhoaphong.Columns.Noitru).IsEqualTo(1) .ExecuteAsCollection <QheBacsiKhoaphongCollection>(); foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdKhoanoitru.GetDataRows()) { gridExRow.BeginEdit(); var query = from kho in lstQheBacsiKhoaphong.AsEnumerable() where kho.IdKhoa == Utility.Int32Dbnull(gridExRow.Cells[DmucKhoaphong.Columns.IdKhoaphong].Value) select kho; if (query.Count() > 0) { gridExRow.IsChecked = true; } else { gridExRow.IsChecked = false; } gridExRow.EndEdit(); } }
private void AutocompleteBenhvien() { DataTable m_dtBenhvien = new Select().From(DmucBenhvien.Schema).ExecuteDataSet().Tables[0]; try { if (m_dtBenhvien == null) { return; } if (!m_dtBenhvien.Columns.Contains("ShortCut")) { m_dtBenhvien.Columns.Add(new DataColumn("ShortCut", typeof(string))); } foreach (DataRow dr in m_dtBenhvien.Rows) { string shortcut = ""; string realName = dr[DmucBenhvien.Columns.TenBenhvien].ToString().Trim() + " " + Utility.Bodau(dr[DmucBenhvien.Columns.TenBenhvien].ToString().Trim()); shortcut = dr[DmucBenhvien.Columns.MaBenhvien].ToString().Trim(); string[] arrWords = realName.ToLower().Split(' '); string _space = ""; string _Nospace = ""; foreach (string word in arrWords) { if (word.Trim() != "") { _space += word + " "; //_Nospace += word; } } shortcut += _space; // +_Nospace; foreach (string word in arrWords) { if (word.Trim() != "") { shortcut += word.Substring(0, 1); } } dr["ShortCut"] = shortcut; } var source = new List <string>(); EnumerableRowCollection <string> query = from p in m_dtBenhvien.AsEnumerable() select p[DmucBenhvien.Columns.IdBenhvien] + "#" + p[DmucBenhvien.Columns.MaBenhvien] + "@" + p[DmucBenhvien.Columns.TenBenhvien] + "@" + p["shortcut"]; source = query.ToList(); txtNoichuyenden.AutoCompleteList = source; txtNoichuyenden.TextAlign = HorizontalAlignment.Left; txtNoichuyenden.CaseSensitive = false; txtNoichuyenden.MinTypedCharacters = 1; } catch (Exception ex) { Utility.CatchException(ex); } finally { } }
private void AutocompleteThanhpho() { DataTable m_dtThanhpho = new Select().From(DmucDiachinh.Schema).Where(DmucDiachinh.Columns.LoaiDiachinh).IsEqualTo(0).ExecuteDataSet().Tables[0]; try { if (m_dtThanhpho == null) { return; } if (!m_dtThanhpho.Columns.Contains("ShortCut")) { m_dtThanhpho.Columns.Add(new DataColumn("ShortCut", typeof(string))); } foreach (DataRow dr in m_dtThanhpho.Rows) { string shortcut = ""; string realName = dr[DmucDiachinh.Columns.TenDiachinh].ToString().Trim() + " " + Utility.Bodau(dr[DmucDiachinh.Columns.TenDiachinh].ToString().Trim()); shortcut = dr[DmucDiachinh.Columns.MaDiachinh].ToString().Trim(); string[] arrWords = realName.ToLower().Split(' '); string _space = ""; string _Nospace = ""; foreach (string word in arrWords) { if (word.Trim() != "") { _space += word + " "; //_Nospace += word; } } shortcut += _space; // +_Nospace; foreach (string word in arrWords) { if (word.Trim() != "") { shortcut += word.Substring(0, 1); } } dr["ShortCut"] = shortcut; } } catch { } finally { var source = new List <string>(); var query = from p in m_dtThanhpho.AsEnumerable() select p[DmucDiachinh.MaDiachinhColumn.ColumnName].ToString() + "#" + p[DmucDiachinh.MaDiachinhColumn.ColumnName].ToString() + "@" + p[DmucDiachinh.TenDiachinhColumn.ColumnName].ToString() + "@" + p.Field <string>("shortcut").ToString(); source = query.ToList(); this.txtThanhpho.AutoCompleteList = source; this.txtThanhpho.TextAlign = HorizontalAlignment.Left; this.txtThanhpho.CaseSensitive = false; this.txtThanhpho.MinTypedCharacters = 1; } }
private void AutocompleteKieuKham() { DataTable dtStaff = new DataTable(); try { dtStaff = new Select(SysUser.Columns.PkSuid, string.Format("({0} + isnull(' - ' + {1},'')) as Staff_Name", SysUser.Columns.PkSuid, SysUser.Columns.SFullName)).From(SysUser.Schema).ExecuteDataSet().Tables[0]; if (dtStaff == null) { return; } if (!dtStaff.Columns.Contains("ShortCut")) { dtStaff.Columns.Add(new DataColumn("ShortCut", typeof(string))); } foreach (DataRow dr in dtStaff.Rows) { string shortcut = ""; string realName = dr["Staff_Name"].ToString().Trim() + " " + Utility.Bodau(dr["Staff_Name"].ToString().Trim()); shortcut = dr[SysUser.Columns.PkSuid].ToString().Trim(); string[] arrWords = realName.ToLower().Split(' '); string _space = ""; string _Nospace = ""; foreach (string word in arrWords) { if (word.Trim() != "") { _space += word + " "; //_Nospace += word; } } shortcut += _space; // +_Nospace; foreach (string word in arrWords) { if (word.Trim() != "") { shortcut += word.Substring(0, 1); } } dr["ShortCut"] = shortcut; } } catch { } finally { var source = new List <string>(); var query = from p in dtStaff.AsEnumerable() select p[SysUser.Columns.PkSuid].ToString() + "#" + p[SysUser.Columns.PkSuid].ToString() + "@" + p["Staff_Name"].ToString() + "@" + p.Field <string>("shortcut").ToString(); source = query.ToList(); this.txtNhanvien.AutoCompleteList = source; this.txtNhanvien.TextAlign = HorizontalAlignment.Center; this.txtNhanvien.CaseSensitive = false; this.txtNhanvien.MinTypedCharacters = 1; } }
private void cboUserName_SelectedValueChanged(object sender, System.EventArgs e) { DataTable objNhanvien = new Select("*").From(SysUser.Schema).Where(SysUser.Columns.PkSuid).IsEqualTo( Utility.sDbnull(cboUserName.SelectedValue)).ExecuteDataSet().Tables[0]; if (objNhanvien != null && em_Action == action.Insert) { foreach (DataRow row in objNhanvien.AsEnumerable()) { txtName.Text = row["sFullName"].ToString(); txtStaffCode.Text = row["PK_sUID"].ToString(); txtKhoa.Text = row["sDepart"].ToString(); } } }
private void LoadQuanHeNhanVienQuyen() { QheNhanvienQuyensudungCollection LstQheNhanvienQuyensudung = new Select().From(QheNhanvienQuyensudung.Schema) .Where(QheNhanvienQuyensudung.Columns.IdNhanvien).IsEqualTo(Utility.Int32Dbnull(txtID.Text)). ExecuteAsCollection <QheNhanvienQuyensudungCollection>(); foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuyen.GetDataRows()) { gridExRow.BeginEdit(); var query = from kho in LstQheNhanvienQuyensudung.AsEnumerable() where kho.Ma == Utility.sDbnull(gridExRow.Cells[QheNhanvienQuyensudung.Columns.Ma].Value) select kho; if (query.Count() > 0) { gridExRow.IsChecked = true; } else { gridExRow.IsChecked = false; } gridExRow.EndEdit(); } }
private void grdTestInfoModification_CellUpdated(object sender, ColumnActionEventArgs e) { if (grdTestInfoModification.CurrentColumn.Key == "Barcode") { bool bSuccess = false; string vBarcode = Utility.sDbnull(grdTestInfoModification.GetValue("Barcode")); try { //Tim Patient_ID moi cho test_ID dang dc chon if (vBarcode.Length <= 4) vBarcode = DateTime.Now.ToString("yyMMdd") + vBarcode.PadLeft(4, '0'); DataTable dtPatientModified = TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.Barcode, vBarcode).AND( TTestInfo.Columns.PatientId, Comparison.GreaterThan, 0).ExecuteDataSet().Tables[0]; //Neu ko tim thay if ( (from drCount in dtPatientModified.AsEnumerable() select drCount["Patient_ID"]).Distinct().Count () != 1) { Utility.ShowMsg( string.Format( "Không tìm thấy bệnh nhân có barcode {0} hoặc tìm thấy nhiều hơn 1 bệnh nhân. Đề nghị thực hiện lại.", vBarcode)); grdTestInfoModification.CurrentRow.Cells["Barcode"].Value = CurrentRowBarcode; return; } //Neu tim thay int newPatientID = Utility.Int32Dbnull(dtPatientModified.Rows[0]["Patient_ID"]); int oldPatientID = Utility.Int32Dbnull(grdTestInfoModification.GetValue("Patient_ID")); int oldTestID = Utility.Int32Dbnull(grdTestInfoModification.GetValue("Test_ID")); int vTestType_ID = Utility.Int32Dbnull(grdTestInfoModification.GetValue("TestType_ID")); LPatientInfo obj = LPatientInfo.FetchByID(newPatientID); if (obj == null) { Utility.ShowMsg("Không tồn tại bệnh nhân !"); return; } if ( !Utility.AcceptQuestion( string.Format("Thực hiện chuyển sang bệnh nhận {0} có barcode {1} ?", obj.PatientName, vBarcode), "Thông báo", true)) return; DataRow dr = Utility.GetDataRow(dtPatientModified, "TestType_ID", vTestType_ID); DataRow drPatient = Utility.GetDataRow(dtResultModification, new[] {"Patient_ID", "Test_ID"}, new object[] {oldPatientID, oldTestID}); if (drPatient == null) { Utility.ShowMsg("Không tìm thấy thông tin trên lưới"); return; } int newTest_ID = oldTestID; if (oldTestID > 0) { if (dr == null) { newTest_ID = oldTestID; new Update(TTestInfo.Schema.Name). //Set(TTestInfo.Columns.Barcode).EqualTo(vBarcode). Set(TTestInfo.Columns.PatientId).EqualTo(newPatientID). Set(TTestInfo.Columns.Barcode).EqualTo(vBarcode). Where(TTestInfo.Columns.TestId).IsEqualTo(oldTestID). Execute(); //Utility.ShowMsg(string.Format("Tìm thấy bệnh nhân {0}, chưa đăng ký {1}. Đề nghị thực hiện lại.", // obj.PatientName, grdResultModification.GetValue("TestType_Name"))); //return; } else if (oldPatientID > 0) { if ( !Utility.AcceptQuestion( string.Format( "Giữ đăng ký của bệnh nhân cũ và chỉ thực hiện chuyển kết quả sang bệnh nhận {0} có barcode {1} ?", obj.PatientName, dr["Barcode"]), "Thông báo", true)) { //Update PatientID cho T_Test_Info new Update(TTestInfo.Schema.Name). //Set(TTestInfo.Columns.Barcode).EqualTo(vBarcode). Set(TTestInfo.Columns.PatientId).EqualTo(newPatientID). Set(TTestInfo.Columns.Barcode).EqualTo(vBarcode). Where(TTestInfo.Columns.TestId).IsEqualTo(oldTestID). Execute(); } else newTest_ID = Utility.Int32Dbnull(dr["Test_ID"]); } else newTest_ID = Utility.Int32Dbnull(dr["Test_ID"]); } else { //Utility.ShowMsg(string.Format("Tìm thấy bệnh nhân {0}, chưa đăng ký {1}. Đề nghị thực hiện lại.", // obj.PatientName, grdResultModification.GetValue("TestType_Name"))); //return; TTestInfo objTestInfo = new TTestInfo(); objTestInfo.DeviceId = -1; objTestInfo.PatientId = newPatientID; objTestInfo.Barcode = vBarcode; objTestInfo.TestDate = DateTime.Now; objTestInfo.RequireDate = DateTime.Now; objTestInfo.TestTypeId = Utility.Int32Dbnull(grdTestInfoModification.GetValue("TestType_ID")); objTestInfo.TestStatus = 0; objTestInfo.PrintStatus = 0; objTestInfo.IsNew = true; objTestInfo.Save(); newTest_ID = Utility.Int32Dbnull(objTestInfo.TestId); } //Update PatientID,TestID,Barcode cho T_Result_Detail new Update(TResultDetail.Schema.Name).Set(TResultDetail.Columns.PatientId).EqualTo(newPatientID). Set(TResultDetail.Columns.Barcode).EqualTo(vBarcode). Set(TResultDetail.Columns.TestId).EqualTo(newTest_ID). Set(TResultDetail.Columns.TestDate).EqualTo(DateTime.Now.ToString()). Where(TResultDetail.Columns.TestId).IsEqualTo(oldTestID). And(TResultDetail.Columns.PatientId).IsEqualTo(oldPatientID). And(TResultDetail.Columns.Barcode).IsEqualTo(CurrentRowBarcode). Execute(); //Sửa trạng thái Has_Result của những test có kết quả var dtTestHasResult = new Select(TResultDetail.Columns.TestDataId).From(TResultDetail.Schema.Name).Where( TResultDetail.Columns.Barcode).IsEqualTo(vBarcode).And(TResultDetail.Columns.TestId). IsEqualTo(newTest_ID).ExecuteDataSet().Tables[0]; var listTestHasResult = (from d in dtTestHasResult.AsEnumerable() select d["TestData_ID"]).ToList(); new Update(TRegList.Schema.Name).Set(TRegList.Columns.HasResult).EqualTo(1).Where( TRegList.Columns.Barcode).IsEqualTo(vBarcode).And(TResultDetail.Columns.TestDataId).In(listTestHasResult).Execute(); if (oldTestID > 0 & oldPatientID <= 0 & dr != null) new Delete().From(TTestInfo.Schema.Name).Where(TTestInfo.Columns.TestId).IsEqualTo(oldTestID). Execute(); else if ( TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestId, oldTestID).GetRecordCount() <= 0) { if ( Utility.AcceptQuestion( string.Format("Đăng ký {0} của bệnh nhân {1} không còn kết quả. Thực hiện xóa ?", drPatient["TestType_Name"], drPatient["Patient_Name"]), "Thông báo", true)) { new Delete().From(TTestInfo.Schema.Name).Where(TTestInfo.Columns.TestId).IsEqualTo( oldTestID).Execute(); } } if (oldPatientID > 0 & TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.PatientId, oldPatientID).GetRecordCount() <= 0) if ( Utility.AcceptQuestion( string.Format("Bệnh nhận {0} không còn đăng ký. Thực hiện xóa ?", grdTestInfoModification.GetValue("Patient_Name")), "Thông báo", true)) { new Delete().From(LPatientInfo.Schema.Name).Where(LPatientInfo.Columns.PatientId).IsEqualTo( oldPatientID).Execute(); } //Cap nhan thong tin BN tren luoi if (newTest_ID == oldTestID) { Utility.FromObjectToDatarow(obj, ref drPatient); if (obj.YearBirth != null) drPatient["Age"] = DateTime.Now.Year - obj.YearBirth; drPatient["SexName"] = obj.Sex == true ? "Nam" : "Nữ"; dtResultModification.AcceptChanges(); } else { //grdTestInfoModification.CurrentRow.Delete(); //grdTestInfoModification.Refresh(); grdTestInfoModification.UpdateData(); dtResultModification.AcceptChanges(); btnSearchModification.PerformClick(); } bSuccess = true; } catch (Exception ex) { Utility.ShowMsg(ex.Message); } finally { if (!bSuccess) { grdTestInfoModification.CurrentRow.Cells["Barcode"].Value = CurrentRowBarcode; grdTestInfoModification.UpdateData(); dtResultModification.AcceptChanges(); } } } }
private void AutocompleICD10() { DataTable _dtMabenhICD10 = new Select(DmucBenh.Columns.IdBenh, DmucBenh.Columns.MaBenh, DmucBenh.Columns.TenBenh).From( DmucBenh.Schema).ExecuteDataSet().Tables[0]; txtMaBenhICD10.Init(_dtMabenhICD10, new List <string> { DmucBenh.Columns.IdBenh, DmucBenh.Columns.MaBenh, DmucBenh.Columns.TenBenh }); try { if (_dtMabenhICD10 == null) { return; } if (!_dtMabenhICD10.Columns.Contains("ShortCut")) { _dtMabenhICD10.Columns.Add(new DataColumn("ShortCut", typeof(string))); } foreach (DataRow dr in _dtMabenhICD10.Rows) { string shortcut = ""; string realName = dr[DmucBenh.Columns.TenBenh].ToString().Trim() + " " + Utility.Bodau(dr[DmucBenh.Columns.TenBenh].ToString().Trim()); shortcut = dr[DmucBenh.Columns.MaBenh].ToString().Trim(); string[] arrWords = realName.ToLower().Split(' '); string _space = ""; string _Nospace = ""; foreach (string word in arrWords) { if (word.Trim() != "") { _space += word + " "; //_Nospace += word; } } shortcut += _space; // +_Nospace; foreach (string word in arrWords) { if (word.Trim() != "") { shortcut += word.Substring(0, 1); } } dr["ShortCut"] = shortcut; } } catch (Exception ex) { if (globalVariables.IsAdmin) { Utility.ShowMsg("Lỗi:" + ex.Message); } } finally { var source = new List <string>(); EnumerableRowCollection <string> query = from p in _dtMabenhICD10.AsEnumerable() select p[DmucBenh.Columns.IdBenh] + "#" + Utility.sDbnull(p[DmucBenh.Columns.MaBenh], "") + "@" + p.Field <string>(DmucBenh.Columns.TenBenh) + "@" + p.Field <string>("shortcut"); source = query.ToList(); txtMaBenhICD10.AutoCompleteList = source; txtMaBenhICD10.TextAlign = HorizontalAlignment.Center; txtMaBenhICD10.CaseSensitive = false; txtMaBenhICD10.MinTypedCharacters = 1; } }
private void AutocompleteLoaithuoc() { DataTable dtLoaithuoc = null; try { dtLoaithuoc = new Select().From(DmucLoaithuoc.Schema).Where(DmucLoaithuoc.KieuThuocvattuColumn).IsEqualTo("THUOC").ExecuteDataSet().Tables[0]; if (dtLoaithuoc == null) { return; } if (!dtLoaithuoc.Columns.Contains("ShortCut")) { dtLoaithuoc.Columns.Add(new DataColumn("ShortCut", typeof(string))); } foreach (DataRow dr in dtLoaithuoc.Rows) { string shortcut = ""; string realName = dr[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString().Trim() + " " + Utility.Bodau(dr[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString().Trim()); shortcut = dr[DmucLoaithuoc.MaLoaithuocColumn.ColumnName].ToString().Trim(); string[] arrWords = realName.ToLower().Split(' '); string _space = ""; string _Nospace = ""; foreach (string word in arrWords) { if (word.Trim() != "") { _space += word + " "; //_Nospace += word; } } shortcut += _space; // +_Nospace; foreach (string word in arrWords) { if (word.Trim() != "") { shortcut += word.Substring(0, 1); } } dr["ShortCut"] = shortcut; } } catch { } finally { var source = new List <string>(); var query = from p in dtLoaithuoc.AsEnumerable() select p[DmucLoaithuoc.IdLoaithuocColumn.ColumnName].ToString() + "#" + p[DmucLoaithuoc.MaLoaithuocColumn.ColumnName].ToString() + "@" + p[DmucLoaithuoc.TenLoaithuocColumn.ColumnName].ToString() + "@" + p.Field <string>("shortcut").ToString(); source = query.ToList(); this.txtLoaithuoc.AutoCompleteList = source; this.txtLoaithuoc.TextAlign = HorizontalAlignment.Center; this.txtLoaithuoc.CaseSensitive = false; this.txtLoaithuoc.MinTypedCharacters = 1; } }
/// <summary> /// hàm thưucj hiện lấy thông tin của dữ liệu /// </summary> private void Getdata() { // objRoom = NoitruDmucBuong.FetchByID(Utility.Int32Dbnull(txtID.Text, -1)); //if (objRoom != null) //{ // txt_Mo_Ta.Text = Utility.sDbnull(objRoom.MotaThem, ""); // txt_STT_HTHI.Text = Utility.sDbnull(objRoom.SttHthi, 1); // txtTEN.Text = Utility.sDbnull(objRoom.Ten, "")b; //} if (m_enAct == action.Update) { chkcodefrom.Enabled = false; chkAutoupdate.Visible = lblSample.Visible = lblSuffix.Visible = false; if (objBed != null) { txtID.Text = Utility.sDbnull(objBed.IdGiuong); txtMa.Text = objBed.MaGiuong; txtMaBHYT.Text = objBed.MaBhyt; txtTen_BHYT.Text = Utility.sDbnull(objBed.TenBhyt); txt_Mo_Ta.Text = Utility.sDbnull(objBed.MotaThem); txt_STT_HTHI.Text = Utility.sDbnull(objBed.SttHthi); txtTEN.Text = Utility.sDbnull(objBed.TenGiuong); txtSuChua.Text = Utility.sDbnull(objBed.SonguoiToida); txtDongia.Text = Utility.sDbnull(objBed.GiaDichvu); txtGiaBHYT.Text = Utility.sDbnull(objBed.GiaBhyt); txtGiakhac.Text = Utility.sDbnull(objBed.GiaKhac); txtPTDT.Text = Utility.sDbnull(objBed.PhuthuDungtuyen); txtPTTT.Text = Utility.sDbnull(objBed.PhuthuTraituyen); chktutuc.Checked = Utility.Byte2Bool(objBed.TthaiTunguyen); chkTrangThai.Checked = Utility.Int32Dbnull(objBed.TrangThai) == 1; if (Utility.Int32Dbnull(objBed.IdKhoanoitru) > 0) { cboKhoaNoiTru.SelectedIndex = Utility.GetSelectedIndex(cboKhoaNoiTru, objBed.IdKhoanoitru.ToString()); } txtBuong.SetId(Utility.Int32Dbnull(objBed.IdBuong, 0)); txtDonvitinh.SetCode(objBed.MaDonvitinh); } } m_dtQuanHe = SPs.NoitruLaydulieuqheDoituongBuonggiuong(Utility.Int32Dbnull(txtID.Text)).GetDataSet().Tables[0]; Utility.SetDataSourceForDataGridEx(grdQuanheGiuong, m_dtQuanHe, false, true, "1=1", ""); NoitruQheDoituongBuonggiuongCollection roomBedObjectTypeCollection = new Select().From(NoitruQheDoituongBuonggiuong.Schema) .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(Utility.Int32Dbnull(objBed.IdGiuong)).ExecuteAsCollection <NoitruQheDoituongBuonggiuongCollection>(); foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuanheGiuong.GetDataRows()) { var query = from giuong in roomBedObjectTypeCollection.AsEnumerable() where Utility.sDbnull(giuong.MaDoituongKcb) == Utility.sDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb].Value) select giuong; if (query.Any()) { gridExRow.IsChecked = true; } else { gridExRow.IsChecked = false; } } if (roomBedObjectTypeCollection.Count() <= 0) { grdQuanheGiuong.GetCheckedRows(); } chkApDungGia.Checked = roomBedObjectTypeCollection.Count() > 0; // Utility.TryToSetBindData(dtNgayLapPhieu, "Text", objTreatment, }