Example #1
0
        public IActionResult GetNoteByObject(string id_obj)
        {
            long          total_recs = 0;
            string        msg        = "";
            List <string> lst_id     = new List <string>();

            lst_id.Add(id_obj);
            var note_ung_vien = NoteBL.GetNoteByObject(app_id, lst_id, LoaiNote.UNG_VIEN, LoaiDuLieu.NGUOI_DUNG, user, out total_recs, out msg);

            return(Ok(new DataResponse()
            {
                data = note_ung_vien, success = true, msg = ""
            }));
        }
Example #2
0
        public IActionResult Get(string id)
        {
            var job = QLCUNL.BL.JobBL.GetById(id);

            if (!IsInAppId(job))
            {
                return(BadRequest());
            }
            var thuoc_tinh_job = QLCUNL.BL.ThuocTinhBL.GeSharedtByLoaiGiaTri(app_id, job.thuoc_tinh, LoaiThuocTinh.JOB);

            var lst_thuoc_tinh_rieng = QLCUNL.BL.ThuocTinhDuLieuBL.GetIdThuocTinhByIdObj(app_id, job.id_job, user);

            if (lst_thuoc_tinh_rieng.Count() > 0)
            {
                var thuoc_tinh_rieng_job = QLCUNL.BL.ThuocTinhBL.GetPrivateByLoaiGiaTri(app_id, user, lst_thuoc_tinh_rieng, LoaiThuocTinh.JOB, (is_sys_admin || is_app_admin));
                thuoc_tinh_job.AddRange(thuoc_tinh_rieng_job);
            }
            //
            long          total_recs = 0;
            string        msg        = "";
            List <string> lst        = new List <string>();

            lst.Add(id);
            var all_note = NoteBL.GetNoteByObject(app_id, lst, LoaiNote.JOB, LoaiDuLieu.NGUOI_DUNG, user, out total_recs, out msg);

            if (all_note != null)
            {
                foreach (var note in all_note.OrderByDescending(x => x.ngay_tao).Take(1))
                {
                    job.ghi_chu = note.noi_dung;
                }
            }
            JobThuocTinhMap jm = new JobThuocTinhMap(job, thuoc_tinh_job, id);

            if (job.cong_ty != null)
            {
                var cong_ty = QLCUNL.BL.CongTyBL.GetMany(new List <string>()
                {
                    job.cong_ty.id_cong_ty
                });
                if (cong_ty != null && cong_ty.Count > 0)
                {
                    jm.cong_ty = cong_ty.First();
                }
            }
            jm.is_owner = user == jm.owner;
            return(Ok(new { data = jm, success = job != null, msg = "", all_note = all_note }));
        }