public Eva_PerformanceModel GetById(Guid id)
        {
            string status = string.Empty;
            var performanceService = new Eva_PerformanceServices();
                       
            var model = new Eva_PerformanceModel();
            var service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Eva_PerformanceEntity>(id, ConstantSql.hrm_eva_sp_get_PerformanceById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<Eva_PerformanceModel>();
                // model.AttachFileLast = model.AttachFile;

                #region Đọc Xml từ db và chuyển sang string

                if (model != null)
                {
                    var doc = performanceService.ReadXml(model.AttachFile, AttachFileEntity.FieldNames.FullName);
                    model.AttachFileLast = string.Join(",", doc.ToArray());
                    model.AttachFile = model.AttachFileLast;
                    model.AttachFiles = doc;
                }
                #endregion
            }

            model.ActionStatus = status;
            return model;
        }
Beispiel #2
0
        /// <summary> Lấy file đính kèm theo cấp bậc đánh giá </summary>
        /// <param name="PerformanceID"></param>
        /// <returns></returns>
        public string GetAttachFileByOrderNo(Guid PerformanceID, int orderNo)
        {
            string attachFile = "";
            //lay thu tu đánh giá của người trước
            orderNo = orderNo - 1;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoP = new Eva_PerformanceRepository(unitOfWork);
                var repoPE = new Eva_PerformanceEvaRepository(unitOfWork);
                Eva_Performance performance = repoP.GetById(PerformanceID);
                if (performance != null && !string.IsNullOrEmpty(performance.AttachFile) && performance.IsDelete == null)
                {
                    attachFile = performance.AttachFile;
                }
                var ilEva_PerformanceEva = repoPE.FindBy(x => x.PerformanceID == PerformanceID
                    && x.IsDelete == null && x.OrderEva == orderNo).Select(p => p.AttachFile).FirstOrDefault();
                if (ilEva_PerformanceEva != null)
                {
                    attachFile = ilEva_PerformanceEva;
                }
            }

            #region Đọc Xml từ db và chuyển sang string

            if (!string.IsNullOrEmpty(attachFile))
            {
                var performanceService = new Eva_PerformanceServices();
                var doc = performanceService.ReadXml(attachFile, AttachFileEntity.FieldNames.FullName);
                attachFile = string.Join(",", doc.ToArray());
            }
            #endregion

            return attachFile;
        }