public override bool Execute()
        {
            try
            {
                TaxationDiskProcess process = new TaxationDiskProcess(dbConn, taxFormID);

                string taxFileName;
                string fileExtension = ".txt";
                if (fileFormat.Equals("XML", StringComparison.CurrentCultureIgnoreCase))
                {
                    taxFileName   = process.GenerateToXML();
                    fileExtension = ".xml";
                }
                else
                {
                    taxFileName = process.GenerateToFile();
                }

                DateTime generateDate = AppUtils.ServerDateTime();

                string strTmpFolder = HROne.Common.Folder.GetOrCreateApplicationTempFolder().FullName;// System.IO.Path.GetTempPath(); //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);

                string autoPayFileNameExtension = taxFileName.Substring(taxFileName.LastIndexOf("."));
                string outputTaxFileName        = "TaxationFile_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + fileExtension;
                string strTaxTmpFile            = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(taxFileName));
                System.IO.File.Move(taxFileName, strTaxTmpFile);

                string strTmpReportFilePath = string.Empty;
                string reportOutputFileName = string.Empty;
                if (!fileExtension.Equals(".xml"))
                {
                    HROne.Reports.Taxation.ControlListProcess rpt = new HROne.Reports.Taxation.ControlListProcess(dbConn, taxFormID, NameOfSignature);

                    string reportFileName          = rpt.ReportExportToFile(string.Empty, "PDF", false);
                    string reportFileNameExtension = reportFileName.Substring(reportFileName.LastIndexOf("."));
                    reportOutputFileName = "TaxControlList_" + generateDate.ToString("yyyyMMddHHmmss") + reportFileNameExtension;
                    strTmpReportFilePath = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(reportFileName));
                    System.IO.File.Move(reportFileName, strTmpReportFilePath);
                    rpt.Dispose();
                }
                string InboxMessageType = string.Empty;

                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, InboxMessageType, ReportName, string.Empty, new DateTime());

                inbox.AddInboxAttachment(dbConn, outputTaxFileName, strTaxTmpFile);
                if (!string.IsNullOrEmpty(strTmpReportFilePath))
                {
                    inbox.AddInboxAttachment(dbConn, reportOutputFileName, strTmpReportFilePath);
                }

                dbConn.Dispose();
                return(true);
            }
            catch (Exception ex)
            {
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, ex.Message + "\r\n" + ex.StackTrace, new DateTime());
                dbConn.Dispose();
            }
            return(false);
        }
        public override bool Execute()
        {
            try
            {
                string exportFileName = reportProcess.ReportExportToFile(reportTemplateFileName, ExportFormat, IsLocalize);

                string exportFileNameExtension = exportFileName.Substring(exportFileName.LastIndexOf("."));
                string outputFileName          = OutputFilenamePrefix + "_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + exportFileNameExtension;

                EInbox inbox        = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, string.Empty, new DateTime());
                string strTmpFolder = HROne.Common.Folder.GetOrCreateApplicationTempFolder().FullName;// System.IO.Path.GetTempPath(); //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
                string strTmpFile   = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(exportFileName));
                System.IO.File.Move(exportFileName, strTmpFile);

                inbox.AddInboxAttachment(dbConn, outputFileName, strTmpFile);

                //string uploadFolder = AppUtils.GetDocumentUploadFolder(dbConn);
                //string relativePath = @"Inbox\" + inbox.InboxID + "_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".hrd";
                //string destinationFile = System.IO.Path.Combine(uploadFolder, relativePath);
                //System.IO.DirectoryInfo inboxDirectoryInfo = new DirectoryInfo(System.IO.Path.GetDirectoryName(destinationFile));
                //if (!inboxDirectoryInfo.Exists)
                //    inboxDirectoryInfo.Create();
                //zip.Compress(strTmpFolder, System.IO.Path.GetFileName(strTmpFile), destinationFile);
                //System.IO.File.Delete(outputFileName);


                //EInboxAttachment attachment = new EInboxAttachment();
                //attachment.InboxID = inbox.InboxID;
                //attachment.InboxAttachmentOriginalFileName = outputFileName;
                //attachment.InboxAttachmentStoredFileName = relativePath;
                //attachment.InboxAttachmentIsCompressed = true;
                //attachment.InboxAttachmentSize = new System.IO.FileInfo(destinationFile).Length;
                //EInboxAttachment.db.insert(dbConn, attachment);

                dbConn.Dispose();
                reportProcess.Dispose();
                return(true);
            }
            catch (Exception ex)
            {
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, ex.Message + "\r\n" + ex.StackTrace, new DateTime());
                dbConn.Dispose();
                reportProcess.Dispose();
            }
            return(false);
        }
        public override bool Execute()
        {
            try
            {
                mpfFileProcess.LoadMPFFileDetail(empList, MPFPlanID, PayPeriodFr, PayPeriodTo);
                FileInfo mpfFile      = mpfFileProcess.GenerateMPFFile();
                DateTime generateDate = AppUtils.ServerDateTime();

                string strTmpFolder = HROne.Common.Folder.GetOrCreateApplicationTempFolder().FullName;// System.IO.Path.GetTempPath(); //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);

                string mpfFileName          = mpfFile.FullName;
                string mpfFileNameExtension = mpfFileName.Substring(mpfFileName.LastIndexOf("."));
                string outputMPFFileName    = mpfFileProcess.ActualMPFFileName(); //"MPFFile_" + generateDate.ToString("yyyyMMddHHmmss") + mpfFileNameExtension;
                string strMPFTmpFile        = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(mpfFileName));
                System.IO.File.Move(mpfFileName, strMPFTmpFile);

                string ChequeNo = "";   // cheque no for AIA only, not applicable to iMgr

                HROne.MPFFile.MPFRemittanceStatementProcess remittanceStatementProcess = new HROne.MPFFile.MPFRemittanceStatementProcess(dbConn, empList, MPFPlanID, PayPeriodFr, PayPeriodTo, ChequeNo);

                string exportFileName          = remittanceStatementProcess.ReportExportToFile(string.Empty, "PDF", true);
                string exportFileNameExtension = exportFileName.Substring(exportFileName.LastIndexOf("."));
                string outputFileName          = "MPFRemittanceStatement_" + generateDate.ToString("yyyyMMddHHmmss") + exportFileNameExtension;
                string strTmpFile = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(exportFileName));
                System.IO.File.Move(exportFileName, strTmpFile);

                string InboxMessageType = string.Empty;
                // currently only gateway format is supported for directly submitted
                if (mpfFileProcess is HSBCMPFGatewayFile && !(mpfFileProcess is HSBCMPFGatewayFileEncrypted))
                {
                    InboxMessageType = EInbox.INBOX_TYPE_MPF_FILE + "|" + EInbox.INBOX_TYPE_FOR_ECHANNEL;
                }

                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, InboxMessageType, ReportName, string.Empty, new DateTime());

                inbox.AddInboxAttachment(dbConn, outputMPFFileName, strMPFTmpFile);
                inbox.AddInboxAttachment(dbConn, outputFileName, strTmpFile);

                if (mpfFileProcess is HSBCMPFGatewayFileEncrypted)
                {
                    HROne.MPFFile.HSBCMPFGatewayFileEncryptedCoverProcess coverProcess = new HROne.MPFFile.HSBCMPFGatewayFileEncryptedCoverProcess(dbConn, (HSBCMPFGatewayFileEncrypted)mpfFileProcess);

                    string exportCoverFileName          = coverProcess.ReportExportToFile(string.Empty, "PDF", true);
                    string exportCoverFileNameExtension = exportCoverFileName.Substring(exportCoverFileName.LastIndexOf("."));
                    string outputCoverFileName          = "Cover_" + generateDate.ToString("yyyyMMddHHmmss") + exportCoverFileNameExtension;
                    string strCoverTmpFile = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(exportCoverFileName));
                    System.IO.File.Move(exportCoverFileName, strCoverTmpFile);

                    inbox.AddInboxAttachment(dbConn, outputCoverFileName, strCoverTmpFile);
                    coverProcess.Dispose();
                }

                dbConn.Dispose();
                remittanceStatementProcess.Dispose();
                return(true);
            }
            catch (Exception ex)
            {
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, ex.Message + "\r\n" + ex.StackTrace, new DateTime());
                dbConn.Dispose();
            }
            return(false);
        }
        public override bool Execute()
        {
            try
            {
                bankFileProcess.LoadBankFileDetail(payBatchList, empList);
                FileInfo bankFile     = bankFileProcess.GenerateBankFile();
                DateTime generateDate = AppUtils.ServerDateTime();

                string strTmpFolder = HROne.Common.Folder.GetOrCreateApplicationTempFolder().FullName;// System.IO.Path.GetTempPath(); //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);

                string autoPayFileName          = bankFile.FullName;
                string autoPayFileNameExtension = autoPayFileName.Substring(autoPayFileName.LastIndexOf("."));
                string outputAutoPayFileName    = bankFileProcess.ActualBankFileName(); //"BankFile_" + generateDate.ToString("yyyyMMddHHmmss") + autoPayFileNameExtension;
                string strAutoPayTmpFile        = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(autoPayFileName));
                System.IO.File.Move(autoPayFileName, strAutoPayTmpFile);

                HROne.BankFile.AutopayListProcess autoPayListProcess = new HROne.BankFile.AutopayListProcess(dbConn, bankFileProcess.CreateAutopayListDataSet(), PayPeriodFr, reportCultureInfo);

                string exportFileName          = autoPayListProcess.ReportExportToFile(string.Empty, "PDF", true);
                string exportFileNameExtension = exportFileName.Substring(exportFileName.LastIndexOf("."));
                string outputFileName          = "AutopayList_" + generateDate.ToString("yyyyMMddHHmmss") + exportFileNameExtension;
                string strTmpFile = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(exportFileName));
                System.IO.File.Move(exportFileName, strTmpFile);

                foreach (EPayrollBatch payBatch in payBatchList)
                {
                    payBatch.PayBatchFileGenDate = generateDate;
                    payBatch.PayBatchValueDate   = valueDate;
                    payBatch.PayBatchFileGenBy   = user.UserID;
                    EPayrollBatch.db.update(dbConn, payBatch);
                }
                HROne.Payroll.PayrollProcess.UpdateEmpPayrollValueDate(dbConn, payBatchList, empList, valueDate, true, bankFileProcess.IsGenerateChequePayment, false, false);

                string InboxMessageType = string.Empty;
                if (bankFileProcess is HSBCBankFile && !(bankFileProcess is HSBCBankFileEncrypted))
                {
                    if (!((HSBCBankFile)bankFileProcess).UseBIBFormat)
                    {
                        InboxMessageType = EInbox.INBOX_TYPE_AUTOPAY_FILE + "|" + EInbox.INBOX_TYPE_FOR_ECHANNEL;
                    }
                }

                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, InboxMessageType, ReportName, string.Empty, new DateTime());

                inbox.AddInboxAttachment(dbConn, outputAutoPayFileName, strAutoPayTmpFile);
                inbox.AddInboxAttachment(dbConn, outputFileName, strTmpFile);

                if (bankFileProcess is HSBCBankFileEncrypted)
                {
                    HROne.BankFile.HSBCBankFileEncryptedCoverProcess coverProcess = new HROne.BankFile.HSBCBankFileEncryptedCoverProcess(dbConn, (HSBCBankFileEncrypted)bankFileProcess);

                    string exportCoverFileName          = coverProcess.ReportExportToFile(string.Empty, "PDF", true);
                    string exportCoverFileNameExtension = exportCoverFileName.Substring(exportCoverFileName.LastIndexOf("."));
                    string outputCoverFileName          = "Cover_" + generateDate.ToString("yyyyMMddHHmmss") + exportCoverFileNameExtension;
                    string strCoverTmpFile = System.IO.Path.Combine(strTmpFolder, System.IO.Path.GetFileName(exportCoverFileName));
                    System.IO.File.Move(exportCoverFileName, strCoverTmpFile);

                    inbox.AddInboxAttachment(dbConn, outputCoverFileName, strCoverTmpFile);
                    coverProcess.Dispose();
                }

                dbConn.Dispose();
                autoPayListProcess.Dispose();
                return(true);
            }
            catch (NegativeAmountException ex)
            {
                string    message           = HROne.Common.WebUtility.GetLocalizedStringByCode("ERROR_BANKFILE_NEGATIVE", "Bank file should not contain negative amount");
                ArrayList errorBankFileList = ex.GetErrorBankFileDetailList();
                foreach (GenericBankFileDetail detail in errorBankFileList)
                {
                    message += "\r\n- " + HROne.Common.WebUtility.GetLocalizedString("EmpNo") + ": " + detail.EmpNo + ", " + HROne.Common.WebUtility.GetLocalizedString("Amount") + ": " + detail.Amount;
                }
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, message, new DateTime());
            }
            catch (InvalidEEBankAccountException ex)
            {
                string message = ex.Message;
                message += "\r\n- " + ex.EmpNo + " - " + ex.EmpName;
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, message, new DateTime());
            }
            catch (Exception ex)
            {
                EInbox inbox = EInbox.CreateAndSaveInboxMessage(dbConn, user.UserID, 0, 0, 0, string.Empty, string.Empty, ReportName, ex.Message + "\r\n" + ex.StackTrace, new DateTime());
                dbConn.Dispose();
            }
            return(false);
        }