/// <summary>
        /// Refresh the Employer group from Excel file
        /// </summary>
        /// <returns></returns>
        public ExceptionTypes StartEGHPExcelProcess()
        {
            ExceptionTypes result       = ExceptionTypes.Success;
            DataTable      dataTable    = new DataTable();
            string         fileName     = CacheUtility.GetConfigrationValueByConfigName(ConstantTexts.EGHPExclusionFileName);
            string         errorMessage = string.Empty;

            try
            {
                ReadAsDataTable(fileName, out dataTable, out errorMessage);
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    result = _BLCommon.EGHPExcelProcess(dataTable, out errorMessage);
                }
                else
                {
                    BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, "Error in EGHP File", errorMessage);
                }
                if (result != ExceptionTypes.Success)
                {
                    BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage);
                }
            }
            catch (Exception ex)
            {
                BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, "Exception EGHP Exclusion Excel", ex.StackTrace.ToString());
            }

            return(result);
        }
Exemple #2
0
 internal void CreateSCCFDRSubmission()
 {
     //set properties values for FDR Submission SCC
     _strSubmissionCategory = "FDR Submission SCC";
     _lSubmissionCategory   = (long)FDRSubmissionCategory.SCC;
     //Getting details from app.config
     //string[] arrConfig = AppConfigData.ReSubmission.Split('|');
     string[] arrConfig = CacheUtility.GetConfigrationValueByConfigName(ConstantTexts.SCC).Split('|');
     StartFDRSubmission(arrConfig, ConstantTexts.SCCFDRStartRowsForSheet, (long)BackgroundProcessType.FDRSubmissionSCC);
 }
Exemple #3
0
 public void CreateCategory3Submission()
 {
     //set properties values for Category 3 submission
     _strSubmissionCategory = "FDR Submission Category 3";
     _lSubmissionCategory   = (long)FDRSubmissionCategory.Category3;
     //Getting details from app.config
     //string[] arrConfig = AppConfigData.Category3.Split('|');
     string[] arrConfig = CacheUtility.GetConfigrationValueByConfigName(ConstantTexts.Category3).Split('|');
     StartFDRSubmission(arrConfig, ConstantTexts.FDRStartRowsForSheet, (long)BackgroundProcessType.FDRSubmissionCat3);
 }
Exemple #4
0
        private bool CreateAndProcessCMSTransaction(DOGEN_Queue item, out string errorMessage)
        {
            errorMessage = string.Empty;
            bool           isSuccess = false;
            ExceptionTypes result    = new ExceptionTypes();
            DOGEN_GPSServiceRequestParameter objDOGEN_GPSServiceRequestParameter = new DOGEN_GPSServiceRequestParameter();

            try
            {
                objDOGEN_GPSServiceRequestParameter.LoggedInUserId = _lCurrentMasterUserId;
                objDOGEN_GPSServiceRequestParameter.CaseNumber     = item.GEN_QueueId.ToString();

                var contractNumber = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Contract).Where(x => x.CMN_LookupMasterId == (item.objDOGEN_OSTActions != null && item.objDOGEN_OSTActions.ContractIDLkup != null && item.objDOGEN_OSTActions.ContractIDLkup != 0? item.objDOGEN_OSTActions.ContractIDLkup :  item.MemberContractIDLkup)).FirstOrDefault();
                var pbpNo          = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.PBPID).Where(x => x.CMN_LookupMasterId == (item.objDOGEN_OSTActions != null && item.objDOGEN_OSTActions.PBPLkup != null && item.objDOGEN_OSTActions.PBPLkup != 0 ? item.objDOGEN_OSTActions.PBPLkup : item.MemberPBPLkup)).FirstOrDefault();
                objDOGEN_GPSServiceRequestParameter.ApplicationDate  = (item.objDOGEN_OSTActions != null && item.objDOGEN_OSTActions.ApplicationDate != null) ? item.objDOGEN_OSTActions.ApplicationDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                objDOGEN_GPSServiceRequestParameter.BirthDate        = (item.objDOGEN_OSTActions != null && item.objDOGEN_OSTActions.DateofBirth != null) ? item.objDOGEN_OSTActions.DateofBirth.Value.ToString("yyyy-MM-dd") : item.MemberDOB.Value.ToString("yyyy-MM-dd");
                objDOGEN_GPSServiceRequestParameter.ContractNumber   = !contractNumber.IsNull() ? contractNumber.LookupValue : string.Empty;
                objDOGEN_GPSServiceRequestParameter.EffectiveEndDate = (item.objDOGEN_OSTActions != null && item.objDOGEN_OSTActions.EndDate != null) ? item.objDOGEN_OSTActions.EndDate.Value.ToString("yyyy-MM-dd") : (!(item.EndDate.IsNull())? item.EndDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                //if TRC code is 16 then effective date will be TimelineEffectiveDate from MQ TRR record this field we are capturing in Gen_Queue while we are processing MQ tRR record
                if ((!(item.TransactionReplyCodeLkup.IsNull()) && item.TransactionReplyCodeLkup == TRCCode.TRC16.ToInt64()) && !(item.TimelineEffectiveDate.IsNull()))
                {
                    objDOGEN_GPSServiceRequestParameter.EffectiveStartDate = item.TimelineEffectiveDate.ToDateTime().ToString("yyyy-MM-dd");
                }
                else
                {
                    objDOGEN_GPSServiceRequestParameter.EffectiveStartDate = new DateTime(DateTime.UtcNow.AddMonths(1).Year, DateTime.UtcNow.AddMonths(1).Month, 1).ToString("yyyy-MM-dd");
                }
                //objDOGEN_GPSServiceRequestParameter.ElectionType = "E";
                objDOGEN_GPSServiceRequestParameter.MedicareClaimNumber = item.MemberCurrentHICN;
                objDOGEN_GPSServiceRequestParameter.LastName            = (item.objDOGEN_OSTActions != null && !(item.objDOGEN_OSTActions.LastName.IsNullOrEmpty())) ? item.objDOGEN_OSTActions.LastName : item.MemberLastName;
                objDOGEN_GPSServiceRequestParameter.PbpNo           = !pbpNo.IsNull() ? pbpNo.LookupValue : string.Empty;
                objDOGEN_GPSServiceRequestParameter.TransactionCode = ((long)CMSTransactionCode.TRR76).ToString();

                CreateCMSTransactionService(objDOGEN_GPSServiceRequestParameter, out errorMessage);

                if (!errorMessage.IsNullOrEmpty())
                {
                    item.objDOGEN_OSTActions.CMSTransactionStatusLkup = (long)CMSTransactionStatus.Failure;
                    BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPCreateCMSTransaction, (long)ExceptionTypes.Uncategorized, string.Empty, errorMessage);
                    isSuccess = false;
                }
                else
                {
                    item.objDOGEN_OSTActions.CMSTransactionStatusLkup = (long)CMSTransactionStatus.Success;
                    isSuccess = true;
                }
                item.objDOGEN_OSTActions.GEN_QueueRef   = item.GEN_QueueId;
                item.objDOGEN_OSTActions.ActionLkup     = (long)ActionLookup.SendSCCUpdatetoCMS;
                item.objDOGEN_OSTActions.LastName       = item.MemberLastName;
                item.objDOGEN_OSTActions.DateofBirth    = item.MemberDOB;
                item.objDOGEN_OSTActions.ContractIDLkup = item.MemberContractIDLkup;
                item.objDOGEN_OSTActions.PBPLkup        = item.MemberPBPLkup;
                if ((!(item.TransactionReplyCodeLkup.IsNull()) && item.TransactionReplyCodeLkup == TRCCode.TRC16.ToInt64()) && !(item.TimelineEffectiveDate.IsNull()))
                {
                    item.objDOGEN_OSTActions.EffectiveDate = item.TimelineEffectiveDate.ToDateTime();
                }
                else
                {
                    item.objDOGEN_OSTActions.EffectiveDate = new DateTime(DateTime.UtcNow.AddMonths(1).Year, DateTime.UtcNow.AddMonths(1).Month, 1);
                }
                //item.objDOGEN_OSTActions.EffectiveDate = new DateTime(DateTime.UtcNow.AddMonths(1).Year, DateTime.UtcNow.AddMonths(1).Month, 1);
                item.objDOGEN_OSTActions.EndDate          = item.EndDate;
                item.objDOGEN_OSTActions.RoleLkup         = (long)RoleLkup.Admin;
                item.objDOGEN_OSTActions.LastUpdatedByRef = _lCurrentMasterUserId;
                result = objOST.SaveOSTActions(item.objDOGEN_OSTActions, out errorMessage);

                if (result != (long)ExceptionTypes.Success)
                {
                    BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPCreateCMSTransaction, (long)ExceptionTypes.Uncategorized, string.Empty, errorMessage);
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(isSuccess);
        }
Exemple #5
0
        private void StartFDRSubmission(string[] arrConfig, string startRowsConfigName, long lBackgroundProcessType)
        {
            string         dayOfTheWeek      = string.Empty;
            string         fdrSubmissionPath = string.Empty;
            DateTime       startDate;
            ExceptionTypes objExceptionTypesResult;
            List <IncludeInTodaysSubmission> lstIncludeInTodaysSubmission = new List <IncludeInTodaysSubmission>();
            List <FileInfo> LstPdffiles = new List <FileInfo>();

            try
            {
                if (arrConfig.Length == 7)
                {
                    //Insert BGP Master Row
                    BLCommon objCommon = new BLCommon();
                    objCommon.InsertBackgroundProcessMaster(lBackgroundProcessType, _lCurrentMasterUserId, out long bgpMasterId, out string errorMessage);


                    objExceptionTypesResult = objBLFDR.GetIncludeInTodaysSubmission(out lstIncludeInTodaysSubmission, out string errorMsg);
                    if (objExceptionTypesResult != ExceptionTypes.Success)
                    {
                        BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, errorMsg, errorMsg);
                    }

                    long lRecordsProcessed = 0;                                           //default value for records processed
                    long lBGPStatusLkup    = (long)BackgroundProcessRecordStatus.Success; //default status for process
                    startDate    = DateTime.UtcNow.AddDays(-Convert.ToInt32(arrConfig[5]));
                    dayOfTheWeek = startDate.DayOfWeek.NullToString();
                    switch (_lSubmissionCategory)
                    {
                    case (long)FDRSubmissionCategory.Category2:
                    case (long)FDRSubmissionCategory.SCC:
                        if (dayOfTheWeek == "Sunday" || dayOfTheWeek == "Saturday")    //sunday||Satday
                        {
                            startDate    = DateTime.UtcNow.AddDays(-(Convert.ToInt32(arrConfig[5]) + Convert.ToInt32(arrConfig[5])));
                            dayOfTheWeek = startDate.DayOfWeek.NullToString();
                        }
                        fdrSubmissionPath = arrConfig[0] + dayOfTheWeek;
                        break;

                    case (long)FDRSubmissionCategory.Category2CTM:
                        if (dayOfTheWeek == "Sunday")    //sunday
                        {
                            startDate    = DateTime.UtcNow.AddDays(-(Convert.ToInt32(arrConfig[5]) + Convert.ToInt32(arrConfig[5])));
                            dayOfTheWeek = startDate.DayOfWeek.NullToString();
                        }
                        fdrSubmissionPath = arrConfig[0] + dayOfTheWeek;
                        break;

                    case (long)FDRSubmissionCategory.ReSubmission:
                        if (dayOfTheWeek == "Sunday")                   //sunday
                        {
                            startDate    = DateTime.UtcNow.AddDays(-3); //Friday
                            dayOfTheWeek = startDate.DayOfWeek.NullToString();
                        }
                        fdrSubmissionPath = arrConfig[0] + dayOfTheWeek;
                        break;

                    case (long)FDRSubmissionCategory.Category3:
                        fdrSubmissionPath = arrConfig[0] + "Submission " + GetSubmissionNumberForCat3();
                        break;
                    }

                    //create Process configuration deatils object from config data
                    ExcelCreationConfig objExcelCreationConfig = new ExcelCreationConfig()
                    {
                        PdfFileslocation             = fdrSubmissionPath,
                        TemplateFilelocation         = arrConfig[1],
                        TemplateFileName             = arrConfig[2],
                        NewFilesLocation             = arrConfig[3],
                        NewExcelFileNamingConvention = arrConfig[4],
                        FilterStartDate    = DateTime.UtcNow.AddDays(-Convert.ToInt32(arrConfig[5])),
                        FilterEndDate      = DateTime.UtcNow.AddDays(-Convert.ToInt32(arrConfig[6])),
                        LstPdffiles        = new List <FileInfo>(),
                        LbgpMasterId       = bgpMasterId,
                        SubmissionCategory = (FDRSubmissionCategory)_lSubmissionCategory,
                        //StartingRows = AppConfigData.StartRowsForSheet.Split('|').Select(x => x.ToInt32()).ToList()
                        StartingRows = CacheUtility.GetConfigrationValueByConfigName(startRowsConfigName).Split('|').Select(x => x.ToInt32()).ToList()
                    };
                    DirectoryInfo info = new DirectoryInfo(objExcelCreationConfig.PdfFileslocation);

                    //filter files to be accessed based on number of PdfsRetrivalStartDay and PdfsRetrivalEndDay from config
                    objExcelCreationConfig.LstPdffiles = info.GetFiles("*-*.pdf").ToList();
                    //objExcelCreationConfig.LstPdffiles = info.GetFiles("*-*.pdf").ToList();

                    //Logic for include in todays submission
                    if (lstIncludeInTodaysSubmission.Count > 0)
                    {
                        info = new DirectoryInfo(arrConfig[0].NullToString());
                        foreach (var item in lstIncludeInTodaysSubmission)
                        {
                            if (info.GetFiles(item.SubmissionFileName, SearchOption.AllDirectories).Count() > 0)
                            {
                                objExcelCreationConfig.LstPdffiles.Add(info.GetFiles(item.SubmissionFileName, SearchOption.AllDirectories).FirstOrDefault());
                            }
                        }
                    }
                    //create new folder location
                    objExcelCreationConfig.NewFilesLocation = objExcelCreationConfig.NewFilesLocation + DateTime.UtcNow.ToString("yyyy/MM/dd") + "\\";

                    if (objExcelCreationConfig.LstPdffiles.Count > 0)
                    {
                        ExceptionTypes result;
                        Console.WriteLine("Creating directory..");
                        //create new folder for copying files and creating excels
                        Directory.CreateDirectory(objExcelCreationConfig.NewFilesLocation);
                        Console.WriteLine("New directory created : " + objExcelCreationConfig.NewFilesLocation);

                        FilesCopy objFilesCopy = new FilesCopy();
                        //copy files to new location
                        result = objFilesCopy.StartFilesCopy(objExcelCreationConfig);
                        if (result != ExceptionTypes.Success)
                        {
                            string ex = "Copying PDF Files Failed " + _strSubmissionCategory;
                            BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                        }

                        ExcelCreation objExcelCreation = new ExcelCreation();
                        //create FDR submission excel
                        result = objExcelCreation.StartExcelCreation(objExcelCreationConfig, out lRecordsProcessed, out List <long> CaseIds);

                        //if excel creation fails log error
                        if (result != ExceptionTypes.Success)
                        {
                            string ex = "Excel Creation Failed for " + _strSubmissionCategory;
                            BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                            lRecordsProcessed = 0;
                            lBGPStatusLkup    = (long)BackgroundProcessRecordStatus.Failed;
                        }
                        else if (lRecordsProcessed > 0 && CaseIds.Count > 0)
                        {
                            //update the FDRPackagedate and FDRSUbmissioncategorylkup fields for all ers case Ids.

                            result = objBLFDR.UpdateFDRPackageDate(CaseIds, objExcelCreationConfig.SubmissionCategory, _lCurrentMasterUserId, out errorMessage);
                            if (result != ExceptionTypes.Success)
                            {
                                string ex = "Updating FDR Package date failed for " + _strSubmissionCategory;
                                BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, errorMessage, ex.ToString());
                            }
                        }
                    }
                    else
                    {
                        //if no pdf files in location to create FDR submission log error
                        lRecordsProcessed = 0;
                        lBGPStatusLkup    = (long)BackgroundProcessRecordStatus.Failed;
                        string ex = "No pdfs for " + _strSubmissionCategory + " at : " + objExcelCreationConfig.PdfFileslocation + " created between " + objExcelCreationConfig.FilterStartDate.ToShortDateString() + " and " + objExcelCreationConfig.FilterEndDate.ToShortDateString();
                        BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                        Console.WriteLine(ex);
                    }
                    //log BGP run status
                    DOCMN_BackgroundProcessMaster objDOCMN_BackgroundProcessMaster = new DOCMN_BackgroundProcessMaster();
                    objDOCMN_BackgroundProcessMaster.CMN_BackgroundProcessMasterId = bgpMasterId;
                    objDOCMN_BackgroundProcessMaster.TotalRecordProcessed          = lRecordsProcessed;
                    objDOCMN_BackgroundProcessMaster.BGPStatusLkup    = lBGPStatusLkup;
                    objDOCMN_BackgroundProcessMaster.LastUpdatedByRef = _lCurrentMasterUserId;
                    objCommon.UpdateBackgroundProcessMaster(objDOCMN_BackgroundProcessMaster, out errorMessage);
                }
                else
                {
                    //if app.config configuration for FDR submission is wrong
                    throw new InvalidDataException("Invalid App Configuration data for " + _strSubmissionCategory + " in app.config");
                }
            }
            catch (Exception ex)
            {
                //log exception if any
                BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, "Exception Starting FDR Submission " + _strSubmissionCategory, ex.StackTrace.ToString());
            }
        }