/// <summary> /// Khởi tạo dữ liệu cho ChecedComboBoxEdit /// </summary> /// <param name="ckb">CheckedComboBoxEdit càn khởi tạo</param> /// <param name="checkMode">ChecState: check hay không</param> /// <param name="loai">LoaiDuLieu cần khởi tạo</param> public static void InitCheckedComboBoxEdit(CheckedComboBoxEdit ckb, CheckState checkMode, LoaiDuLieu loai, string ma_truong) { ckb.Properties.NullText = "(Chưa chọn)"; ckb.Properties.SelectAllItemCaption = "[Tất cả]"; ckb.Properties.TextEditStyle = TextEditStyles.Standard; ckb.Properties.Items.Clear(); List <CheckedListBoxItem> _list = new List <CheckedListBoxItem>(); switch (loai) { case LoaiDuLieu.Bac_LoaiHinh: VList <ViewBacDaoTaoLoaiHinh> _vListBacDaoTaoLoaiHinh = DataServices.ViewBacDaoTaoLoaiHinh.GetAll(); _vListBacDaoTaoLoaiHinh.Sort("MaBacLoaiHinh"); foreach (ViewBacDaoTaoLoaiHinh v in _vListBacDaoTaoLoaiHinh) { _list.Add(new CheckedListBoxItem(v.MaBacLoaiHinh, v.TenBacLoaiHinh, checkMode, true)); } break; case LoaiDuLieu.HocHam: TList <HocHam> _tListHocHam; _tListHocHam = DataServices.HocHam.GetAll(); foreach (HocHam hh in _tListHocHam) { _list.Add(new CheckedListBoxItem(hh.MaHocHam, hh.TenHocHam, checkMode, true)); } break; case LoaiDuLieu.KhoaDonVi: VList <ViewKhoa> _vListKhoa; _vListKhoa = DataServices.ViewKhoa.GetAll(); _vListKhoa.Sort("TenKhoa"); foreach (ViewKhoa v in _vListKhoa) { _list.Add(new CheckedListBoxItem(v.MaKhoa, v.TenKhoa, checkMode, true)); } break; case LoaiDuLieu.NgachLuong: TList <NgachCongChuc> _tListNgachCongChuc; _tListNgachCongChuc = DataServices.NgachCongChuc.GetAll(); foreach (NgachCongChuc ngach in _tListNgachCongChuc) { _list.Add(new CheckedListBoxItem(ngach.MaQuanLy, ngach.TenNgach, checkMode, true)); } break; default: return; } ckb.Properties.Items.AddRange(_list.ToArray()); ckb.Properties.SeparatorChar = ';'; }
public List <Note> GetNoteByObject(string app_id, IEnumerable <string> id_obj, LoaiNote loai, LoaiDuLieu loai_du_lieu, string nguoi_tao, out long total_recs, out string msg, int page_size = 50) { msg = ""; total_recs = 0; List <Note> lst = new List <Note>(); try { List <QueryContainer> must = new List <QueryContainer>(); List <QueryContainer> must_not = new List <QueryContainer>(); must_not.Add(new TermQuery() { Field = "trang_thai", Value = TrangThai.DELETED }); must.Add(new TermQuery() { Field = "app_id.keyword", Value = app_id }); must.Add(new TermsQuery() { Field = "id_obj.keyword", Terms = id_obj }); must.Add(new TermQuery() { Field = "loai", Value = loai }); must.Add(new TermQuery() { Field = "loai_du_lieu", Value = loai_du_lieu }); must.Add(new TermQuery() { Field = "nguoi_tao.keyword", Value = nguoi_tao }); List <ISort> sort = new List <ISort>(); sort.Add(new FieldSort() { Field = "ngay_sua", Order = SortOrder.Descending }); sort.Add(new FieldSort() { Field = "ngay_tao", Order = SortOrder.Descending }); SearchRequest req = new SearchRequest(_default_index); req.Query = new QueryContainer(new BoolQuery() { Must = must, MustNot = must_not }); req.From = 0; req.Size = page_size; req.Sort = sort; req.TrackTotalHits = true; var res = client.Search <Note>(req); if (res.IsValid) { total_recs = res.Total; lst = res.Hits.Select(x => ConvertDoc(x)).ToList(); } } catch (Exception ex) { msg = $"{ex.Message}. Trace: {ex.StackTrace}"; } return(lst); }
public static List <Note> GetNoteByObject(string app_id, IEnumerable <string> id_obj, LoaiNote loai, LoaiDuLieu loai_du_lieu, string nguoi_tao, out long total_recs, out string msg, int page_size = 50) { return(NoteRepository.Instance.GetNoteByObject(app_id, id_obj, loai, loai_du_lieu, nguoi_tao, out total_recs, out msg, page_size)); }
public static void Init(RepositoryItemCheckedComboBoxEdit repo, CheckState check, LoaiDuLieu loai) { repo.SelectAllItemCaption = "[Tất cả]"; repo.TextEditStyle = TextEditStyles.Standard; repo.Items.Clear(); List <CheckedListBoxItem> _list = new List <CheckedListBoxItem>(); _list.Add(new CheckedListBoxItem(-1, "[Không xét]")); switch (loai) { case LoaiDuLieu.BacDaoTao: VList <ViewBacDaoTao> _vBacDaoTao = new VList <ViewBacDaoTao>(); _vBacDaoTao = DataServices.ViewBacDaoTao.GetAll(); _vBacDaoTao.Sort("TenBacDaoTao"); foreach (ViewBacDaoTao v in _vBacDaoTao) { _list.Add(new CheckedListBoxItem(v.MaBacDaoTao, v.TenBacDaoTao, check, true)); } break; case LoaiDuLieu.ChucVu: TList <ChucVu> _tChucVu = new TList <ChucVu>(); _tChucVu = DataServices.ChucVu.GetAll(); _tChucVu.Sort("TenChucVu"); foreach (ChucVu t in _tChucVu) { _list.Add(new CheckedListBoxItem(t.MaChucVu, t.TenChucVu, check, true)); } break; case LoaiDuLieu.HocHam: TList <HocHam> _tHocHam = new TList <HocHam>(); _tHocHam = DataServices.HocHam.GetAll(); _tHocHam.Sort("TenHocHam"); foreach (HocHam t in _tHocHam) { _list.Add(new CheckedListBoxItem(t.MaHocHam, t.TenHocHam, check, true)); } break; case LoaiDuLieu.HocVi: TList <HocVi> _tHocVi = new TList <HocVi>(); _tHocVi = DataServices.HocVi.GetAll(); _tHocVi.Sort("TenHocVi"); foreach (HocVi t in _tHocVi) { _list.Add(new CheckedListBoxItem(t.MaHocVi, t.TenHocVi, check, true)); } break; case LoaiDuLieu.HinhThucDangKy: TList <HinhThucDaoTao> _tHinhThucDangKy = new TList <HinhThucDaoTao>(); _tHinhThucDangKy = DataServices.HinhThucDaoTao.GetAll(); _tHinhThucDangKy.Sort("TenHinhThucDaoTao"); foreach (HinhThucDaoTao t in _tHinhThucDangKy) { _list.Add(new CheckedListBoxItem(t.MaHinhThucDaoTao, t.TenHinhThucDaoTao, check, true)); } break; case LoaiDuLieu.LoaiGiangVien: TList <LoaiGiangVien> _tLoaiGiangVien = new TList <LoaiGiangVien>(); _tLoaiGiangVien = DataServices.LoaiGiangVien.GetAll(); _tLoaiGiangVien.Sort("TenLoaiGiangVien"); foreach (LoaiGiangVien t in _tLoaiGiangVien) { _list.Add(new CheckedListBoxItem(t.MaLoaiGiangVien, t.TenLoaiGiangVien, check, true)); } break; case LoaiDuLieu.LoaiNhanVien: TList <LoaiNhanVien> _tLoaiNhanVien = new TList <LoaiNhanVien>(); _tLoaiNhanVien = DataServices.LoaiNhanVien.GetAll(); _tLoaiNhanVien.Sort("TenLoaiNhanVien"); foreach (LoaiNhanVien t in _tLoaiNhanVien) { _list.Add(new CheckedListBoxItem(t.MaLoaiNhanVien, t.TenLoaiNhanVien, check, true)); } break; case LoaiDuLieu.NgachLuong: TList <NgachCongChuc> _tNgachCongChuc = new TList <NgachCongChuc>(); _tNgachCongChuc = DataServices.NgachCongChuc.GetAll(); _tNgachCongChuc.Sort("MaQuanLy"); foreach (NgachCongChuc t in _tNgachCongChuc) { _list.Add(new CheckedListBoxItem(t.MaQuanLy, t.MaQuanLy + " - " + t.TenNgach, check, true)); } break; default: return; } repo.Items.AddRange(_list.ToArray()); repo.SeparatorChar = ';'; //Toàn bộ repo đều có chung kiểu Validate: repo.Validating += new System.ComponentModel.CancelEventHandler(repositoryItemCheckedComboBoxEditLoaiNhanVien_Validating); }