Example #1
0
        public static void InsertAuditLog(Data.TerminalDetails TerminalDetails, string Username, AccessTypes AccessType, string Remarks)
        {
            Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
            clsAuditDetails.BranchID = TerminalDetails.BranchDetails.BranchID;
            clsAuditDetails.TerminalNo = TerminalDetails.TerminalNo;
            clsAuditDetails.ActivityDate = DateTime.Now;
            clsAuditDetails.User = Username;
            clsAuditDetails.IPAddress = System.Net.Dns.GetHostName();
            clsAuditDetails.Activity = AccessType.ToString("G");
            clsAuditDetails.Remarks = "FE:" + Remarks;

            Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
            clsAuditTrail.Insert(clsAuditDetails);
            clsAuditTrail.CommitAndDispose();
        }
Example #2
0
        public static void InsertAuditLog(Data.TerminalDetails TerminalDetails, string Username, AccessTypes AccessType, string Remarks)
        {
            Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
            clsAuditDetails.BranchID     = TerminalDetails.BranchDetails.BranchID;
            clsAuditDetails.TerminalNo   = TerminalDetails.TerminalNo;
            clsAuditDetails.ActivityDate = DateTime.Now;
            clsAuditDetails.User         = Username;
            clsAuditDetails.IPAddress    = System.Net.Dns.GetHostName();
            clsAuditDetails.Activity     = AccessType.ToString("G");
            clsAuditDetails.Remarks      = "FE:" + Remarks;

            Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
            clsAuditTrail.Insert(clsAuditDetails);
            clsAuditTrail.CommitAndDispose();
        }
Example #3
0
        private bool Delete()
        {
            bool   boRetValue = false;
            string stIDs      = "";

            foreach (DataListItem item in lstItem.Items)
            {
                HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
                if (chkList != null)
                {
                    if (chkList.Checked == true)
                    {
                        stIDs     += chkList.Value + ",";
                        boRetValue = true;
                    }
                }
            }
            if (boRetValue)
            {
                Products clsProduct = new Products();
                clsProduct.Delete(stIDs.Substring(0, stIDs.Length - 1), Convert.ToString(Session["Name"]));
                clsProduct.CommitAndDispose();

                Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();

                clsAuditDetails.ActivityDate = DateTime.Now;
                clsAuditDetails.User         = Convert.ToString(Session["Name"]);
                clsAuditDetails.IPAddress    = Request.UserHostAddress;
                clsAuditDetails.Activity     = "Products";
                clsAuditDetails.Remarks      = "Delete Product(s). IDs:'" + stIDs + "'";

                Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
                clsAuditTrail.Insert(clsAuditDetails);
                clsAuditTrail.CommitAndDispose();
            }

            return(boRetValue);
        }
Example #4
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(MainWnd_UIThreadException);

            Event clsEvent = new Event();

            clsEvent.AddEvent("starting.... loading splash screen...");
            SplashWnd appsplash = new SplashWnd();

            clsEvent.AddEventLn("Done!");

            appsplash.prgBar.Maximum = 100;
            appsplash.lblStatus.Text = "Checking OS Version... ";
            appsplash.prgBar.Value   = 10;
            appsplash.Show();
            appsplash.Refresh();

            // get the windows version
            clsEvent.AddEvent("Checking windows current version");
            OSVersion osVersion = OSInformation.getOSVersion();

            switch (osVersion)
            {
            case OSVersion.Windows95:
            case OSVersion.WindowsMe:
                clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System : '" + osVersion.ToString("G") + "' is not supported. Application will now close.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit(); return;

            case OSVersion.Windows98:
            case OSVersion.Windows98SecondEdition:
            case OSVersion.WindowsNT351:
            case OSVersion.WindowsNT4:
            case OSVersion.Windows2000:
            case OSVersion.WindowsXP:
            case OSVersion.WindowsVista:
            case OSVersion.Windows7:
                clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                break;

            case OSVersion.Unknown:
                System.OperatingSystem osInfo = System.Environment.OSVersion;
                clsEvent.AddEventLn(": Unidentified: Platform=" + osInfo.Platform.ToString() + " Major Version=" + osInfo.VersionString);
                clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System is unidentified by Retailplus Application. System will now close. Platform=" + osInfo.Platform.ToString() + " Version=" + osInfo.VersionString, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit(); return;
            }


            // get the running version
            appsplash.lblStatus.Text = "Checking application Version... ";
            appsplash.prgBar.Value   = 20;
            appsplash.Show();
            appsplash.Refresh();
            clsEvent.AddEvent("Checking application current version");
            Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            clsEvent.AddEventLn(":" + curVersion.ToString());

            #region CopySubGroupsImages

            // this should be available only for resto
            appsplash.lblStatus.Text = "Copying subgroup images from server... ";
            appsplash.prgBar.Value   = 25;
            getSubGroupImages();

            #endregion

            Version verNewVersion = GetLatestVersion();
            clsEvent.AddEventLn("latest version is " + verNewVersion.ToString(), true);
            // compare the versions
            if (curVersion.CompareTo(verNewVersion) < 0)
            {
                clsEvent.AddEventLn("system will now exit then download the latest version.", true);
                System.Diagnostics.Process.Start("RetailPlus.VersionChecker.exe", "RestoPlus.exe");
                Application.Exit();
                return;
            }
            clsEvent.AddEventLn("This application version is updated.", true);

            appsplash.lblStatus.Text = "Checking connections to database... ";
            appsplash.prgBar.Value   = 30;
            appsplash.Refresh();
            if (!IsDBAlive())
            {
                MessageBox.Show("FATAL ERROR Level 1.!!! Cannot connect to database. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.lblStatus.Text = "Checking Last Initialization of ZREAD... ";
            appsplash.prgBar.Value   = 50;
            appsplash.Show();
            appsplash.Refresh();
            if (!IsDateLastInitializationOK())
            {
                MessageBox.Show("FATAL ERROR Level 2.!!! System date is behind ZREAD last initialization date. Please adjust SYSTEM DATE!!!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.prgBar.Value   = 70;
            appsplash.lblStatus.Text = "Checking terminal if exist in the database... ";
            appsplash.Refresh();
            string ErrorMessage;
            if (!IsTerminalExist(out ErrorMessage))
            {
                MessageBox.Show(ErrorMessage, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.prgBar.Value   = 100;
            appsplash.lblStatus.Text = "Checking terminal if demo is expired... ";
            appsplash.Refresh();
            if (IsDemoExpired())
            {
                string stHDSeriano = Key.GetHDSerialNo();
                MessageBox.Show(
                    "This copy has been expired. Please contact your nearest software distributor" + Environment.NewLine +
                    "Or call RBS Sales @: " + Environment.NewLine +
                    "          Philippines: +63.947.3215979" + Environment.NewLine +
                    "          Philippines: +63.918.9390926" + Environment.NewLine +
                    "          Philippines: +632.998.7722" + Environment.NewLine +
                    "          Singapore: +658.6519601" + Environment.NewLine +
                    "Or email [email protected]" + Environment.NewLine +
                    "Your HD Serial No. is: " + stHDSeriano, "RetailPlus™ Demo Version", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                Application.Exit();
                return;
            }

            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.Dispose();
            appsplash.Close();

            Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
            clsAuditDetails.BranchID     = Constants.TerminalBranchID;
            clsAuditDetails.TerminalNo   = CompanyDetails.TerminalNo;
            clsAuditDetails.ActivityDate = DateTime.Now;
            clsAuditDetails.User         = "******";
            clsAuditDetails.IPAddress    = System.Net.Dns.GetHostName();
            clsAuditDetails.Activity     = "Open Terminal";
            clsAuditDetails.Remarks      = "FE:" + "Open terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString();

            Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
            clsAuditTrail.Insert(clsAuditDetails);

            Data.Terminal        clsTerminal        = new Data.Terminal(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.TerminalDetails clsTerminalDetails = clsTerminal.Details(Constants.TerminalBranchID, CompanyDetails.TerminalNo);

            //overwrite the companydetails from the database
            Data.SysConfig        clsSysConfig        = new Data.SysConfig(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.SysConfigDetails clsSysConfigDetails = clsSysConfig.get_SysConfigDetails();
            clsAuditTrail.CommitAndDispose();

            CompanyDetails.CompanyCode = string.IsNullOrEmpty(clsSysConfigDetails.CompanyCode) ? CompanyDetails.CompanyCode : clsSysConfigDetails.CompanyCode;
            CompanyDetails.CompanyName = string.IsNullOrEmpty(clsSysConfigDetails.CompanyName) ? CompanyDetails.CompanyName : clsSysConfigDetails.CompanyName;
            CompanyDetails.Currency    = string.IsNullOrEmpty(clsSysConfigDetails.Currency) ? CompanyDetails.Currency : clsSysConfigDetails.Currency;
            CompanyDetails.TIN         = string.IsNullOrEmpty(clsSysConfigDetails.TIN) ? CompanyDetails.TIN : clsSysConfigDetails.TIN;

            CompanyDetails.Address1     = string.IsNullOrEmpty(clsSysConfigDetails.Address1) ? CompanyDetails.Address1 : clsSysConfigDetails.Address1;
            CompanyDetails.Address2     = string.IsNullOrEmpty(clsSysConfigDetails.Address2) ? CompanyDetails.Address2 : clsSysConfigDetails.Address2;
            CompanyDetails.City         = string.IsNullOrEmpty(clsSysConfigDetails.City) ? CompanyDetails.City : clsSysConfigDetails.City;
            CompanyDetails.State        = string.IsNullOrEmpty(clsSysConfigDetails.State) ? CompanyDetails.State : clsSysConfigDetails.State;
            CompanyDetails.Zip          = string.IsNullOrEmpty(clsSysConfigDetails.Zip) ? CompanyDetails.Zip : clsSysConfigDetails.Zip;
            CompanyDetails.Country      = string.IsNullOrEmpty(clsSysConfigDetails.Country) ? CompanyDetails.Country : clsSysConfigDetails.Country;
            CompanyDetails.OfficePhone  = string.IsNullOrEmpty(clsSysConfigDetails.OfficePhone) ? CompanyDetails.OfficePhone : clsSysConfigDetails.OfficePhone;
            CompanyDetails.DirectPhone  = string.IsNullOrEmpty(clsSysConfigDetails.DirectPhone) ? CompanyDetails.DirectPhone : clsSysConfigDetails.DirectPhone;
            CompanyDetails.FaxPhone     = string.IsNullOrEmpty(clsSysConfigDetails.FaxPhone) ? CompanyDetails.FaxPhone : clsSysConfigDetails.FaxPhone;
            CompanyDetails.MobilePhone  = string.IsNullOrEmpty(clsSysConfigDetails.MobilePhone) ? CompanyDetails.MobilePhone : clsSysConfigDetails.MobilePhone;
            CompanyDetails.EmailAddress = string.IsNullOrEmpty(clsSysConfigDetails.EmailAddress) ? CompanyDetails.EmailAddress : clsSysConfigDetails.EmailAddress;
            CompanyDetails.WebSite      = string.IsNullOrEmpty(clsSysConfigDetails.WebSite) ? CompanyDetails.WebSite : clsSysConfigDetails.WebSite;

            try
            {
                clsEvent.AddEventLn("Running Main Window.", true);

                MainRestoWnd appmain = new MainRestoWnd();
                appmain.Text = " RestoPlus ™";

                /********************************
                 * Added December 21, 2008
                 * Enable 2 windows in one computer
                 * *****************************/
                try
                {
                    if (clsTerminalDetails.MultiInstanceEnabled)
                    {
                        Application.Run(appmain);
                    }
                    else
                    {
                        SingleInstance.Run(appmain);
                    }
                }
                catch (Exception exMain)
                {
                    clsEvent.AddEventLn("System has excountered an error while loading main screen!" + Environment.NewLine + exMain.ToString(), true);
                    clsEvent.AddEventLn("System has been exited!", true);
                    throw (exMain);
                }

                clsEvent.AddEventLn("System has been exited!", true);

                clsAuditDetails              = new Security.AuditTrailDetails();
                clsAuditDetails.BranchID     = Constants.TerminalBranchID;
                clsAuditDetails.TerminalNo   = CompanyDetails.TerminalNo;
                clsAuditDetails.ActivityDate = DateTime.Now;
                clsAuditDetails.User         = "******";
                clsAuditDetails.IPAddress    = System.Net.Dns.GetHostName();
                clsAuditDetails.Activity     = "Close Terminal";
                clsAuditDetails.Remarks      = "FE:" + "Close terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString() + ".";

                clsAuditTrail = new Security.AuditTrail();
                clsAuditTrail.Insert(clsAuditDetails);
                clsAuditTrail.CommitAndDispose();
            }
            catch (Exception ex)
            {
                clsEvent.AddErrorEventLn(ex);

                MessageBox.Show("FATAL ERROR Level 1.!!! An internal error has occurred in the system. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				Products clsProduct = new Products();
				clsProduct.Delete( stIDs.Substring(0,stIDs.Length-1), Convert.ToString(Session["Name"]));
				clsProduct.CommitAndDispose();

				Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();

				clsAuditDetails.ActivityDate = DateTime.Now;
				clsAuditDetails.User = Convert.ToString(Session["Name"]);
				clsAuditDetails.IPAddress = Request.UserHostAddress;
				clsAuditDetails.Activity = "Products";
				clsAuditDetails.Remarks = "Delete Product(s). IDs:'" + stIDs + "'";

				Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
				clsAuditTrail.Insert(clsAuditDetails);
				clsAuditTrail.CommitAndDispose();
			}

			return boRetValue;
		}
Example #6
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(MainWnd_UIThreadException);

            Event clsEvent = new Event();
            clsEvent.AddEvent("starting.... loading splash screen...");
            SplashWnd appsplash = new SplashWnd();
            clsEvent.AddEventLn("Done!");

            appsplash.prgBar.Maximum = 100;
            appsplash.lblStatus.Text = "Checking OS Version... ";
            appsplash.prgBar.Value = 10;
            appsplash.Show();
            appsplash.Refresh();

            // get the windows version
            clsEvent.AddEvent("Checking windows current version");
            OSVersion osVersion = OSInformation.getOSVersion();
            switch (osVersion)
            {
                case OSVersion.Windows95:
                case OSVersion.WindowsMe:
                    clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                    clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                    MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System : '" + osVersion.ToString("G") + "' is not supported. Application will now close.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Application.Exit(); return;
                case OSVersion.Windows98:
                case OSVersion.Windows98SecondEdition:
                case OSVersion.WindowsNT351:
                case OSVersion.WindowsNT4:
                case OSVersion.Windows2000:
                case OSVersion.WindowsXP:
                case OSVersion.WindowsVista:
                case OSVersion.Windows7:
                    clsEvent.AddEventLn(": " + osVersion.ToString("G"));
                    break;
                case OSVersion.Unknown:
                    System.OperatingSystem osInfo = System.Environment.OSVersion;
                    clsEvent.AddEventLn(": Unidentified: Platform=" + osInfo.Platform.ToString() + " Major Version=" + osInfo.VersionString);
                    clsEvent.AddEventLn("This OS platform is not supported. Application will now close.");
                    MessageBox.Show("FATAL ERROR Level 1.!!! The Operating System is unidentified by Retailplus Application. System will now close. Platform=" + osInfo.Platform.ToString() + " Version=" + osInfo.VersionString, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Application.Exit(); return;
            }


            // get the running version
            appsplash.lblStatus.Text = "Checking application Version... ";
            appsplash.prgBar.Value = 20;
            appsplash.Show();
            appsplash.Refresh();
            clsEvent.AddEvent("Checking application current version");
            Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            clsEvent.AddEventLn(":" + curVersion.ToString());

            #region CopySubGroupsImages

            // this should be available only for resto
            appsplash.lblStatus.Text = "Copying subgroup images from server... ";
            appsplash.prgBar.Value = 25;
            getSubGroupImages();

            #endregion

            Version verNewVersion = GetLatestVersion();
            clsEvent.AddEventLn("latest version is " + verNewVersion.ToString(), true);
            // compare the versions
            if (curVersion.CompareTo(verNewVersion) < 0)
            {
                clsEvent.AddEventLn("system will now exit then download the latest version.", true);
                System.Diagnostics.Process.Start("RetailPlus.VersionChecker.exe", "RestoPlus.exe");
                Application.Exit();
                return;
            }
            clsEvent.AddEventLn("This application version is updated.", true);

            appsplash.lblStatus.Text = "Checking connections to database... ";
            appsplash.prgBar.Value = 30;
            appsplash.Refresh();
            if (!IsDBAlive())
            {
                MessageBox.Show("FATAL ERROR Level 1.!!! Cannot connect to database. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.lblStatus.Text = "Checking Last Initialization of ZREAD... ";
            appsplash.prgBar.Value = 50;
            appsplash.Show();
            appsplash.Refresh();
            if (!IsDateLastInitializationOK())
            {
                MessageBox.Show("FATAL ERROR Level 2.!!! System date is behind ZREAD last initialization date. Please adjust SYSTEM DATE!!!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();

            appsplash.prgBar.Value = 70;
            appsplash.lblStatus.Text = "Checking terminal if exist in the database... ";
            appsplash.Refresh();
            string ErrorMessage;
            if (!IsTerminalExist(out ErrorMessage))
            {
                MessageBox.Show(ErrorMessage, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.prgBar.Value = 100;
            appsplash.lblStatus.Text = "Checking terminal if demo is expired... ";
            appsplash.Refresh();
            if (IsDemoExpired())
            {
                string stHDSeriano = Key.GetHDSerialNo();
                MessageBox.Show(
                    "This copy has been expired. Please contact your nearest software distributor" + Environment.NewLine +
                    "Or call RBS Sales @: " + Environment.NewLine +
                    "          Philippines: +63.947.3215979" + Environment.NewLine +
                    "          Philippines: +63.918.9390926" + Environment.NewLine +
                    "          Philippines: +632.998.7722" + Environment.NewLine +
                    "          Singapore: +658.6519601" + Environment.NewLine +
                    "Or email [email protected]" + Environment.NewLine +
                    "Your HD Serial No. is: " + stHDSeriano, "RetailPlus™ Demo Version", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                Application.Exit();
                return;
            }

            appsplash.lblStatus.Text += "DONE!";
            appsplash.Refresh();
            appsplash.Dispose();
            appsplash.Close();

            Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
            clsAuditDetails.BranchID = Constants.TerminalBranchID;
            clsAuditDetails.TerminalNo = CompanyDetails.TerminalNo;
            clsAuditDetails.ActivityDate = DateTime.Now;
            clsAuditDetails.User = "******";
            clsAuditDetails.IPAddress = System.Net.Dns.GetHostName();
            clsAuditDetails.Activity = "Open Terminal";
            clsAuditDetails.Remarks = "FE:" + "Open terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString();

            Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
            clsAuditTrail.Insert(clsAuditDetails);

            Data.Terminal clsTerminal = new Data.Terminal(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.TerminalDetails clsTerminalDetails = clsTerminal.Details(Constants.TerminalBranchID, CompanyDetails.TerminalNo);

            //overwrite the companydetails from the database
            Data.SysConfig clsSysConfig = new Data.SysConfig(clsAuditTrail.Connection, clsAuditTrail.Transaction);
            Data.SysConfigDetails clsSysConfigDetails = clsSysConfig.get_SysConfigDetails();
            clsAuditTrail.CommitAndDispose();

            CompanyDetails.CompanyCode = string.IsNullOrEmpty(clsSysConfigDetails.CompanyCode) ? CompanyDetails.CompanyCode : clsSysConfigDetails.CompanyCode;
            CompanyDetails.CompanyName = string.IsNullOrEmpty(clsSysConfigDetails.CompanyName) ? CompanyDetails.CompanyName : clsSysConfigDetails.CompanyName;
            CompanyDetails.Currency = string.IsNullOrEmpty(clsSysConfigDetails.Currency) ? CompanyDetails.Currency : clsSysConfigDetails.Currency;
            CompanyDetails.TIN = string.IsNullOrEmpty(clsSysConfigDetails.TIN) ? CompanyDetails.TIN : clsSysConfigDetails.TIN;

            CompanyDetails.Address1 = string.IsNullOrEmpty(clsSysConfigDetails.Address1) ? CompanyDetails.Address1 : clsSysConfigDetails.Address1;
            CompanyDetails.Address2 = string.IsNullOrEmpty(clsSysConfigDetails.Address2) ? CompanyDetails.Address2 : clsSysConfigDetails.Address2;
            CompanyDetails.City = string.IsNullOrEmpty(clsSysConfigDetails.City) ? CompanyDetails.City : clsSysConfigDetails.City;
            CompanyDetails.State = string.IsNullOrEmpty(clsSysConfigDetails.State) ? CompanyDetails.State : clsSysConfigDetails.State;
            CompanyDetails.Zip = string.IsNullOrEmpty(clsSysConfigDetails.Zip) ? CompanyDetails.Zip : clsSysConfigDetails.Zip;
            CompanyDetails.Country = string.IsNullOrEmpty(clsSysConfigDetails.Country) ? CompanyDetails.Country : clsSysConfigDetails.Country;
            CompanyDetails.OfficePhone = string.IsNullOrEmpty(clsSysConfigDetails.OfficePhone) ? CompanyDetails.OfficePhone : clsSysConfigDetails.OfficePhone;
            CompanyDetails.DirectPhone = string.IsNullOrEmpty(clsSysConfigDetails.DirectPhone) ? CompanyDetails.DirectPhone : clsSysConfigDetails.DirectPhone;
            CompanyDetails.FaxPhone = string.IsNullOrEmpty(clsSysConfigDetails.FaxPhone) ? CompanyDetails.FaxPhone : clsSysConfigDetails.FaxPhone;
            CompanyDetails.MobilePhone = string.IsNullOrEmpty(clsSysConfigDetails.MobilePhone) ? CompanyDetails.MobilePhone : clsSysConfigDetails.MobilePhone;
            CompanyDetails.EmailAddress = string.IsNullOrEmpty(clsSysConfigDetails.EmailAddress) ? CompanyDetails.EmailAddress : clsSysConfigDetails.EmailAddress;
            CompanyDetails.WebSite = string.IsNullOrEmpty(clsSysConfigDetails.WebSite) ? CompanyDetails.WebSite : clsSysConfigDetails.WebSite;

            try
            {
                clsEvent.AddEventLn("Running Main Window.", true);

                MainRestoWnd appmain = new MainRestoWnd();
                appmain.Text = " RestoPlus ™";
                /********************************
                 * Added December 21, 2008
                 * Enable 2 windows in one computer
                 * *****************************/
                try
                {
                    if (clsTerminalDetails.MultiInstanceEnabled)
                    { Application.Run(appmain); }
                    else
                    { SingleInstance.Run(appmain); }
                }
                catch (Exception exMain)
                {
                    clsEvent.AddEventLn("System has excountered an error while loading main screen!" + Environment.NewLine + exMain.ToString(), true);
                    clsEvent.AddEventLn("System has been exited!", true);
                    throw (exMain);
                }

                clsEvent.AddEventLn("System has been exited!", true);

                clsAuditDetails = new Security.AuditTrailDetails();
                clsAuditDetails.BranchID = Constants.TerminalBranchID;
                clsAuditDetails.TerminalNo = CompanyDetails.TerminalNo;
                clsAuditDetails.ActivityDate = DateTime.Now;
                clsAuditDetails.User = "******";
                clsAuditDetails.IPAddress = System.Net.Dns.GetHostName();
                clsAuditDetails.Activity = "Close Terminal";
                clsAuditDetails.Remarks = "FE:" + "Close terminal no.:'" + CompanyDetails.TerminalNo + "' @ Branch:" + Constants.TerminalBranchID.ToString() + ".";

                clsAuditTrail = new Security.AuditTrail();
                clsAuditTrail.Insert(clsAuditDetails);
                clsAuditTrail.CommitAndDispose();

            }
            catch (Exception ex)
            {
                clsEvent.AddErrorEventLn(ex);

                MessageBox.Show("FATAL ERROR Level 1.!!! An internal error has occurred in the system. Please consult your system administrator immediately...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }