Beispiel #1
0
        public IActionResult GetNoteUngVienByIdJob(string id_job)
        {
            List <Models.NoteUngVienJobMap> lst = new List <Models.NoteUngVienJobMap>();

            //Check Owner theo ID_JOB truoc roi chay doan code duoi
            if (JobBL.IsOwner(id_job, user) || (is_app_admin || is_sys_admin))
            {
                var data_note_ung_vien = BL.NoteUngVienJobBL.GetNoteUngVienJobByIdJobOwner(app_id, id_job);
                var lst_id_job         = data_note_ung_vien.Select(x => x.id_job);
                var data_job           = QLCUNL.BL.JobBL.GetMany(app_id, lst_id_job, new string[] { "chuc_danh", "cong_ty", "nguoi_lien_he" }).ToDictionary(x => x.id_job, y => y);
                var lst_id_ung_vien    = data_note_ung_vien.Select(x => x.id_ung_vien);
                var data_ung_vien      = QLCUNL.BL.UngVienBL.GetMany(lst_id_ung_vien).ToDictionary(x => x.id_ung_vien, y => y);
                foreach (var item in data_note_ung_vien)
                {
                    var lst_id_thuoc_tinh    = item.thuoc_tinh != null ? item.thuoc_tinh : new List <int>();
                    var lst_thuoc_tinh_rieng = QLCUNL.BL.ThuocTinhDuLieuBL.GetIdThuocTinhByIdObj(app_id, item.id_note_ung_vien_job, user);

                    var data_thuoc_tinh = QLCUNL.BL.ThuocTinhBL.GetManyByGiaTri(app_id, lst_id_thuoc_tinh, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, ThuocTinhType.SHARED);
                    if (lst_thuoc_tinh_rieng.Count() > 0)
                    {
                        var thuoc_tinh_rieng = QLCUNL.BL.ThuocTinhBL.GetPrivateByLoaiGiaTri(app_id, user, lst_thuoc_tinh_rieng, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, (is_sys_admin || is_app_admin));
                        data_thuoc_tinh.AddRange(thuoc_tinh_rieng);
                    }
                    Models.NoteUngVienJobMap note = new Models.NoteUngVienJobMap(item, data_job, data_ung_vien, data_thuoc_tinh);

                    lst.Add(note);
                }
            }
            return(Ok(new DataResponsePaging()
            {
                data = lst, success = true, msg = "", total = lst.Count
            }));
        }
Beispiel #2
0
        public IActionResult Get(string id)
        {
            var note_ung_vien_job = QLCUNL.BL.NoteUngVienJobBL.GetById(id);

            if (!IsInAppId(note_ung_vien_job))
            {
                return(BadRequest());
            }
            if (note_ung_vien_job != null)
            {
                var lst_id_job = new List <string>()
                {
                    note_ung_vien_job.id_job
                };
                var lst_id_ung_vien = new List <string>()
                {
                    note_ung_vien_job.id_ung_vien
                };
                var data_job      = JobBL.GetMany(app_id, lst_id_job, new string[] { "chuc_danh", "cong_ty", "nguoi_lien_he" }).ToDictionary(x => x.id_job, y => y);
                var data_ung_vien = UngVienBL.GetMany(lst_id_ung_vien).ToDictionary(x => x.id_ung_vien, y => y);

                var lst_id_thuoc_tinh    = note_ung_vien_job.thuoc_tinh != null ? note_ung_vien_job.thuoc_tinh : new List <int>();
                var lst_thuoc_tinh_rieng = ThuocTinhDuLieuBL.GetIdThuocTinhByIdObj(app_id, note_ung_vien_job.id_note_ung_vien_job, user);

                var data_thuoc_tinh = ThuocTinhBL.GetManyByGiaTri(app_id, lst_id_thuoc_tinh, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, ThuocTinhType.SHARED);
                if (lst_thuoc_tinh_rieng.Count() > 0)
                {
                    var thuoc_tinh_rieng = ThuocTinhBL.GetPrivateByLoaiGiaTri(app_id, user, lst_thuoc_tinh_rieng, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, (is_sys_admin || is_app_admin));
                    data_thuoc_tinh.AddRange(thuoc_tinh_rieng);
                }

                Models.NoteUngVienJobMap note = new Models.NoteUngVienJobMap(note_ung_vien_job, data_job, data_ung_vien, data_thuoc_tinh, false);

                return(Ok(new DataResponse()
                {
                    data = note, success = note_ung_vien_job != null, msg = ""
                }));
            }

            return(Ok(new DataResponse()
            {
                data = new { }, success = false, msg = ""
            }));
        }
Beispiel #3
0
        public IActionResult GetNoteUngVienJobByIdUngVien(string id_ung_vien, string id_job)
        {
            long   total_recs = 0;
            string msg        = "";

            var data_note_ung_vien = QLCUNL.BL.NoteUngVienJobBL.GetNoteUngVienJobByIdUngVien(app_id, id_ung_vien.Split(","), id_job, 1, out total_recs, out msg, 9999, (is_sys_admin || is_app_admin));
            var lst_id_job         = data_note_ung_vien.Select(x => x.id_job);
            var data_job           = QLCUNL.BL.JobBL.GetMany(app_id, lst_id_job, new string[] { "chuc_danh", "cong_ty", "nguoi_lien_he" }).ToDictionary(x => x.id_job, y => y);
            var lst_id_ung_vien    = data_note_ung_vien.Select(x => x.id_ung_vien);

            var lst_id_cong_ty = data_job.Where(x => x.Value.cong_ty != null && !string.IsNullOrEmpty(x.Value.cong_ty.id_cong_ty)).Select(x => x.Value.cong_ty.id_cong_ty);
            var lst_cong_ty    = QLCUNL.BL.CongTyBL.GetMany(lst_id_cong_ty);
            Dictionary <string, string> dic_cong_ty = new Dictionary <string, string>();

            if (lst_cong_ty != null)
            {
                dic_cong_ty = lst_cong_ty.ToDictionary(x => x.id_cong_ty, y => y.ten_cong_ty);
            }
            var data_ung_vien = QLCUNL.BL.UngVienBL.GetMany(lst_id_ung_vien).ToDictionary(x => x.id_ung_vien, y => y);
            List <Models.NoteUngVienJobMap> lst = new List <Models.NoteUngVienJobMap>();

            foreach (var item in data_note_ung_vien)
            {
                var lst_id_thuoc_tinh    = item.thuoc_tinh != null ? item.thuoc_tinh : new List <int>();
                var lst_thuoc_tinh_rieng = QLCUNL.BL.ThuocTinhDuLieuBL.GetIdThuocTinhByIdObj(app_id, item.id_note_ung_vien_job, user);

                var data_thuoc_tinh = QLCUNL.BL.ThuocTinhBL.GetManyByGiaTri(app_id, lst_id_thuoc_tinh, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, ThuocTinhType.SHARED);
                if (lst_thuoc_tinh_rieng.Count() > 0)
                {
                    var thuoc_tinh_rieng = QLCUNL.BL.ThuocTinhBL.GetPrivateByLoaiGiaTri(app_id, user, lst_thuoc_tinh_rieng, LoaiThuocTinh.NOTE_UNG_VIEN_JOB, (is_sys_admin || is_app_admin));
                    data_thuoc_tinh.AddRange(thuoc_tinh_rieng);
                }
                Models.NoteUngVienJobMap note = new Models.NoteUngVienJobMap(item, data_job, dic_cong_ty, data_ung_vien, data_thuoc_tinh);
                lst.Add(note);
            }
            return(Ok(new DataResponsePaging()
            {
                data = lst, total = total_recs, success = data_note_ung_vien != null, msg = msg
            }));
        }