public void CreateAndTransferFile(int BranchID, string TerminalNo, DateTime pvtDateInitialized) { DateTime dteDateToprocess = pvtDateInitialized; Event clsEvent = new Event(); try { clsEvent.AddEventLn("Starting Ayala FILE CREATOR.", true); clsEvent.AddEventLn("==================================================", true); clsEvent.AddEventLn("= Ayala FILE CREATOR =", true); clsEvent.AddEventLn("==================================================", true); /*********************************************************************** * Check the destination dir if existing. * ********************************************************************/ clsEvent.AddEventLn("Checking directory settings.", true); string dir = mclsAyalaDetails.OutputDirectory; dir = dir.Replace("{YYYY}", DateTime.Now.ToString("yyyy")); dir = dir.Replace("{MM}", DateTime.Now.ToString("MM")); dir = dir.Replace("{MMM}", DateTime.Now.ToString("MMM")); dir = dir.Replace("{MMMM}", DateTime.Now.ToString("MMMM")); if (!System.IO.Directory.Exists(dir)) { clsEvent.AddEventLn("Directory [" + dir + "] does not exist.", true); System.IO.Directory.CreateDirectory(dir); } else { clsEvent.AddEventLn("Directory [" + dir + "] exist.", true); } mclsAyalaDetails.OutputDirectory = dir; /*********************************************************************** * GET The report of Current Terminal using Specified InitializationDate * ********************************************************************/ Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(); Data.TerminalReportDetails clsTerminalReportDetail = clsTerminalReportHistory.Details(BranchID, TerminalNo, dteDateToprocess); string stDailyTableName = CreateDailySales(dteDateToprocess, clsTerminalReportDetail); string stHourlyTableName = CreateHourlySales(BranchID, TerminalNo, dteDateToprocess); clsTerminalReportHistory.UpdateTerminalReportBatchCounter(TerminalNo, dteDateToprocess); clsTerminalReportHistory.CommitAndDispose(); clsEvent.AddEventLn("Record for [" + dteDateToprocess.ToString("yyyy-MM-dd HH:mm:ss") + "] BacthCounter:" + clsTerminalReportDetail.BatchCounter.ToString() + " has been created for Ayala.", true); TransferFile(stDailyTableName); TransferFile(stHourlyTableName); } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); throw ex; } clsEvent.AddEventLn("Ayala FILE CREATOR exited.", true); }
public bool CreateAndTransferFile(Int32 BranchID, string TerminalNo, DateTime pvtDateInitialized) { bool bolRetValue = false; DateTime dteDateToprocess = pvtDateInitialized; Event clsEvent = new Event(); try { clsEvent.AddEventLn("Starting RLC FILE CREATOR.", true); clsEvent.AddEventLn("==================================================", true); clsEvent.AddEventLn("= RLC FILE CREATOR =", true); clsEvent.AddEventLn("==================================================", true); /*********************************************************************** * Check the destination dir if existing. * ********************************************************************/ clsEvent.AddEventLn("Checking directory settings.", true); string dir = mclsRLCDetails.OutputDirectory; dir = dir.Replace("{YYYY}", DateTime.Now.ToString("yyyy")); dir = dir.Replace("{MM}", DateTime.Now.ToString("MM")); dir = dir.Replace("{MMM}", DateTime.Now.ToString("MMM")); dir = dir.Replace("{MMMM}", DateTime.Now.ToString("MMMM")); if (!System.IO.Directory.Exists(dir)) { clsEvent.AddEventLn("Directory [" + dir + "] does not exist.", true); System.IO.Directory.CreateDirectory(dir); } else { clsEvent.AddEventLn("Directory [" + dir + "] exist.", true); } mclsRLCDetails.OutputDirectory = dir; /*********************************************************************** * GET The report of Current Terminal using Specified InitializationDate * ********************************************************************/ Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(); Data.TerminalReportDetails clsTerminalReportDetail = clsTerminalReportHistory.Details(BranchID, TerminalNo, dteDateToprocess); Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsTerminalReportHistory.Connection, clsTerminalReportHistory.Transaction); long lngSeniorCitizenDiscountCount = 0; decimal decSeniorCitizenDiscount = clsSalesTransactions.SeniorCitizenDiscounts(clsTerminalReportDetail.BranchID, clsTerminalReportDetail.TerminalNo, clsTerminalReportDetail.BeginningTransactionNo, clsTerminalReportDetail.EndingTransactionNo, out lngSeniorCitizenDiscountCount); long lngPWDDiscountCount = 0; decimal decPWDDiscount = clsSalesTransactions.PersonWithDisabilityDiscounts(clsTerminalReportDetail.BranchID, clsTerminalReportDetail.TerminalNo, clsTerminalReportDetail.BeginningTransactionNo, clsTerminalReportDetail.EndingTransactionNo, out lngPWDDiscountCount); string stDailyTableName = CreateDailySales(dteDateToprocess, clsTerminalReportDetail, decSeniorCitizenDiscount, lngSeniorCitizenDiscountCount, decPWDDiscount, lngPWDDiscountCount); clsTerminalReportHistory.CommitAndDispose(); bool bolTransferFile = TransferFile(stDailyTableName); if (bolTransferFile) { clsTerminalReportHistory = new Data.TerminalReportHistory(); clsTerminalReportHistory.UpdateTerminalReportBatchCounter(clsTerminalReportDetail.TerminalNo, dteDateToprocess); clsTerminalReportHistory.UpdateTerminalReportIsMallFileUploadComplete(clsTerminalReportDetail.TerminalNo, dteDateToprocess, true); if (clsTerminalReportDetail.BatchCounter == 1) { clsTerminalReportHistory.UpdateTerminalReportMallForwarderFileName(clsTerminalReportDetail.TerminalNo, dteDateToprocess, stDailyTableName); } clsTerminalReportHistory.CommitAndDispose(); bolRetValue = true; } clsEvent.AddEventLn("Record for [" + dteDateToprocess.ToString("yyyy-MM-dd HH:mm:ss") + "] BacthCounter:" + clsTerminalReportDetail.BatchCounter.ToString() + " has been created for RLC.", true); } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); throw ex; } clsEvent.AddEventLn("RLC FILE CREATOR exited.", true); return(bolRetValue); }
public bool CreateAndTransferFile(Int32 BranchID, string TerminalNo, DateTime pvtDateInitialized) { bool bolRetValue = false; DateTime dteDateToprocess = pvtDateInitialized; Event clsEvent = new Event(); try { clsEvent.AddEventLn("Starting RLC FILE CREATOR.", true); clsEvent.AddEventLn("==================================================", true); clsEvent.AddEventLn("= RLC FILE CREATOR =", true); clsEvent.AddEventLn("==================================================", true); /*********************************************************************** * Check the destination dir if existing. * ********************************************************************/ clsEvent.AddEventLn("Checking directory settings.", true); string dir = mclsRLCDetails.OutputDirectory; dir = dir.Replace("{YYYY}", DateTime.Now.ToString("yyyy")); dir = dir.Replace("{MM}", DateTime.Now.ToString("MM")); dir = dir.Replace("{MMM}", DateTime.Now.ToString("MMM")); dir = dir.Replace("{MMMM}", DateTime.Now.ToString("MMMM")); if (!System.IO.Directory.Exists(dir)) { clsEvent.AddEventLn("Directory [" + dir + "] does not exist.", true); System.IO.Directory.CreateDirectory(dir); } else { clsEvent.AddEventLn("Directory [" + dir + "] exist.", true); } mclsRLCDetails.OutputDirectory = dir; /*********************************************************************** * GET The report of Current Terminal using Specified InitializationDate * ********************************************************************/ Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(); Data.TerminalReportDetails clsTerminalReportDetail = clsTerminalReportHistory.Details(BranchID, TerminalNo, dteDateToprocess); Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsTerminalReportHistory.Connection, clsTerminalReportHistory.Transaction); long lngSeniorCitizenDiscountCount = 0; decimal decSeniorCitizenDiscount = clsSalesTransactions.SeniorCitizenDiscounts(clsTerminalReportDetail.BranchID, clsTerminalReportDetail.TerminalNo, clsTerminalReportDetail.BeginningTransactionNo, clsTerminalReportDetail.EndingTransactionNo, out lngSeniorCitizenDiscountCount); long lngPWDDiscountCount = 0; decimal decPWDDiscount = clsSalesTransactions.PersonWithDisabilityDiscounts(clsTerminalReportDetail.BranchID, clsTerminalReportDetail.TerminalNo, clsTerminalReportDetail.BeginningTransactionNo, clsTerminalReportDetail.EndingTransactionNo, out lngPWDDiscountCount); string stDailyTableName = CreateDailySales(dteDateToprocess, clsTerminalReportDetail, decSeniorCitizenDiscount, lngSeniorCitizenDiscountCount, decPWDDiscount, lngPWDDiscountCount); clsTerminalReportHistory.CommitAndDispose(); bool bolTransferFile = TransferFile(stDailyTableName); if (bolTransferFile ) { clsTerminalReportHistory = new Data.TerminalReportHistory(); clsTerminalReportHistory.UpdateTerminalReportBatchCounter(clsTerminalReportDetail.TerminalNo, dteDateToprocess); clsTerminalReportHistory.UpdateTerminalReportIsMallFileUploadComplete(clsTerminalReportDetail.TerminalNo, dteDateToprocess, true); if (clsTerminalReportDetail.BatchCounter == 1) clsTerminalReportHistory.UpdateTerminalReportMallForwarderFileName(clsTerminalReportDetail.TerminalNo, dteDateToprocess, stDailyTableName); clsTerminalReportHistory.CommitAndDispose(); bolRetValue = true; } clsEvent.AddEventLn("Record for [" + dteDateToprocess.ToString("yyyy-MM-dd HH:mm:ss") + "] BacthCounter:" + clsTerminalReportDetail.BatchCounter.ToString() + " has been created for RLC.", true); } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); throw ex; } clsEvent.AddEventLn("RLC FILE CREATOR exited.", true); return bolRetValue; }