コード例 #1
0
ファイル: SendOOALetter.cs プロジェクト: amitthanki/mvcdemo
        public bool InsertBGPDetails(DOCMN_BackgroundProcessDetails objDOCMN_BackgroundProcessDetails)
        {
            bool isSuccess = false;
            //Insert BGP Master Row
            BLCommon objCommon = new BLCommon();

            //Insert BGP Master Row
            objCommon.InsertBackgroundProcessDetails(objDOCMN_BackgroundProcessDetails, out string errorMessage);

            if (_retValue == ExceptionTypes.Success && string.IsNullOrEmpty(errorMessage))
            {
                isSuccess = true;
            }

            return(isSuccess);
        }
コード例 #2
0
 public ExceptionTypes InsertBackgroundProcessDetails(DOCMN_BackgroundProcessDetails objDOCMN_BackgroundProcessDetails, out string errorMessage)
 {
     return(retValue = _objDALCommon.InsertBackgroundProcessDetails(objDOCMN_BackgroundProcessDetails, out errorMessage));
 }
コード例 #3
0
        public ExceptionTypes StartExcelCreation(ExcelCreationConfig objExcelCreationConfig, out long lRecordsProcessed, out List <long> CaseIds)
        {
            CaseIds = new List <long>();
            Console.WriteLine("Excel Creation Started...");
            ExceptionTypes result = ExceptionTypes.Success;

            lRecordsProcessed = 0;//variable to keep track of total records processed
            try
            {
                BLCommon objBLCommon = new BLCommon();

                //List of excel sheets
                List <FDRSubmissionSheetData> lstExcelSheets = new List <FDRSubmissionSheetData>();

                //check for submission category
                if (objExcelCreationConfig.SubmissionCategory == FDRSubmissionCategory.SCC)
                {
                    FDRSubmissionSheetData SCCSheet = new FDRSubmissionSheetData();

                    //assign sheet position in workbook for all sheets
                    SCCSheet.ISheetNumber = (int)SCCFDRSubmissionExcelSheets.SCC;

                    //assign startting rows for each excel sheet
                    SCCSheet.IStartRow = objExcelCreationConfig.StartingRows[SCCSheet.ISheetNumber - 2];

                    //popualate data in excel sheets
                    //for each pdf file add row in one of the excel sheet data objects
                    foreach (var item in objExcelCreationConfig.LstPdffiles)
                    {
                        //create object to insert in BGP process details for each row created in excel sheet
                        DOCMN_BackgroundProcessDetails objDOCMN_BackgroundProcessDetails = new DOCMN_BackgroundProcessDetails();
                        objDOCMN_BackgroundProcessDetails.CMN_BackgroundProcessMasterRef = objExcelCreationConfig.LbgpMasterId;
                        objDOCMN_BackgroundProcessDetails.UploadFileName = item.Name;

                        //get contract name and HICN from Pdf file name
                        string[] arrContractHicn = item.Name.Replace(".pdf", "").Split('-');
                        //get create row for Contract and HICN
                        result = CreateRowData(arrContractHicn[0], arrContractHicn[1], objExcelCreationConfig.SubmissionCategory, out FDRSubmissionRow newRow, out long lActionRequeseted, out string errorMessage);

                        //if row is created succesfully
                        if (result == ExceptionTypes.Success)
                        {
                            SCCSheet.LstRowData.Add(newRow);
                            //add details to BGP deatils
                            objDOCMN_BackgroundProcessDetails.BGPRecordStatusLkup = (long)BackgroundProcessRecordStatus.Success;
                            objDOCMN_BackgroundProcessDetails.GEN_QueueRef        = newRow.GEN_QueueId;
                            //increase count of total records processed
                            lRecordsProcessed++;
                            CaseIds.Add(newRow.GEN_QueueId);
                        }
                        else
                        {
                            //if row creation failed update BGP deatils with fail result
                            objDOCMN_BackgroundProcessDetails.BGPRecordStatusLkup = (long)BackgroundProcessRecordStatus.Failed;
                            objDOCMN_BackgroundProcessDetails.GEN_QueueRef        = 0;
                            objDOCMN_BackgroundProcessDetails.FailureReason       = errorMessage;
                        }
                        //insert into BGP details table
                        objBLCommon.InsertBackgroundProcessDetails(objDOCMN_BackgroundProcessDetails, out errorMessage);
                    }
                    //once finished processing and creating rows for all the pdf files
                    //add excel sheets to list Excel Sheets if there are rows in the Sheet data
                    if (SCCSheet.LstRowData.Count > 0)
                    {
                        lstExcelSheets.Add(SCCSheet);
                    }
                }
                else
                {
                    //excel sheets objects based on action requested
                    FDRSubmissionSheetData RetDisenrlSheet = new FDRSubmissionSheetData();
                    FDRSubmissionSheetData PBPSheet        = new FDRSubmissionSheetData();
                    FDRSubmissionSheetData RetEnrlSheet    = new FDRSubmissionSheetData();
                    FDRSubmissionSheetData ReInstmtSheet   = new FDRSubmissionSheetData();

                    //assign sheet position in workbook for all sheets
                    RetDisenrlSheet.ISheetNumber = (int)FDRSubmissionExcelSheets.Ret_Disenrl;
                    PBPSheet.ISheetNumber        = (int)FDRSubmissionExcelSheets.PBP;
                    RetEnrlSheet.ISheetNumber    = (int)FDRSubmissionExcelSheets.Ret_Enrl;
                    ReInstmtSheet.ISheetNumber   = (int)FDRSubmissionExcelSheets.REINSTMT;

                    //assign startting rows for each excel sheet
                    RetDisenrlSheet.IStartRow = objExcelCreationConfig.StartingRows[RetDisenrlSheet.ISheetNumber - 2];
                    PBPSheet.IStartRow        = objExcelCreationConfig.StartingRows[PBPSheet.ISheetNumber - 2];
                    RetEnrlSheet.IStartRow    = objExcelCreationConfig.StartingRows[RetEnrlSheet.ISheetNumber - 2];
                    ReInstmtSheet.IStartRow   = objExcelCreationConfig.StartingRows[ReInstmtSheet.ISheetNumber - 2];

                    //popualate data in excel sheets
                    //for each pdf file add row in one of the excel sheet data objects
                    foreach (var item in objExcelCreationConfig.LstPdffiles)
                    {
                        //create object to insert in BGP process details for each row created in excel sheet
                        DOCMN_BackgroundProcessDetails objDOCMN_BackgroundProcessDetails = new DOCMN_BackgroundProcessDetails();
                        objDOCMN_BackgroundProcessDetails.CMN_BackgroundProcessMasterRef = objExcelCreationConfig.LbgpMasterId;
                        objDOCMN_BackgroundProcessDetails.UploadFileName = item.Name;

                        //get contract name and HICN from Pdf file name
                        string[] arrContractHicn = item.Name.Replace(".pdf", "").Split('-');
                        //get create row for Contract and HICN
                        result = CreateRowData(arrContractHicn[0], arrContractHicn[1], objExcelCreationConfig.SubmissionCategory, out FDRSubmissionRow newRow, out long lResolution, out string errorMessage);

                        //if row is created succesfully
                        if (result == ExceptionTypes.Success)
                        {
                            //add row to one of excel sheet based on action requested
                            switch (lResolution)
                            {
                            case (long)RPRResolution.PlanErrorReinstatement:
                            case (long)RPRResolution.ReinstatementDeathABTerm:
                            case (long)RPRResolution.ReinstatementOther:
                            case (long)RPRResolution.ReinstatementTRC14:
                                ReInstmtSheet.LstRowData.Add(newRow);
                                break;

                            case (long)RPRResolution.EffectiveDateChange:
                            case (long)RPRResolution.RetroEnrollment:
                                RetEnrlSheet.LstRowData.Add(newRow);
                                break;

                            case (long)RPRResolution.DisenrollmentDateChangeDODError:
                            case (long)RPRResolution.EnrollmentCancellation:
                            case (long)RPRResolution.RetroDisenrollment:
                                RetDisenrlSheet.LstRowData.Add(newRow);
                                break;

                            case (long)RPRResolution.PBPChange:
                                PBPSheet.LstRowData.Add(newRow);
                                break;
                            }

                            //add details to BGP deatils
                            objDOCMN_BackgroundProcessDetails.BGPRecordStatusLkup = (long)BackgroundProcessRecordStatus.Success;
                            objDOCMN_BackgroundProcessDetails.GEN_QueueRef        = newRow.GEN_QueueId;
                            //increase count of total records processed
                            lRecordsProcessed++;
                            CaseIds.Add(newRow.GEN_QueueId);
                        }
                        else
                        {
                            //if row creation failed update BGP deatils with fail result
                            objDOCMN_BackgroundProcessDetails.BGPRecordStatusLkup = (long)BackgroundProcessRecordStatus.Failed;
                            objDOCMN_BackgroundProcessDetails.GEN_QueueRef        = 0;
                            objDOCMN_BackgroundProcessDetails.FailureReason       = errorMessage;
                        }
                        //insert into BGP details table
                        objBLCommon.InsertBackgroundProcessDetails(objDOCMN_BackgroundProcessDetails, out errorMessage);
                    }
                    //once finished processing and creating rows for all the pdf files
                    //add excel sheets to list Excel Sheets if there are rows in the Sheet data
                    if (RetDisenrlSheet.LstRowData.Count > 0)
                    {
                        lstExcelSheets.Add(RetDisenrlSheet);
                    }
                    if (PBPSheet.LstRowData.Count > 0)
                    {
                        lstExcelSheets.Add(PBPSheet);
                    }
                    if (RetEnrlSheet.LstRowData.Count > 0)
                    {
                        lstExcelSheets.Add(RetEnrlSheet);
                    }
                    if (ReInstmtSheet.LstRowData.Count > 0)
                    {
                        lstExcelSheets.Add(ReInstmtSheet);
                    }
                }
                //create excel workbook and save from list of excel sheets
                result = CreateExcel(lstExcelSheets, objExcelCreationConfig);
            }
            catch (Exception ex)
            {
                //log if any exception
                Console.WriteLine("Error : " + ex.Message);
                result = ExceptionTypes.Exception;
                BLCommon.LogError(_lCurrentMasterUserId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BGPFDRSubmission, (long)ExceptionTypes.Uncategorized, "Exception Starting Excel Creation", ex.StackTrace.ToString());
            }

            return(result);
        }