public static DTO.ResponseService <ApplicantFileHeader> ConcreateApplicantFileRequest(IAS.DAL.Interfaces.IIASPersonEntities ctx, DTO.ApplicantUploadRequest request) { DTO.ResponseService <ApplicantFileHeader> response = new DTO.ResponseService <ApplicantFileHeader>(); ApplicantFileHeader header = CreateApplicantFileHeader(ctx, request); Int32 row = 0; foreach (String record in request.UploadData.Body) { row++; ApplicantFileDetail detail = CreateApplicantFileDetail(ctx, record, row); header.AddDetail(detail); } response.DataResponse = header; return(response); }
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); }
public void SetHeader(ApplicantFileHeader header) { this.UPLOAD_GROUP_NO = header.UPLOAD_GROUP_NO; _applicantFileHeader = header; }