Esempio n. 1
0
        public SuspectConditionUploadLog SaveSuspectConditionUploadLog(SuspectConditionUploadLog domainObject)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = AutoMapper.Mapper.Map <SuspectConditionUploadLog, SuspectConditionUploadLogEntity>(domainObject);
                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException("Could not save Suspect Condition Upload ");
                }

                return(AutoMapper.Mapper.Map <SuspectConditionUploadLogEntity, SuspectConditionUploadLog>(entity));
            }
        }
        public SuspectConditionUploadLog GetUploadLog(DataRow row, long suspectConditionUploadId)
        {
            var captureReferenceDate = CovertToDate(GetRowValue(row, SuspectConditionUploadColumn.CaptureReferenceDate));
            var memberDob            = CovertToDate(GetRowValue(row, SuspectConditionUploadColumn.DOB));

            var suspectDataUploadLog = new SuspectConditionUploadLog
            {
                GMPI                                                              = GetRowValue(row, SuspectConditionUploadColumn.GMPI).Trim(),
                MemberID                                                          = GetRowValue(row, SuspectConditionUploadColumn.MemberID).Trim(),
                SubscriberID                                                      = GetRowValue(row, SuspectConditionUploadColumn.SubscriberID).Trim(),
                MemberName                                                        = GetRowValue(row, SuspectConditionUploadColumn.MemberName).Trim(),
                DOB                                                               = memberDob == null?GetRowValue(row, SuspectConditionUploadColumn.DOB) : memberDob.Value.ToString("MM/dd/yyyy"),
                                                         ICDCode                  = GetRowValue(row, SuspectConditionUploadColumn.ICDCode).Trim(),
                                                         ICDDesc                  = GetRowValue(row, SuspectConditionUploadColumn.ICDDesc).Trim(),
                                                         ICDCodeVersion           = GetRowValue(row, SuspectConditionUploadColumn.ICDCodeVersion).Trim(),
                                                         HCC                      = GetRowValue(row, SuspectConditionUploadColumn.HCC).Trim(),
                                                         HCCDesc                  = GetRowValue(row, SuspectConditionUploadColumn.HCCDesc).Trim(),
                                                         CaptureAction            = GetRowValue(row, SuspectConditionUploadColumn.CaptureAction).Trim(),
                                                         CaptureLocation          = GetRowValue(row, SuspectConditionUploadColumn.CaptureLocation).Trim(),
                                                         CaptureReasonDescription = GetRowValue(row, SuspectConditionUploadColumn.CaptureReasonDescription).Trim(),
                                                         CaptureReferenceDate     = captureReferenceDate == null?GetRowValue(row, SuspectConditionUploadColumn.CaptureReferenceDate) : captureReferenceDate.Value.ToString("MM/dd/yyyy"),
                                                                                        SectionName              = GetRowValue(row, SuspectConditionUploadColumn.SectionName).Trim(),
                                                                                        IsSuccessFull            = false,
                                                                                        SuspectConditionUploadId = suspectConditionUploadId,
                                                                                        ErrorMessage             = null
            };

            if ((!string.IsNullOrEmpty(suspectDataUploadLog.GMPI) || !string.IsNullOrEmpty(suspectDataUploadLog.MemberID)) && //&& !string.IsNullOrEmpty(suspectDataUploadLog.SubscriberID)
                !string.IsNullOrEmpty(suspectDataUploadLog.MemberName) && memberDob != null && !string.IsNullOrEmpty(suspectDataUploadLog.ICDCode) && !string.IsNullOrEmpty(suspectDataUploadLog.ICDCodeVersion) &&
                !string.IsNullOrEmpty(suspectDataUploadLog.HCC) && !string.IsNullOrEmpty(suspectDataUploadLog.CaptureAction) && !string.IsNullOrEmpty(suspectDataUploadLog.CaptureLocation) &&
                captureReferenceDate != null && !string.IsNullOrEmpty(suspectDataUploadLog.SectionName))
            {
                suspectDataUploadLog.IsSuccessFull = true;
            }
            else
            {
                var error = new StringBuilder();
                if (string.IsNullOrEmpty(suspectDataUploadLog.GMPI) && string.IsNullOrEmpty(suspectDataUploadLog.MemberID))
                {
                    error.Append(SuspectConditionUploadColumn.GMPI + " Or " + SuspectConditionUploadColumn.MemberID + ", ");
                }

                //if (string.IsNullOrEmpty(suspectDataUploadLog.SubscriberID))
                //error.Append(SuspectConditionUploadColumn.SubscriberID + ", ");

                if (string.IsNullOrEmpty(suspectDataUploadLog.MemberName))
                {
                    error.Append(SuspectConditionUploadColumn.MemberName + ", ");
                }

                if (memberDob == null)
                {
                    error.Append(SuspectConditionUploadColumn.DOB + ", ");
                }

                if (string.IsNullOrEmpty(suspectDataUploadLog.ICDCode))
                {
                    error.Append(SuspectConditionUploadColumn.ICDCode + ", ");
                }

                //if (string.IsNullOrEmpty(suspectDataUploadLog.ICDDesc))
                //    error.Append(SuspectConditionUploadColumn.ICDDesc + ", ");

                if (string.IsNullOrEmpty(suspectDataUploadLog.ICDCodeVersion))
                {
                    error.Append(SuspectConditionUploadColumn.ICDCodeVersion + ", ");
                }

                if (string.IsNullOrEmpty(suspectDataUploadLog.HCC))
                {
                    error.Append(SuspectConditionUploadColumn.HCC + ", ");
                }

                //if (string.IsNullOrEmpty(suspectDataUploadLog.HCCDesc))
                //    error.Append(SuspectConditionUploadColumn.HCCDesc + ", ");

                if (string.IsNullOrEmpty(suspectDataUploadLog.CaptureAction))
                {
                    error.Append(SuspectConditionUploadColumn.CaptureAction + ", ");
                }

                if (string.IsNullOrEmpty(suspectDataUploadLog.CaptureLocation))
                {
                    error.Append(SuspectConditionUploadColumn.CaptureLocation + ", ");
                }

                //if (string.IsNullOrEmpty(suspectDataUploadLog.CaptureReasonDescription))
                //    error.Append(SuspectConditionUploadColumn.CaptureReasonDescription + ", ");

                if (captureReferenceDate == null)
                {
                    error.Append(SuspectConditionUploadColumn.CaptureReferenceDate + ", ");
                }

                if (string.IsNullOrEmpty(suspectDataUploadLog.SectionName))
                {
                    error.Append(SuspectConditionUploadColumn.SectionName + ", ");
                }
                if (error.Length > 0)
                {
                    error.Length = error.Length - 2;
                    error.Append(" not provided or invalid");
                }
                suspectDataUploadLog.ErrorMessage = error.ToString();
            }
            return(suspectDataUploadLog);
        }