예제 #1
0
        public async Task <ScoreRecordDetailDto> GetScoreRecordDetail(string recordId)
        {
            var auditRateMModel         = _auditRateMRepository.FindSingle(x => x.Record_ID.Trim() == recordId);
            ScoreRecordDetailDto result = new ScoreRecordDetailDto();

            if (auditRateMModel != null)
            {
                var listAuditRateDModel = _auditRateDRepository.FindAll(x => x.Record_ID == auditRateMModel.Record_ID);
                var listAuditRateD      = await listAuditRateDModel.Select(x => new AuditRateDDetailDto
                {
                    AuditItemId    = x.Audit_Item_ID,
                    Rating0        = x.Rating_0,
                    Rating1        = x.Rating_1,
                    Rating2        = x.Rating_2,
                    RatingNA       = x.Rate_NA,
                    Remark         = x.Remark,
                    UplloadPicture = x.Upload_Picture,
                    AuditItemLL    = _auditTypeDRepository.GetAuditItemLL(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    AuditItemEN    = _auditTypeDRepository.GetAuditItemEN(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    AuditItemZW    = _auditTypeDRepository.GetAuditItemZW(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                }).ToListAsync();

                result.auditRateM     = _mapper.Map <AuditRateMDto>(auditRateMModel);
                result.listAuditRateD = listAuditRateD;
            }
            return(result);
        }
예제 #2
0
        public async Task <ScoreRecordDetailDto> GetScoreRecordDetail(string recordId)
        {
            var auditRateMModel         = _auditRateMRepository.FindSingle(x => x.Record_ID.Trim() == recordId);
            ScoreRecordDetailDto result = new ScoreRecordDetailDto();

            if (auditRateMModel != null)
            {
                var listAuditRateDModel = _auditRateDRepository.FindAll(x => x.Record_ID == auditRateMModel.Record_ID);
                var listAuditTypeD      = _auditTypeDRepository.FindAll(x => x.Audit_Type_ID == auditRateMModel.Audit_Type_ID);
                var listAuditRateD      = await(from a in listAuditRateDModel
                                                join b in listAuditTypeD
                                                on a.Audit_Item_ID equals b.Audit_Item_ID
                                                select new AuditRateDDetailDto
                {
                    RecordId       = a.Record_ID,
                    AuditItemId    = a.Audit_Item_ID,
                    Rating0        = a.Rating_0,
                    Rating1        = a.Rating_1,
                    Rating2        = a.Rating_2,
                    RatingNA       = a.Rate_NA,
                    Remark         = a.Remark,
                    UplloadPicture = a.Upload_Picture,
                    AuditItemLL    = _auditTypeDRepository.GetAuditItemLL(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    AuditItemEN    = _auditTypeDRepository.GetAuditItemEN(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    AuditItemZW    = _auditTypeDRepository.GetAuditItemZW(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    TypeDrating0   = _auditTypeDRepository.GetTypeDrating0(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    TypeDrating1   = _auditTypeDRepository.GetTypeDrating1(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    TypeDrating2   = _auditTypeDRepository.GetTypeDrating2(auditRateMModel.Audit_Type_ID, a.Audit_Item_ID),
                    oderby         = 0,
                    RatingDetail   = a.Rating_0 == 1?b.Rating_0.ToString():a.Rating_1 == 1?b.Rating_1.ToString():"NA",
                    //  RatingDetail =b.Rating_1
                }).ToListAsync();
                listAuditRateD = listAuditRateD.Select(x => {
                    x.oderby = (x.AuditItemId.Split(".")).Count() == 1?0:x.AuditItemId.Split(".")[1].ToInt();
                    return(x);
                }).ToList();
                listAuditRateD = listAuditRateD.OrderBy(x => x.AuditItemId.Split(".")[0].ToInt())
                                 .ThenBy(x => x.oderby).ToList();

                var dataRateMmodel = _mapper.Map <AuditRateMDto>(auditRateMModel);

                var dataUser = _mesUserRepository.FindAll().Where(x => x.User_ID.Trim() == dataRateMmodel.Updated_By.Trim()).Select(x => new {
                    user = x.User_ID + "_" + x.User_Name
                }).FirstOrDefault();
                dataRateMmodel.Line_ID_2_Name = _mesAuditOrgRepository.FindAll().Where(x => x.Line_ID_2.Trim() == dataRateMmodel.Line.Trim()).FirstOrDefault().Line_ID_2_Name;
                dataRateMmodel.PDC_Name       = _mesAuditOrgRepository.FindAll().Where(x => x.PDC_ID.Trim() == dataRateMmodel.PDC.Trim()).FirstOrDefault().PDC_Name;
                dataRateMmodel.Updated_By     = dataUser == null?dataRateMmodel.Updated_By:dataUser.user;
                result.auditRateM             = dataRateMmodel;
                result.listAuditRateD         = listAuditRateD;
            }
            return(result);
        }
예제 #3
0
        public async Task <ScoreRecordDetailDto> GetScoreRecoreDetail(string recordId)
        {
            var auditRateMModel         = _repoRateM.FindSingle(x => x.Record_ID.Trim() == recordId);
            ScoreRecordDetailDto result = new ScoreRecordDetailDto();

            if (auditRateMModel != null)
            {
                var listAuditRateDModel = _repoRateD.FindAll(x => x.Record_ID == auditRateMModel.Record_ID);
                var listAuditRateD      = await listAuditRateDModel.Select(x => new AuditRateDDetailDto
                {
                    RecordId      = x.Record_ID,
                    AuditItemId   = x.Audit_Item_ID,
                    Rating0       = x.Rating_0,
                    Rating1       = x.Rating_1,
                    Rating2       = x.Rating_2,
                    RatingNA      = x.Rate_NA,
                    Remark        = x.Remark,
                    UploadPicture = x.Upload_Picture,
                    AuditItemLL   = _repoTypeD.GetAuditItemLL(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    AuditItemEN   = _repoTypeD.GetAuditItemEN(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    AuditItemZW   = _repoTypeD.GetAuditItemZW(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    TypeDrating0  = _repoTypeD.GetTypeDrating0(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    TypeDrating1  = _repoTypeD.GetTypeDrating1(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    TypeDrating2  = _repoTypeD.GetTypeDrating2(auditRateMModel.Audit_Type_ID, x.Audit_Item_ID),
                    oderby        = 0
                }).ToListAsync();

                listAuditRateD = listAuditRateD.Select(x =>
                {
                    x.oderby = (x.AuditItemId.Split(".")).Count() == 1 ? 0 : x.AuditItemId.Split(".")[1].ToInt();
                    return(x);
                }).ToList();
                listAuditRateD = listAuditRateD.OrderBy(x => x.AuditItemId.Split(".")[0].ToInt()).ThenBy(x => x.oderby).ToList();

                var dataRateMmodel = _mapper.Map <AuditRateMDto>(auditRateMModel);

                var dataUser = _repoMesUser.FindAll(x => x.User_ID.Trim() == dataRateMmodel.Updated_By.Trim()).Select(x => new
                {
                    user = x.User_ID + "_" + x.User_Name
                }).FirstOrDefault();
                dataRateMmodel.Line_ID_2_Name = _repoMesAuditOrg.FindAll(x => x.Line_ID_2.Trim() == dataRateMmodel.Line.Trim()).FirstOrDefault().Line_ID_2_Name;
                dataRateMmodel.Updated_By     = dataUser == null ? dataRateMmodel.Updated_By : dataUser.user;
                result.auditRateM             = dataRateMmodel;
                result.listAuditRateD         = listAuditRateD;
            }
            return(result);
        }