private static ApplicantFileHeader CreateApplicantFileHeader(IAS.DAL.Interfaces.IIASPersonEntities ctx, DTO.ApplicantUploadRequest request)
        {
            String[] header = request.UploadData.Header.Split(',');

            ApplicantHeaderRequest headRequest = new ApplicantHeaderRequest()
            {
                Context       = ctx,
                FileName      = request.FileName,
                TestingNumber = request.TestingNo,
                ExamPlaceCode = request.ExamPlaceCode,
                UserProfile   = request.UserProfile,
                LineData      = header
            };
            //ApplicantFileHeader headerFile = new ApplicantFileHeader(headRequest)
            //                                        {
            //                                            PROVINCE_CODE = header.GetIndexOf(1),
            //                                            COMP_CODE = header.GetIndexOf(2),
            //                                            LICENSE_TYPE_CODE = header.GetIndexOf(3),
            //                                            TESTING_DATE = PhaseDateHelper.PhaseToDateNull(header.GetIndexOf(4)),
            //                                            EXAM_APPLY = PhaseApplyAmountHelper.Phase(header.GetIndexOf(5)),
            //                                            EXAM_AMOUNT = PhaseCurrencyAmount.Phase(header.GetIndexOf(6)),
            //                                            TEST_TIME_CODE = header.GetIndexOf(7),
            //                                        };

            //IQueryable<AG_EXAM_LICENSE_R> examLicense = ctx.AG_EXAM_LICENSE_R.Where(w => request.TestingNo.Contains(w.TESTING_NO) && request.ExamPlaceCode.Contains(w.EXAM_PLACE_CODE));
            var examLicense = ctx.AG_EXAM_LICENSE_R.Where(w => w.TESTING_NO == request.TestingNo && w.EXAM_PLACE_CODE == request.ExamPlaceCode).FirstOrDefault();
            var exmPlace    = ctx.AG_EXAM_PLACE_R.Where(w => w.EXAM_PLACE_CODE == examLicense.EXAM_PLACE_CODE).FirstOrDefault();
            int examFee     = ctx.AG_PETITION_TYPE_R.FirstOrDefault(s => s.PETITION_TYPE_CODE == "01").FEE.ToInt();
            ApplicantFileHeader headerFile = new ApplicantFileHeader(headRequest)
            {
                PROVINCE_CODE     = exmPlace.PROVINCE_CODE,
                COMP_CODE         = string.IsNullOrEmpty(exmPlace.EXAM_PLACE_GROUP_CODE) ? exmPlace.ASSOCIATION_CODE : exmPlace.EXAM_PLACE_GROUP_CODE,
                LICENSE_TYPE_CODE = header.GetIndexOf(3),
                TESTING_DATE      = examLicense.TESTING_DATE,
                EXAM_APPLY        = PhaseApplyAmountHelper.Phase(header.GetIndexOf(5)),
                EXAM_AMOUNT       = PhaseCurrencyAmount.Phase(header.GetIndexOf(5)) * examFee,
                TEST_TIME_CODE    = examLicense.TEST_TIME_CODE,
            };

            return(headerFile);
        }
Beispiel #2
0
        public ApplicantFileHeader(ApplicantHeaderRequest request)
        {
            flagRoomExam    = true;
            _applyDate      = DateTime.Now;
            _ctx            = request.Context;
            UPLOAD_GROUP_NO = OracleDB.GetGenAutoId();
            SOURCE_TYPE     = GetSourceType(request.UserProfile);
            _testingNumber  = request.TestingNumber;
            _examPlaceCode  = request.ExamPlaceCode;

            _createBy = request.UserProfile;

            PROVINCE_CODE = request.LineData.GetIndexOf(1);
            //EXAM_PLACE_CODE = request.LineData.GetIndexOf(1);
            COMP_CODE         = request.LineData.GetIndexOf(2);
            LICENSE_TYPE_CODE = request.LineData.GetIndexOf(3);
            TESTING_DATE      = PhaseDateHelper.PhaseToDate(request.LineData.GetIndexOf(4));
            EXAM_APPLY        = PhaseApplyAmountHelper.Phase(request.LineData.GetIndexOf(5));
            EXAM_AMOUNT       = PhaseCurrencyAmount.Phase(request.LineData.GetIndexOf(6));
            TEST_TIME_CODE    = request.LineData.GetIndexOf(7);
            FILENAME          = request.FileName;
            this._examLicense = CTX.AG_EXAM_LICENSE_R.SingleOrDefault(w => w.TESTING_NO == _testingNumber && w.EXAM_PLACE_CODE == _examPlaceCode);
            this._examPlace   = _ctx.AG_EXAM_PLACE_R.SingleOrDefault(w => w.EXAM_PLACE_CODE == _examPlaceCode);
            this._examTime    = _ctx.AG_EXAM_TIME_R.SingleOrDefault(w => w.TEST_TIME_CODE == _examLicense.TEST_TIME_CODE);
            this._licenseType = _ctx.AG_IAS_LICENSE_TYPE_R.SingleOrDefault(w => w.LICENSE_TYPE_CODE == LICENSE_TYPE_CODE);

            //if (this.SourceFrom == DTO.RegistrationType.Association)
            //{
            //    //this._examLicense = _ctx.AG_EXAM_LICENSE_R.SingleOrDefault(e => e.EXAM_PLACE_CODE == _examPlaceCode
            //    //                                                            && e.TESTING_DATE == _TestTingDate
            //    //                                                            && e.TEST_TIME_CODE == _TestTimeCode
            //    //                                                            && e.LICENSE_TYPE_CODE == _LicenseTypeCode);
            //}
            //else if (this.SourceFrom == DTO.RegistrationType.Insurance)
            //{
            //    //this._examLicense = _ctx.AG_EXAM_LICENSE_R.SingleOrDefault(e => e.TESTING_NO == _testingNumber && e.EXAM_PLACE_CODE == _examPlaceCode);
            //}
        }