private void btnTim_Click(object sender, EventArgs e) { if (dateNgayTK.EditValue == null) { dateNgayTK.DateTime = DateTime.Now; } if (dateNgayTK.DateTime.Year <= 2008) { XtraMessageBox.Show("Năm thống kê phải lớn hơn 2008", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitFormLoad), true, true, false); DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang tải dữ liệu..."); try { //String ten = checkTen.Checked ? txtTen.Text : null; //String ten = txtTen.Text; LoaiTaiSan loai = checkLoaiTS.Checked ? ucComboBoxLoaiTS1.LoaiTS : null; DonVi DVQL = ucComboBoxDonVi1.DonVi; ViTri vitri = ucComboBoxViTri1.ViTri; Phong phong = ucComboBoxViTri1.Phong; List <Guid> tinhtrangs = CheckedComboBoxEditHelper.getCheckedValueArray(checkedCbxTinhTrang); bool isViTri = true; if (vitri == null) { isViTri = false; } List <CTTaiSan> tmp = CTTaiSanSF.search(null, loai, checkDonVi.Checked, DVQL, false, null, isViTri && checkViTri.Checked, vitri, !isViTri && checkViTri.Checked, phong, checkTinhTrang.Checked ? tinhtrangs : null).ToList(); List <TaiSanHienThi> list = TaiSanHienThi.Convert(tmp, dateNgayTK.DateTime.Year); gridControlHaoMon.DataSource = list; //saveSearchXml(this.Name); //ucGridControlTaiSan1.CollapseAllGroups(); } catch (Exception ex) { Debug.WriteLine(this.Name + "->Search:" + ex.Message); } DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false); } }
public void Search() { DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitFormLoad), true, true, false); DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang tải dữ liệu..."); try { //String ten = checkTen.Checked ? txtTen.Text : null; //String ten = txtTen.Text; List <Guid> tinhtrangs = CheckedComboBoxEditHelper.getCheckedValueArray(checkedCbxTinhTrang); LoaiTaiSan loai = checkLoaiTS.Checked ? ucComboBoxLoaiTS1.LoaiTS : null; DonVi DVQL = ucComboBoxDonVi1.DonVi; ViTri vitri = ucComboBoxViTri1.ViTri; Phong phong = ucComboBoxViTri1.Phong; bool isViTri = true; if (vitri == null) { isViTri = false; } List <TaiSanHienThi> list = TaiSanHienThi.Convert(CTTaiSanSF.search(null, loai, checkDonVi.Checked, DVQL, false, null, isViTri && checkViTri.Checked, vitri, !isViTri && checkViTri.Checked, phong, checkTinhTrang.Checked ? tinhtrangs : null, (cbxEquationDonGia.EditValue != null && checkDonGia.Checked) ? cbxEquationDonGia.EditValue.ToString() : null, (spinDonGia.EditValue != null && checkDonGia.Checked) ? (long?)long.Parse(spinDonGia.EditValue.ToString()) : null, (cbxEquationNgaySD.EditValue != null && checkNgaySuDung.Checked) ? cbxEquationNgaySD.EditValue.ToString() : null, (dateNgaySD.EditValue != null && checkNgaySuDung.Checked) ? (DateTime?)dateNgaySD.DateTime : null)); //ucGridControlTaiSan1.DataSource = list; gridControlTaiSan.DataSource = list; taisans = list; //bool isEnabled = list.Count > 0; //barBtnSuaTaiSan.Enabled = isEnabled; //barBtnXoaTaiSan.Enabled = isEnabled; //btnSua_r.Enabled = isEnabled; //btnXoa_r.Enabled = isEnabled; //saveSearchXml(this.Name); //ucGridControlTaiSan1.CollapseAllGroups(); gridViewTaiSan.CollapseAllGroups(); } catch (Exception ex) { Debug.WriteLine(this.Name + "->Search:" + ex.Message); } DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false); }
public void Search() { DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitFormLoad), true, true, false); DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang tải dữ liệu..."); try { //String ten = checkTen.Checked ? txtTen.Text : null; String ten = txtTen.Text; LoaiTaiSan loai = checkLoai.Checked ? ucComboBoxLoaiTS1.LoaiTS : null; DonVi DVQL = ucComboBoxDonVi1.DonVi; ViTri vitri = ucComboBoxViTri1.ViTri; Phong phong = ucComboBoxViTri1.Phong; bool isViTri = true; if (vitri == null) { isViTri = false; } List <Guid> tinhtrangs = CheckedComboBoxEditHelper.getCheckedValueArray(checkedCbxTinhTrang); List <TaiSanHienThi> list = TaiSanHienThi.Convert(CTTaiSanSF.search(checkTenTS.Checked ? ten : "", checkLoai.Checked ? loai : null, checkDVQL.Checked, DVQL, false, null, isViTri && checkViTri.Checked, vitri, !isViTri && checkViTri.Checked, phong, checkTinhTrang.Checked ? tinhtrangs : null)); ucGridControlTaiSan1.DataSource = list; bool isEnabled = list.Count > 0; barBtnSuaTaiSan.Enabled = isEnabled; barBtnXoaTaiSan.Enabled = isEnabled; btnSua_r.Enabled = isEnabled; btnXoa_r.Enabled = isEnabled; saveSearchXml(this.Name); ucGridControlTaiSan1.CollapseAllGroups(); } catch (Exception ex) { Debug.WriteLine(this.Name + "->Search:" + ex.Message); } DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false); }
public static List <DoSearch> DoSearch(string request) { int limit = 100; Boolean isMobile = MobileDetect.fBrowserIsMobile(); if (isMobile) { limit = 3; } List <DoSearch> Searchs = new List <DoSearch>(); try { //List<CoSoSF> ListCoSoSF = CoSoSF.search(request).Take(limit).ToList(); //foreach (CoSoSF _CoSoSF in ListCoSoSF) //{ // if (_CoSoSF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_CoSoSF.obj.id, _CoSoSF.obj.ten, "TENCOSO")); // else // Searchs.Add(new DoSearch(_CoSoSF.obj.id, _CoSoSF.obj.subId, "MACOSO")); //} //List<DayySF> ListDayySF = DayySF.search(request).Take(limit).ToList(); //foreach (DayySF _DayySF in ListDayySF) //{ // if (_DayySF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_DayySF.obj.id, string.Format("{0} ({1})", _DayySF.obj.ten, _DayySF.obj.coso != null ? _DayySF.obj.coso.ten : "[Cơ sở]"), "TENDAY")); // else // Searchs.Add(new DoSearch(_DayySF.obj.id, string.Format("{0} ({1})", _DayySF.obj.subId, _DayySF.obj.coso != null ? _DayySF.obj.coso.ten : "[Cơ sở]"), "MADAY")); //} //List<TangSF> ListTangSF = TangSF.search(request).Take(limit).ToList(); //foreach (TangSF _TangSF in ListTangSF) //{ // if (_TangSF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_TangSF.obj.id, string.Format("{0} ({1} - {2})", _TangSF.obj.ten, _TangSF.obj.day != null ? _TangSF.obj.day.coso != null ? _TangSF.obj.day.coso.ten : "[Cơ sở]" : "[Cơ sở]", _TangSF.obj.day != null ? _TangSF.obj.day.ten : "[Dãy]"), "TENTANG")); // else // Searchs.Add(new DoSearch(_TangSF.obj.id, string.Format("{0} ({1} - {2})", _TangSF.obj.subId, _TangSF.obj.day != null ? _TangSF.obj.day.coso != null ? _TangSF.obj.day.coso.ten : "[Cơ sở]" : "[Cơ sở]", _TangSF.obj.day != null ? _TangSF.obj.day.ten : "[Dãy]"), "MATANG")); //} //List<PhongSF> ListPhongSF = PhongSF.search(request).Take(limit).ToList(); //foreach (PhongSF _PhongSF in ListPhongSF) //{ // string strViTri = Libraries.StringHelper.StringViTriPhong(_PhongSF.obj); // if (_PhongSF.match_field.FirstOrDefault().Equals("ten")) // { // Searchs.Add(new DoSearch(_PhongSF.obj.id, string.Format("{0}{1}", _PhongSF.obj.ten, !Object.Equals(strViTri, "") ? " " + strViTri : ""), "TENPHONG")); // } // else // Searchs.Add(new DoSearch(_PhongSF.obj.id, string.Format("{0}{1}", _PhongSF.obj.subId, !Object.Equals(strViTri, "") ? " " + strViTri : ""), "MAPHONG")); //} listDonVi = Permission.getAll <TSCD.Entities.DonVi>(Permission._VIEW).OrderBy(c => c.ten).ToList(); List <CTTaiSanSF> ListCTTaiSanSF = CTTaiSanSF.searchByDonvi(request, listDonVi).Take(limit).ToList(); foreach (CTTaiSanSF _CTTaiSanSF in ListCTTaiSanSF) { if (_CTTaiSanSF.match_field.FirstOrDefault().Equals("taisan.ten")) { Searchs.Add(new DoSearch(_CTTaiSanSF.obj.id, _CTTaiSanSF.obj.taisan.ten, "TENTAISAN")); } } //listDonVi = Permission.getAll<TSCD.Entities.DonVi>(Permission._VIEW).OrderBy(c => c.ten).ToList(); //if (listDonVi != null && listDonVi.Count > 0) //{ // foreach (TSCD.Entities.DonVi _DonVi in listDonVi) // { // List<TaiSanHienThi> listCTTaiSan = TaiSanHienThi.ConvertUsingSearch(_DonVi.getAllCTTaiSanRecursive(), request); // foreach (var TaiSanCustom in listCTTaiSan) // { // Searchs.Add(new DoSearch(TaiSanCustom.id, TaiSanCustom.ten, "TENTAISAN")); // } // } //} //List<ThietBiSF> ListThietBiSF = ThietBiSF.search(request).Take(limit).ToList(); //foreach (ThietBiSF _ThietBiSF in ListThietBiSF) //{ // if (_ThietBiSF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_ThietBiSF.obj.id, _ThietBiSF.obj.ten, "TENTHIETBI")); // else // Searchs.Add(new DoSearch(_ThietBiSF.obj.id, _ThietBiSF.obj.subId, "MATHIETBI")); //} //List<LoaiThietBiSF> ListLoaiThietBiSF = LoaiThietBiSF.search(request).Take(limit).ToList(); //foreach (LoaiThietBiSF _LoaiThietBiSF in ListLoaiThietBiSF) //{ // if (_LoaiThietBiSF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_LoaiThietBiSF.obj.id, _LoaiThietBiSF.obj.ten, "TENLOAITHIETBI")); // else // Searchs.Add(new DoSearch(_LoaiThietBiSF.obj.id, _LoaiThietBiSF.obj.subId, "MALOAITHIETBI")); //} //List<NhanVienPTSF> ListNhanVienPTSF = NhanVienPTSF.search(request).Take(limit).ToList(); //foreach (NhanVienPTSF _NhanVienPTSF in ListNhanVienPTSF) //{ // if (_NhanVienPTSF.match_field.FirstOrDefault().Equals("hoten")) // Searchs.Add(new DoSearch(_NhanVienPTSF.obj.id, _NhanVienPTSF.obj.hoten, "TENNHANVIENPT")); // else if (_NhanVienPTSF.match_field.FirstOrDefault().Equals("sodienthoai")) // Searchs.Add(new DoSearch(_NhanVienPTSF.obj.id, _NhanVienPTSF.obj.sodienthoai, "SDTNHANVIENPT")); // else // Searchs.Add(new DoSearch(_NhanVienPTSF.obj.id, _NhanVienPTSF.obj.subId, "MANHANVIENPT")); //} //List<SuCoPhongSF> ListSuCoPhongSF = SuCoPhongSF.search(request).Take(limit).ToList(); //foreach (SuCoPhongSF _SuCoPhongSF in ListSuCoPhongSF) //{ // if (_SuCoPhongSF.match_field.FirstOrDefault().Equals("ten")) // Searchs.Add(new DoSearch(_SuCoPhongSF.obj.id, _SuCoPhongSF.obj.ten, "TENSUCO")); // else // Searchs.Add(new DoSearch(_SuCoPhongSF.obj.id, _SuCoPhongSF.obj.mota, "MOTASUCO")); //} } catch { } return(Searchs); }