示例#1
0
        public IActionResult UngVien(string id, string token, string id_ung_vien)
        {
            List <string> lst_id = new List <string>();

            if (!string.IsNullOrEmpty(id_ung_vien))
            {
                lst_id = id_ung_vien.Split(',').ToList();
            }
            List <UngVien>             data    = new List <UngVien>();
            List <UngVienNhaTuyenDung> list_uv = new List <UngVienNhaTuyenDung>();

            string msg    = "";
            int    stt    = 1;
            var    lst_pq = PhanQuyenBL.GetQuyenActive($"{id}|{token}", 0, PhanQuyenObjType.UNG_VIEN, new List <int>()
            {
                (int)Quyen.VIEW
            }, new string[] { "obj_id" });
            var lst_id_ung_vien_shared = lst_pq.Select(x => x.obj_id).ToList();

            lst_id_ung_vien_shared.AddRange(lst_id);

            data = UngVienBL.GetMany(lst_id_ung_vien_shared);

            list_uv = data.Select(x => new UngVienNhaTuyenDung(x)
            {
                stt = stt++
            }).ToList();
            return(Ok(new DataResponse()
            {
                data = list_uv, success = data != null, msg = msg
            }));
        }
示例#2
0
        public IActionResult UngVienJob(string id, string token, string id_ung_vien)
        {
            List <string> lst_id = new List <string>();

            if (!string.IsNullOrEmpty(id_ung_vien))
            {
                lst_id = id_ung_vien.Split(',').ToList();
            }
            List <NoteUngVienJob>             data   = new List <NoteUngVienJob>();
            List <NoteUngVienJobNhaTuyenDung> lst_uv = new List <NoteUngVienJobNhaTuyenDung>();
            long   total_recs = 0;
            string msg        = "";
            var    lst_pq     = PhanQuyenBL.GetQuyenActive($"{id}|{token}", -1, PhanQuyenObjType.NOTE_UNG_VIEN_JOB, new List <int>()
            {
                (int)Quyen.VIEW
            }, new string[] { "obj_id", "obj_type" });
            var lst_id_note_ung_vien_job_shared = lst_pq.Select(x => x.obj_id).ToList();

            lst_id_note_ung_vien_job_shared.AddRange(lst_id);
            data = NoteUngVienJobBL.GetMany(lst_id_note_ung_vien_job_shared);

            // lấy note ứng viên
            var nha_tuyen_dung   = NhaTuyenDungBL.GetByToken(token);
            var lst_note_uv_job  = data.Select(x => x.id_note_ung_vien_job);
            var all_note_cua_ntd = NoteBL.NhaTuyenDungNoteUngVien(lst_note_uv_job, nha_tuyen_dung.id_nha_tuyen_dung, out total_recs, out msg, 9999);
            var lst_id_ung_vien  = data.Select(x => x.id_ung_vien).ToList();

            var data_ung_vien = UngVienBL.GetMany(lst_id_ung_vien).ToDictionary(x => x.id_ung_vien, y => y);
            int stt           = 1;

            foreach (var item in data)
            {
                data_ung_vien.TryGetValue(item.id_ung_vien, out UngVien ung_vien);
                if (ung_vien != null)
                {
                    foreach (var temp in all_note_cua_ntd.Where(x => x.id_obj == item.id_note_ung_vien_job).OrderByDescending(o => o.ngay_tao).Take(1))
                    {
                        item.ghi_chu_nha_tuyen_dung = temp.noi_dung;
                    }
                    lst_uv.Add(new NoteUngVienJobNhaTuyenDung(item, ung_vien)
                    {
                        stt = stt++
                    });
                }
            }
            return(Ok(new DataResponse()
            {
                data = lst_uv, success = data != null, msg = msg
            }));
        }