Пример #1
0
		private void SendRLC()
		{
			try
			{
				tmr.Enabled = false;

				Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(mConnection, mTransaction);
                mConnection = clsTerminalReportHistory.Connection; mTransaction = clsTerminalReportHistory.Transaction;

                DateTime dteDateToProcess = clsTerminalReportHistory.getRLCDateLastInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo);
				clsTerminalReportHistory.CommitAndDispose();

				if (dteDateToProcess == DateTime.MinValue)
				{
					grpRLC.Visible = false;
				}
				else
				{
					try
					{
						try { grpRLC.Visible = true; }
						catch { }
					Back:
                        SetText("RLC Notification: Trying to send unsent files...", "lblMallForwarderStatus");

						AceSoft.RetailPlus.Forwarder.RLCDetails clsRLCDetails = new AceSoft.RetailPlus.Forwarder.RLCDetails();
						clsRLCDetails.TenantCode = RLC_CONFIG.TenantCode;
						clsRLCDetails.TenantName = RLC_CONFIG.TenantName;
						clsRLCDetails.OutputDirectory = RLC_CONFIG.OutputDirectory;
						clsRLCDetails.FTPIPAddress = CONFIG.FTPIPAddress;
						clsRLCDetails.FTPUsername = CONFIG.FTPUsername;
						clsRLCDetails.FTPPassword = CONFIG.FTPPassword;
						clsRLCDetails.FTPDirectory = CONFIG.FTPDirectory;

						AceSoft.RetailPlus.Forwarder.RLC clsRLC = new AceSoft.RetailPlus.Forwarder.RLC();
						clsRLC.RLCDetails = clsRLCDetails;
						bool bolCreateAndTransferFile = clsRLC.CreateAndTransferFile(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo, dteDateToProcess);

						if (bolCreateAndTransferFile)
						{ tmrRLC.Enabled = false; SetText("Success in sending file(s) to RLC server. Press [Ctrl+C] to close this notification.", "lblMallForwarderStatus"); }
						else
						{ tmrRLC.Enabled = true; SetText("ERROR!!! sending file(s) to RLC server. Press [Ctrl+C] to close this notification.", "lblMallForwarderStatus"); }

						clsTerminalReportHistory = new Data.TerminalReportHistory(mConnection, mTransaction);
                        mConnection = clsTerminalReportHistory.Connection; mTransaction = clsTerminalReportHistory.Transaction;

                        dteDateToProcess = clsTerminalReportHistory.getRLCDateLastInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo);
						clsTerminalReportHistory.CommitAndDispose();

						if (dteDateToProcess != DateTime.MinValue)
						{ goto Back; }
					}
					catch
                    { 
                        tmrRLC.Enabled = true;
                        SetText("ERROR!!! sending file(s) to RLC server. Press [Ctrl+C] to close this notification.", "lblMallForwarderStatus");
                    }
				}
			}
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, lblMallForwarderStatus.Text);
            }
		}
Пример #2
0
		private void ProcessMallForwarder(DateTime pvtDateToProcess, bool ShowSuccessMessageBox)
		{
			try
			{
				switch (CONFIG.MallCode.ToUpper())
				{
					case MallCodes.NA:
						break;
					case MallCodes.AYALA:
						AceSoft.RetailPlus.Forwarder.AyalaDetails clsAyalaDetails = new AceSoft.RetailPlus.Forwarder.AyalaDetails();
						clsAyalaDetails.TenantCode = AYALA_CONFIG.TenantCode;
						clsAyalaDetails.TenantName = AYALA_CONFIG.TenantName;
						clsAyalaDetails.OutputDirectory = AYALA_CONFIG.OutputDirectory;
						clsAyalaDetails.FTPIPAddress = CONFIG.FTPIPAddress;
						clsAyalaDetails.FTPUsername = CONFIG.FTPUsername;
						clsAyalaDetails.FTPPassword = CONFIG.FTPPassword;
						clsAyalaDetails.FTPDirectory = CONFIG.FTPDirectory;

						AceSoft.RetailPlus.Forwarder.Ayala clsAyala = new AceSoft.RetailPlus.Forwarder.Ayala();
						clsAyala.AyalaDetails = clsAyalaDetails;
						clsAyala.CreateAndTransferFile(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, pvtDateToProcess);
						clsAyala.CommitAndDispose();
						clsEvent.AddEventLn("Mall Forwarder: Done!", true);
						if (ShowSuccessMessageBox) MessageBox.Show("Sales file successfully sent to Ayala server.", "Mall Forwarder", MessageBoxButtons.OK, MessageBoxIcon.Information);
						break;
					case MallCodes.RLC:
						AceSoft.RetailPlus.Forwarder.RLCDetails clsRLCDetails = new AceSoft.RetailPlus.Forwarder.RLCDetails();
						clsRLCDetails.TenantCode = RLC_CONFIG.TenantCode;
						clsRLCDetails.TenantName = RLC_CONFIG.TenantName;
						clsRLCDetails.OutputDirectory = RLC_CONFIG.OutputDirectory;
						clsRLCDetails.FTPIPAddress = CONFIG.FTPIPAddress;
						clsRLCDetails.FTPUsername = CONFIG.FTPUsername;
						clsRLCDetails.FTPPassword = CONFIG.FTPPassword;
						clsRLCDetails.FTPDirectory = CONFIG.FTPDirectory;

						AceSoft.RetailPlus.Forwarder.RLC clsRLC = new AceSoft.RetailPlus.Forwarder.RLC();
						clsRLC.RLCDetails = clsRLCDetails;
						clsRLC.CreateAndTransferFile(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo, pvtDateToProcess);
						clsEvent.AddEventLn("Mall Forwarder: Done!", true);
						if (ShowSuccessMessageBox) MessageBox.Show("Sales file successfully sent to RLC server.", "Mall Forwarder", MessageBoxButtons.OK, MessageBoxIcon.Information);
						break;
					case MallCodes.FSI:
						AceSoft.RetailPlus.Forwarder.FSIDetails clsFSIDetails = new AceSoft.RetailPlus.Forwarder.FSIDetails();
						clsFSIDetails.TenantCode = FSI_CONFIG.TenantCode;
						clsFSIDetails.TenantName = FSI_CONFIG.TenantName;
						clsFSIDetails.OutputDirectory = FSI_CONFIG.OutputDirectory;
						clsFSIDetails.SalesTypeCode = FSI_CONFIG.SalesTypeCode;
						clsFSIDetails.FTPIPAddress = CONFIG.FTPIPAddress;
						clsFSIDetails.FTPUsername = CONFIG.FTPUsername;
						clsFSIDetails.FTPPassword = CONFIG.FTPPassword;
						clsFSIDetails.FTPDirectory = CONFIG.FTPDirectory;

						AceSoft.RetailPlus.Forwarder.FSI clsFSI = new AceSoft.RetailPlus.Forwarder.FSI();
						clsFSI.FSIDetails = clsFSIDetails;
						clsFSI.CreateAndTransferFile(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, pvtDateToProcess);
						clsEvent.AddEventLn("Mall Forwarder: Done!", true);
						if (ShowSuccessMessageBox) MessageBox.Show("Sales file successfully sent to FSI server.", "Mall Forwarder", MessageBoxButtons.OK, MessageBoxIcon.Information);
						break;
					default:
						MessageBox.Show("Sorry no applicable mall code for".PadRight(15) + ":" + CONFIG.MallCode, "Mall Forwarder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						break;
				}
			}
			catch (Exception ex)
			{
                InsertErrorLogToFile(ex, "ERROR!!! Mall Forwarder: " + CONFIG.MallCode.ToUpper());
				MessageBox.Show(ex.Message, "Mall Forwarder", MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
		}