Ejemplo n.º 1
0
        private void LoadOptions()
        {
            cboBranch.Items.Clear();
            Data.Branch clsBranch = new Data.Branch();
            foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: TerminalDetails.TerminalNo).Rows)
            {
                cboBranch.Items.Add(dr["BranchCode"]);
            }

            Int32 iBranchCount = new Data.Terminal(clsBranch.Connection, clsBranch.Transaction).BranchCount(txtTerminalNo.Text);

            clsBranch.CommitAndDispose();

            if (iBranchCount == 0)
            {
                cboBranch.Items.Add("No Applicable Branch");
            }
            else if (iBranchCount != 0)
            {
                cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                cboBranch.Enabled       = false;
            }
            else
            {
                cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                cboBranch.Enabled       = true;
            }

            txtTerminalName.Text = TerminalDetails.TerminalName;
            txtTerminalNo.Text   = TerminalDetails.TerminalNo;
        }
Ejemplo n.º 2
0
        private static bool IsDBAlive()
        {
            Event clsEvent = new Event();

            try
            {
                clsEvent.AddEvent("Checking connections to server.");
                if (IPAddress.IsOpen(AceSoft.RetailPlus.DBConnection.ServerIP(), DBConnection.DBPort()) == false)
                {
                    clsEvent.AddEvent("Cannot connect to server please check.");
                    return(false);
                }

                clsEvent.AddEvent("Checking connections to database.");

                Data.Database clsDatabase = new Data.Database();
                bool          boIsDBAlive = clsDatabase.IsAlive();
                clsEvent.AddEventLn("Done! Connected to " + clsDatabase.Connection.ConnectionString, false);

                clsEvent.AddEventLn("Updating version to " + Application.ProductVersion, true);
                Data.Terminal clsTerminal = new Data.Terminal(clsDatabase.Connection, clsDatabase.Transaction);
                clsTerminal.UpdateFEVersion(Constants.TerminalBranchID, CompanyDetails.TerminalNo, Application.ProductVersion);

                clsDatabase.CommitAndDispose();

                return(boIsDBAlive);
            }
            catch (Exception ex)
            {
                clsEvent.AddErrorEventLn(ex);
                return(false);
            }
        }
Ejemplo n.º 3
0
        private void SetDataSource(ReportDocument Report)
        {
            ReportDataset rptds = new ReportDataset();

            Data.TerminalReport  clsTerminalReport  = new Data.TerminalReport();
            Data.Terminal        clsTerminal        = new Data.Terminal(clsTerminalReport.Connection, clsTerminalReport.Transaction);
            Data.TerminalDetails clsTerminalDetails = clsTerminal.Details(txtTerminalNo.Text);
            clsTerminalReport.SyncTransactionSales(clsTerminalDetails.BranchDetails.BranchID, txtTerminalNo.Text);
            System.Data.DataTable dt = clsTerminalReport.List(txtTerminalNo.Text);
            clsTerminalReport.CommitAndDispose();

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.TerminalReport.NewRow();

                foreach (DataColumn dc in rptds.TerminalReport.Columns)
                {
                    drNew[dc] = dr[dc.ColumnName];
                }

                rptds.TerminalReport.Rows.Add(drNew);
            }

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            const string           defaultHeading         = "Login";
            const string           defaultTitle           = "RetailPlus System";
            const SearchCategoryID defaultAllSourcesIndex = SearchCategoryID.AllSources;

            LargeHeading.Text = defaultHeading;

            SiteTitle.Title = defaultTitle;

            HorizontalNavBar.PageNavigatorid = HorizontalNavID.Home;

            RightBodySectionSearch.SearchIDSelectedItem = defaultAllSourcesIndex;

            PageLevelError.Visible = false;

//			Data.TerminalReport clsTerminalReport = new Data.TerminalReport();
//			Data.TerminalReportDetails details = clsTerminalReport.Details(CompanyDetails.TerminalNo);
//			clsTerminalReport.CommitAndDispose();
//
//			if (Convert.ToInt64(details.EndingTransactionNo) >= 50)
//			{
//				Session["ErrorCurrentExecutionFilePath"] = Request.CurrentExecutionFilePath;
//				Session["ErrMessage"] = Constants.DEMO_EXPIRED_MESSAGE;
//				Session["ErrorMessage"] = Constants.DEMO_EXPIRED_MESSAGE;
//				Session["ErrorSource"] = Constants.DEMO_EXPIRED_HEADER;
//				Session["ErrorExceptionType"] = null;
//				Session["ErrorStackTrace"] = null;
//
//				Response.Redirect("/RetailPlus/GenericError.aspx");
//			}
//			else
//			{
            //Check if a user is currently login

            if (Session["UID"] != null)
            {
                Login.AssignUserSession(Convert.ToInt16(Session["UID"]));
                Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx");
            }
            else
            {
                HorizontalNavBar.Visible       = false;
                RightBodySectionSearch.Visible = false;

                Data.Terminal clsTerminal = new Data.Terminal();
                clsTerminal.UpdateBEVersion("2.0.1.5");
                clsTerminal.CommitAndDispose();
            }
//			}
        }
Ejemplo n.º 5
0
        private void txtTerminalNo_TextChanged(object sender, EventArgs e)
        {
            try
            {
                Int32 iTerminalNo = Int32.Parse(txtTerminalNo.Text);
                if (iTerminalNo > 0)
                {
                    Data.Terminal clsTerminal = new Data.Terminal();
                    TerminalDetails = clsTerminal.Details(txtTerminalNo.Text);
                    BranchDetails   = TerminalDetails.BranchDetails;
                    Int32 iBranchCount = clsTerminal.BranchCount(txtTerminalNo.Text);

                    cboBranch.Items.Clear();
                    Data.Branch clsBranch = new Data.Branch(clsTerminal.Connection, clsTerminal.Transaction);
                    foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: txtTerminalNo.Text).Rows)
                    {
                        cboBranch.Items.Add(dr["BranchCode"]);
                    }
                    clsTerminal.CommitAndDispose();

                    if (iBranchCount == 0)
                    {
                        cboBranch.Items.Add("No Applicable Branch");
                    }
                    else if (iBranchCount == 1)
                    {
                        cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                        cboBranch.Enabled       = false;
                    }
                    else
                    {
                        cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                        cboBranch.Enabled       = true;
                    }

                    txtTerminalName.Text = TerminalDetails.TerminalName;
                }
            }
            catch { }
        }
Ejemplo n.º 6
0
        private void txtTerminalNo_TextChanged(object sender, EventArgs e)
        {
            try
            {
                Int32 iTerminalNo = Int32.Parse(txtTerminalNo.Text);
                if (iTerminalNo > 0)
                {
                    Data.Terminal clsTerminal = new Data.Terminal();
                    TerminalDetails = clsTerminal.Details(txtTerminalNo.Text);
                    BranchDetails = TerminalDetails.BranchDetails;
                    Int32 iBranchCount = clsTerminal.BranchCount(txtTerminalNo.Text);

                    cboBranch.Items.Clear();
                    Data.Branch clsBranch = new Data.Branch(clsTerminal.Connection, clsTerminal.Transaction);
                    foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: txtTerminalNo.Text).Rows)
                    {
                        cboBranch.Items.Add(dr["BranchCode"]);
                    }
                    clsTerminal.CommitAndDispose();

                    if (iBranchCount == 0)
                        cboBranch.Items.Add("No Applicable Branch");
                    else if (iBranchCount == 1)
                    {
                        cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                        cboBranch.Enabled = false;
                    }
                    else
                    {
                        cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                        cboBranch.Enabled = true;
                    }

                    txtTerminalName.Text = TerminalDetails.TerminalName;
                }
            }
            catch { }
        }
Ejemplo n.º 7
0
        private void cmdEnter_Click(object sender, EventArgs e)
        {
            Data.Terminal clsTerminal = new Data.Terminal();
            TerminalDetails = clsTerminal.Details(txtTerminalNo.Text);

            BranchDetails = TerminalDetails.BranchDetails;

            clsTerminal.CommitAndDispose();

            if (MessageBox.Show("This computer will be configured as TerminalNo: " + txtTerminalNo.Text + " Branch:" + BranchDetails.BranchCode + "-" + BranchDetails.BranchName + ". Sales will be added to " + TerminalDetails.TerminalName + " and Inventory will be deducted to this as well." + Environment.NewLine +
                                "Are you sure you want to continue?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            if (TerminalDetails.TerminalID == 0)
            {
                MessageBox.Show("Sorry the TerminalNo does not belong to branch: " + BranchDetails.BranchCode + "-" + BranchDetails.BranchName + ". Please consult your system administrator", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Result = System.Windows.Forms.DialogResult.OK;
            this.Hide();
        }
Ejemplo n.º 8
0
        private void LoadOptions()
        {
            cboBranch.Items.Clear();
            Data.Branch clsBranch = new Data.Branch();
            foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: TerminalDetails.TerminalNo).Rows)
            {
                cboBranch.Items.Add(dr["BranchCode"]);
            }

            Int32 iBranchCount = new Data.Terminal(clsBranch.Connection, clsBranch.Transaction).BranchCount(txtTerminalNo.Text);

            clsBranch.CommitAndDispose();

            if (iBranchCount == 0)
            {
                cboBranch.Items.Add("No Applicable Branch");
            }
            else if (iBranchCount != 0)
            {
                cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                cboBranch.Enabled = false;
            }
            else
            {
                cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode);
                cboBranch.Enabled = true;
            }

            txtTerminalName.Text = TerminalDetails.TerminalName;
            txtTerminalNo.Text = TerminalDetails.TerminalNo;
        }
Ejemplo n.º 9
0
        private void cmdEnter_Click(object sender, EventArgs e)
        {
            Data.Terminal clsTerminal = new Data.Terminal();
            TerminalDetails = clsTerminal.Details(txtTerminalNo.Text);

            BranchDetails = TerminalDetails.BranchDetails;

            clsTerminal.CommitAndDispose();

            if (MessageBox.Show("This computer will be configured as TerminalNo: " + txtTerminalNo.Text + " Branch:" + BranchDetails.BranchCode + "-" + BranchDetails.BranchName + ". Sales will be added to " + TerminalDetails.TerminalName + " and Inventory will be deducted to this as well." + Environment.NewLine +
                "Are you sure you want to continue?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            if (TerminalDetails.TerminalID == 0)
            {
                MessageBox.Show("Sorry the TerminalNo does not belong to branch: " + BranchDetails.BranchCode + "-" + BranchDetails.BranchName + ". Please consult your system administrator", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Result = System.Windows.Forms.DialogResult.OK;
            this.Hide();
        }
Ejemplo n.º 10
0
        public void InitializeAllZreadWithSameORSeries(bool boWithOutTF)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                Data.Terminal clsTerminal = new Data.Terminal(mConnection, mTransaction);
                mConnection = clsTerminal.Connection; mTransaction = clsTerminal.Transaction;

                Data.TerminalReport clsTerminalReport = new Data.TerminalReport(mConnection, mTransaction);
                mConnection = clsTerminalReport.Connection; mTransaction = clsTerminalReport.Transaction;

                AccessUser clsUser = new AccessUser(mConnection, mTransaction);
                mConnection = clsUser.Connection; mTransaction = clsUser.Transaction;

                System.Data.DataTable dt = clsTerminal.ListORSeries(mclsTerminalDetails.ORSeriesTerminalNo);

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Int32 iBranchID = Int32.Parse(dr["BranchID"].ToString());
                    string stTerminalNo = dr["TerminalNo"].ToString();

                    clsEvent.AddEventLn("Getting Terminal Info BranchID: " + iBranchID.ToString() + " Terminalno:" + stTerminalNo, true);

                    mclsTerminalDetails = clsTerminal.Details(iBranchID, stTerminalNo);
                    mclsSalesTransactionDetails.CashierID = clsTerminal.getLastLoggedCashierID(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo);

                    if (mclsSalesTransactionDetails.CashierID == 0)
                        mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag);

                    AccessUserDetails details = clsUser.Details(mclsSalesTransactionDetails.CashierID);

                    mclsSalesTransactionDetails.CashierName = details.Name;

                    if (IsDateLastInitializationOK(false))
                    {
                        try
                        {
                            clsEvent.AddEvent("[" + lblCashier.Text + "] Initializing ZReading.", true);
                            PrintZRead(false);

                            // Dec 01, 2008      Lemuel E. Aceron
                            // added the IsCashCountInitialized for
                            // 1 time Cash count every printing of report.
                            clsTerminal.UpdateIsCashCountInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, false);

                            //initialize Z-Read
                            clsTerminalReport.InitializeZRead(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierName, Constants.C_DATE_MIN_VALUE, boWithOutTF);

                            InsertAuditLog(AccessTypes.InitializeZRead, "Initialize Z-Read." + " [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo);

                            DateTime dteMAXDateLastInitialized = DateTime.MinValue;

                            // May 21, 2009      Lemuel E. Aceron
                            // added the for auto FTP of file for RLC
                            // get the maxdatelastinitialized
                            if (CONFIG.MallCode.ToUpper() == MallCodes.RLC)
                            {
                                Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(mConnection, mTransaction);
                                mConnection = clsTerminalReportHistory.Connection; mTransaction = clsTerminalReportHistory.Transaction;

                                dteMAXDateLastInitialized = clsTerminalReportHistory.MINDateLastInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, DateTime.Now);
                            }

                            clsEvent.AddEventLn("Done!", true);

                            MessageBox.Show("Z-Read has been initialized for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo + "...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            // May 21, 2009      Lemuel E. Aceron
                            // added the for auto FTP of file for RLC
                            // send the data to RLC
                            if (CONFIG.MallCode.ToUpper() == MallCodes.RLC)
                                ProcessMallForwarder(dteMAXDateLastInitialized, true);
                        }
                        catch (Exception ex)
                        {
                            InsertErrorLogToFile(ex, "ERRROR!!! Initializing ZREAD for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo);
                        }
                    }
                }

                clsTerminal.CommitAndDispose();
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERRROR!!! Initializing ALL ZREAD [ORSeriesBranchID]:" + mclsTerminalDetails.ORSeriesBranchID.ToString() + " [ORSeriesTerminalNo]" + mclsTerminalDetails.ORSeriesTerminalNo);
            }

            // 23Mar2015 : Needed to do this
            mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag);
            mclsSalesTransactionDetails.CashierName = lblCashier.Text;
        }
Ejemplo n.º 11
0
        public RegistrationType IsDemoExpired(out string SerialNumber)
        {
            SerialNumber = null;
            try
            {
                RegistrationType regIsDemoExpired = RegistrationType.DEMO_Unexpired;

                SerialNumber = GetHDSerialNo();

                if (SerialNumber == "W50SJSHQ" || SerialNumber == "K834T9A2BJNB" || SerialNumber == "K10HT77258WN" || SerialNumber == "587OCI98T" || SerialNumber == "MRG3W9KKH9S45H" || SerialNumber == "9546305796063968058" || SerialNumber == "9VP7QL84")
                {
                    // K10HT77258WN - Lemuel
                    // 587OCI98T - Darius
                    // MRG3W9KKH9S45H - Rico
                    // 9546305796063968058 - Grace
                    // 9VP7QL84 - Lemuel
                    // WD-WXTY08TPJ153
                    return(RegistrationType.Registered);
                }

                try
                {
                    Data.Terminal clsTerminal = new Data.Terminal();
                    string        cipherText  = clsTerminal.getTerminalKey(SerialNumber);
                    clsTerminal.CommitAndDispose();

                    if (cipherText != string.Empty)
                    {
                        string plainText = CompanyDetails.CompanyCode + SerialNumber.ToString().Trim(); // original plaintext
                        //string  cipherText = System.Configuration.ConfigurationManager.AppSettings["RegistrationKey"].ToString();	// encrypted text
                        string passPhrase = CompanyDetails.TIN;                                         // can be any string
                        string initVector = "%@skmelaT3rsh1t!";                                         // must be 16 bytes

                        // Before encrypting data, we will append plain text to a random
                        // salt value, which will be between 4 and 8 bytes long (implicitly
                        // used defaults).
                        AceSoft.Cryptor clsCryptor = new AceSoft.Cryptor(passPhrase, initVector);

                        if (plainText == clsCryptor.Decrypt(cipherText))
                        {
                            return(RegistrationType.Registered);
                        }
                    }
                }
                catch { }

                Data.TerminalReport clsTerminalReport = new Data.TerminalReport();
                string EndingTransactionNo            = clsTerminalReport.EndingTransactioNo(Constants.TerminalBranchID, CompanyDetails.TerminalNo);
                clsTerminalReport.CommitAndDispose();

                if (Convert.ToInt64(EndingTransactionNo) > 1000)
                {
                    regIsDemoExpired = RegistrationType.DEMO_Expired;
                }

                return(regIsDemoExpired);
            }
            catch (Exception ex)
            {
                SerialNumber = ex.ToString();
                return(RegistrationType.Error);
            }
        }
Ejemplo n.º 12
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();
            }
        }
Ejemplo n.º 13
0
		private void LoadOptions()
		{
			try
			{
                clsEvent.AddEvent("Loading transaction defaults...");

                Cursor.Current = Cursors.WaitCursor;

                this.KeyPreview = true;

                lblCurrency.Text = CompanyDetails.Currency;
				lblTransNo.Text = "READY...";
				lblCustomer.Text = Constants.C_RETAILPLUS_CUSTOMER;
				lblCustomer.Tag = Constants.C_RETAILPLUS_CUSTOMERID.ToString();
				lblAgent.Text = Constants.C_RETAILPLUS_AGENT;
				lblAgent.Tag = Constants.C_RETAILPLUS_AGENTID.ToString();
				lblAgentPositionDepartment.Text = Constants.C_RETAILPLUS_AGENT_POSITIONNAME;
				lblAgentPositionDepartment.Tag = Constants.C_RETAILPLUS_AGENT_DEPARTMENT_NAME;
				grpItems.Text = "Served by: " + Constants.C_RETAILPLUS_WAITER;
				grpItems.Tag = Constants.C_RETAILPLUS_WAITERID.ToString();
				lblDescription.Text = "Description";
				lblCategory.Text = "Category";
				lblProperties.Text = "Property";
				lblTransDate.Text = DateTime.Now.ToString("MMM. dd, yyyy hh:mm:ss tt");
				lblSubTotal.Text = "0.00";
				lblTransDiscount.Text = "Less 0% / 0.00";
				lblTransDiscount.Tag = DiscountTypes.NotApplicable.ToString("d");

				if (mclsTerminalDetails.WithRestaurantFeatures)
				{ lblSubtotalName.Text = "SUBTOTAL:"; lblOrderType.Visible = true; lblOrderType.Text = OrderTypes.DineIn.ToString("G").ToUpper();}
				else
				{ lblSubtotalName.Text = "SUBTOTAL"; lblOrderType.Visible = false; lblOrderType.Text = OrderTypes.DineIn.ToString("G").ToUpper(); }

				lblMessage.Text = " Your suggestive selling message and/or description";
				lblTransCharge.Text = lblTransCharge.Text = "Plus 0% / 0.00";
				txtBarCode.Text = "";
                lblConsignment.Visible = false;

				mboIsRefund = false;
                mboDoNotPrintTransactionDate = false;
				//mboIsDiscountAuthorized = false;

				mclsSalesTransactionDetails = new Data.SalesTransactionDetails();
                mclsSalesTransactionDetails.TransactionItemsList = new System.Collections.Generic.List<Data.SalesTransactionItemDetails>();

				try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); }
				catch { }
				mclsSalesTransactionDetails.CashierName = lblCashier.Text;

                Data.Terminal clsTerminal = new Data.Terminal(mConnection, mTransaction);
                mConnection = clsTerminal.Connection; mTransaction = clsTerminal.Transaction;

				mclsTerminalDetails = clsTerminal.Details(Constants.TerminalBranchID, CompanyDetails.TerminalNo);
                lblTerminalNoName.Text = mclsTerminalDetails.BranchDetails.BranchName;

				Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                //reload the default customer if necessary
                if (mclsContactDetailsDEFCustomer.ContactID != Constants.C_RETAILPLUS_CUSTOMERID)
                    mclsContactDetailsDEFCustomer = clsContact.Details(Constants.C_RETAILPLUS_CUSTOMERID);

                if (mclsContactDetails.ContactID != Constants.C_RETAILPLUS_CUSTOMERID)
                    mclsContactDetails = mclsContactDetailsDEFCustomer;
                
				// Sep 24, 2011      Lemuel E. Aceron
				// Added order slip wherein all punch items will not change sales and inventory
				// Override the reserved and commit if order slip
				// a customer named ORDER SLIP should be defined in contacts
                //if (lblCustomer.Text.Trim().ToUpper() == Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER)
                //{ mclsTerminalDetails.ReservedAndCommit = false; }

				// Dec 01, 2008      Lemuel E. Aceron
				// added the IsCashCountInitialized for 1 time 
				// Cash count every printing of report.
				if (mclsTerminalDetails.CashCountBeforeReport)
					mboIsCashCountInitialized = clsTerminal.IsCashCountInitialized(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID);

				clsTerminal.CommitAndDispose();

                SetGridItems();
				SetGridItemsWidth();

				mboIsInTransaction = false;
				mboIsItemHeaderPrinted = false;
				mboCreditCardSwiped = false;
				mboRewardCardSwiped = false;
                mdteOverRidingPrintDate = DateTime.MinValue;

				StartMarqueeThread();
				Cursor.Current = Cursors.Default;

                msbToPrint.Clear();
                msbToPrint = new StringBuilder();
                msbEJournalToPrint = new StringBuilder();

				clsEvent.AddEventLn("Done!", true);

			}
			catch (Exception ex)
            { 
                InsertErrorLogToFile(ex, "ERROR!!! Loading options."); 
            }
		}
Ejemplo n.º 14
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();
            }
        }
Ejemplo n.º 15
0
        private static bool IsTerminalExist(out string ErrorMessage)
        {
            ErrorMessage = "";
            Event clsEvent = new Event();
            try
            {
                clsEvent.AddEvent("Checking terminal if exist in the database. [" + CompanyDetails.TerminalNo + "]");

                Data.Terminal clsTerminal = new Data.Terminal();
                Data.TerminalDetails clsDetails = new Data.TerminalDetails();

                Int32 iBranchCount = clsTerminal.BranchCount(CompanyDetails.TerminalNo);

                bool boIsTerminalExist = false;

                if (iBranchCount == 1)
                {
                    clsDetails = clsTerminal.Details(CompanyDetails.TerminalNo);
                    boIsTerminalExist = true;
                    CONFIG.SaveConfig(clsDetails);
                }
                else
                {
                    boIsTerminalExist = clsTerminal.IsExist(Constants.TerminalBranchID, CompanyDetails.TerminalNo, out clsDetails);
                }
                clsTerminal.CommitAndDispose();

                if (!boIsTerminalExist)
                {
                    ErrorMessage = "FATAL ERROR Level 1.!!! " + Environment.NewLine + "Terminal No:[" + CompanyDetails.TerminalNo + "] @ BranchID:[" + Constants.TerminalBranchID.ToString() + "] does not exist in the database." + Environment.NewLine + "Please consult your system administrator immediately...";
                    clsEvent.AddEventLn("FATAL ERROR!!! " + Environment.NewLine + "Terminal No:[" + CompanyDetails.TerminalNo + "] @ BranchID:[" + Constants.TerminalBranchID.ToString() + "] does not exist in the database. TRACE: Procedure IsTerminalExist returns false.");
                }
                else
                {
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Product Version suited for DB Version [" + clsDetails.DBVersion + "] =? Product Version[" + Application.ProductVersion + "]");
                    if (clsDetails.DBVersion != Application.ProductVersion)
                    {
                        ErrorMessage = "FATAL ERROR Level 1.!!! The Product Version [" + Application.ProductVersion + "] is not compatible with Database Version [" + clsDetails.DBVersion + "]." + Environment.NewLine + "Please consult your system administrator immediately...";
                        clsEvent.AddEventLn("FATAL ERROR!!! The Product Version is not compatible with database version. TRACE: Product Version returns false.");
                        return false;
                    }
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Checking Machine Serial No. [" + CONFIG.MachineSerialNo + "]");
                    if (clsDetails.MachineSerialNo != CONFIG.MachineSerialNo)
                    {
                        //bypass this
                        //ErrorMessage = "FATAL ERROR Level 1.!!! The Machine Serial No. in the database and configuration file does not match." +  Environment.NewLine + "Please consult your system administrator immediately...";
                        //clsEvent.AddEventLn("FATAL ERROR!!! The Machine Serial No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                        //return false;
                        clsEvent.AddEventLn("BYPASS-FATAL ERROR!!! The Machine Serial No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");

                    }
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Checking accreditation no. [" + CONFIG.AccreditationNo + "]");
                    if (clsDetails.AccreditationNo != CONFIG.AccreditationNo)
                    {
                        //ErrorMessage = "FATAL ERROR Level 1.!!! The Accreditation No. in the database and configuration file does not match." +  Environment.NewLine + "Please consult your system administrator immediately...";
                        //clsEvent.AddEventLn("FATAL ERROR!!! The Accreditation No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                        //return false;
                        clsEvent.AddEventLn("BY-PASS FATAL ERROR!!! The Accreditation No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                    }
                    clsEvent.AddEventLn("Done!");
                }

                return boIsTerminalExist;
            }
            catch (Exception ex)
            {
                ErrorMessage = "FATAL ERROR!!! TRACE: " + ex.Message;
                clsEvent.AddEventLn("FATAL ERROR!!! TRACE:" + ex.Message);
                return false;
            }
        }
Ejemplo n.º 16
0
        private static bool IsDBAlive()
        {
            Event clsEvent = new Event();
            try
            {
                clsEvent.AddEvent("Checking connections to server.");
                if (IPAddress.IsOpen(AceSoft.RetailPlus.DBConnection.ServerIP(), DBConnection.DBPort()) == false)
                {
                    clsEvent.AddEvent("Cannot connect to server please check.");
                    return false;
                }

                clsEvent.AddEvent("Checking connections to database.");

                Data.Database clsDatabase = new Data.Database();
                bool boIsDBAlive = clsDatabase.IsAlive();
                clsEvent.AddEventLn("Done! Connected to " + clsDatabase.Connection.ConnectionString, false);

                clsEvent.AddEventLn("Updating version to " + Application.ProductVersion, true);
                Data.Terminal clsTerminal = new Data.Terminal(clsDatabase.Connection, clsDatabase.Transaction);
                clsTerminal.UpdateFEVersion(Constants.TerminalBranchID, CompanyDetails.TerminalNo, Application.ProductVersion);

                clsDatabase.CommitAndDispose();

                return boIsDBAlive;
            }
            catch (Exception ex)
            {

                clsEvent.AddErrorEventLn(ex);
                return false;
            }
        }
Ejemplo n.º 17
0
        private static bool IsTerminalExist(out string ErrorMessage)
        {
            ErrorMessage = "";
            Event clsEvent = new Event();

            try
            {
                clsEvent.AddEvent("Checking terminal if exist in the database. [" + CompanyDetails.TerminalNo + "]");

                Data.Terminal        clsTerminal = new Data.Terminal();
                Data.TerminalDetails clsDetails  = new Data.TerminalDetails();

                Int32 iBranchCount = clsTerminal.BranchCount(CompanyDetails.TerminalNo);

                bool boIsTerminalExist = false;

                if (iBranchCount == 1)
                {
                    clsDetails        = clsTerminal.Details(CompanyDetails.TerminalNo);
                    boIsTerminalExist = true;
                    CONFIG.SaveConfig(clsDetails);
                }
                else
                {
                    boIsTerminalExist = clsTerminal.IsExist(Constants.TerminalBranchID, CompanyDetails.TerminalNo, out clsDetails);
                }
                clsTerminal.CommitAndDispose();

                if (!boIsTerminalExist)
                {
                    ErrorMessage = "FATAL ERROR Level 1.!!! " + Environment.NewLine + "Terminal No:[" + CompanyDetails.TerminalNo + "] @ BranchID:[" + Constants.TerminalBranchID.ToString() + "] does not exist in the database." + Environment.NewLine + "Please consult your system administrator immediately...";
                    clsEvent.AddEventLn("FATAL ERROR!!! " + Environment.NewLine + "Terminal No:[" + CompanyDetails.TerminalNo + "] @ BranchID:[" + Constants.TerminalBranchID.ToString() + "] does not exist in the database. TRACE: Procedure IsTerminalExist returns false.");
                }
                else
                {
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Product Version suited for DB Version [" + clsDetails.DBVersion + "] =? Product Version[" + Application.ProductVersion + "]");
                    if (clsDetails.DBVersion != Application.ProductVersion)
                    {
                        ErrorMessage = "FATAL ERROR Level 1.!!! The Product Version [" + Application.ProductVersion + "] is not compatible with Database Version [" + clsDetails.DBVersion + "]." + Environment.NewLine + "Please consult your system administrator immediately...";
                        clsEvent.AddEventLn("FATAL ERROR!!! The Product Version is not compatible with database version. TRACE: Product Version returns false.");
                        return(false);
                    }
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Checking Machine Serial No. [" + CONFIG.MachineSerialNo + "]");
                    if (clsDetails.MachineSerialNo != CONFIG.MachineSerialNo)
                    {
                        //bypass this
                        //ErrorMessage = "FATAL ERROR Level 1.!!! The Machine Serial No. in the database and configuration file does not match." +  Environment.NewLine + "Please consult your system administrator immediately...";
                        //clsEvent.AddEventLn("FATAL ERROR!!! The Machine Serial No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                        //return false;
                        clsEvent.AddEventLn("BYPASS-FATAL ERROR!!! The Machine Serial No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                    }
                    clsEvent.AddEventLn("Done!");

                    clsEvent.AddEvent("Checking accreditation no. [" + CONFIG.AccreditationNo + "]");
                    if (clsDetails.AccreditationNo != CONFIG.AccreditationNo)
                    {
                        //ErrorMessage = "FATAL ERROR Level 1.!!! The Accreditation No. in the database and configuration file does not match." +  Environment.NewLine + "Please consult your system administrator immediately...";
                        //clsEvent.AddEventLn("FATAL ERROR!!! The Accreditation No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                        //return false;
                        clsEvent.AddEventLn("BY-PASS FATAL ERROR!!! The Accreditation No. in the database and configuration file does not match. TRACE: Procedure IsTerminalExist returns false.");
                    }
                    clsEvent.AddEventLn("Done!");
                }

                return(boIsTerminalExist);
            }
            catch (Exception ex)
            {
                ErrorMessage = "FATAL ERROR!!! TRACE: " + ex.Message;
                clsEvent.AddEventLn("FATAL ERROR!!! TRACE:" + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 18
0
		private bool CashCount()
		{
			bool boRetValue = false;

            if (!SuspendTransactionAndContinue()) return boRetValue;

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.CashCount);

			if (loginresult == DialogResult.OK)
			{
				try
				{
					clsEvent.AddEventLn("[" + lblCashier.Text + "] Issuing cash count.", true);

					CashCountWnd frmCashCountWnd = new CashCountWnd();
                    frmCashCountWnd.TerminalDetails = mclsTerminalDetails;
					frmCashCountWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
					frmCashCountWnd.ShowDialog(this);
					DialogResult result = frmCashCountWnd.Result;
					Data.CashCountDetails[] clsCashCountDetails = frmCashCountWnd.Details;
					decimal Amount = frmCashCountWnd.Amount;
					frmCashCountWnd.Close();
					frmCashCountWnd.Dispose();

					if (result == DialogResult.OK)
					{
						if (clsCashCountDetails != null)
						{
                            // Sep 3, 2014 Move it here from the CashCountWnd
                            Data.CashCounts clsCashCount = new Data.CashCounts();
                            mConnection = clsCashCount.Connection; mTransaction = clsCashCount.Transaction;

                            clsCashCount.Insert(clsCashCountDetails);

                            Data.Terminal clsTerminal = new Data.Terminal(mConnection, mTransaction);
                            clsTerminal.UpdateIsCashCountInitialized(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, true);

                            clsCashCount.CommitAndDispose();

                            // 01Dec2008  : Lemu
							// added the IsCashCountInitialized for 1 time 
							// Cash count every printing of report.
							mboIsCashCountInitialized = true;

							PrintCashCount(clsCashCountDetails);

                            // 28Sep2011 : Lemu 
                            // As per request of houseware plaze. Print a second copy
                            System.Threading.Thread.Sleep(100);
                            PrintCashCount(clsCashCountDetails);
						}
						InsertAuditLog(AccessTypes.CashCount, "Issue cash count. amount=" + Amount.ToString("#,###.#0") + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
						clsEvent.AddEventLn("Done! amount=" + Amount.ToString("#,###.#0"), true);

						boRetValue = true;

                        MessageBox.Show("Cash Count has been initialized...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
					}
					else { clsEvent.AddEventLn("Cancelled!", true); }
				}
				catch (Exception ex)
				{
                    InsertErrorLogToFile(ex, "ERROR!!! Issuing cash count"); 
                }
			}
			return boRetValue;
		}
Ejemplo n.º 19
0
        private void InitializeZRead(bool boWithOutTF)
		{
            if (!SuspendTransactionAndContinue()) return;

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.InitializeZRead);

			if (loginresult == DialogResult.OK)
			{
				Data.SalesTransactions clsSales = new Data.SalesTransactions(mConnection, mTransaction);
                mConnection = clsSales.Connection; mTransaction = clsSales.Transaction;

				int count = clsSales.CountSuspended(mclsTerminalDetails.TerminalNo, 0, mclsTerminalDetails.BranchID);
				clsSales.CommitAndDispose();

				if (count != 0)
                {
                    if (MessageBox.Show("There are suspended transactions for this day. Please CLOSE the transactions first or press 'OK' to continue Z-Read... " + Environment.NewLine + Environment.NewLine + " Note: All Suspended transaction will be automatically VOID.", "RetailPlus", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return;
                    }
                }
				if (IsDateLastInitializationOK() == false)
				{
					return;
				}
				if (MessageBox.Show("Warning!!! Z-Read will be initialized...Press OK to continue.", "RetailPlus", MessageBoxButtons.OKCancel , MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
				{
					Cursor.Current = Cursors.WaitCursor;

					try
					{
						clsEvent.AddEvent("[" + lblCashier.Text + "] Initializing ZReading.",true);
						PrintZRead(true);

						Data.TerminalReport clsTerminalReport = new Data.TerminalReport(mConnection, mTransaction);
                        mConnection = clsTerminalReport.Connection; mTransaction = clsTerminalReport.Transaction;

						// Dec 01, 2008      Lemuel E. Aceron
						// added the IsCashCountInitialized for
						// 1 time Cash count every printing of report.
						Data.Terminal clsTerminal = new Data.Terminal(mConnection, mTransaction);
                        mConnection = clsTerminal.Connection; mTransaction = clsTerminal.Transaction;

						clsTerminal.UpdateIsCashCountInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, false);

						//initialize Z-Read
                        clsTerminalReport.InitializeZRead(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierName, Constants.C_DATE_MIN_VALUE, boWithOutTF);

                        InsertAuditLog(AccessTypes.InitializeZRead, "Initialize Z-Read." + " [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo);

						DateTime dteMAXDateLastInitialized = DateTime.MinValue;

						// May 21, 2009      Lemuel E. Aceron
						// added the for auto FTP of file for RLC
						// get the maxdatelastinitialized
						if (CONFIG.MallCode.ToUpper() == MallCodes.RLC)
						{
							Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(mConnection, mTransaction);
                            mConnection = clsTerminalReportHistory.Connection; mTransaction = clsTerminalReportHistory.Transaction;

							dteMAXDateLastInitialized = clsTerminalReportHistory.MINDateLastInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, DateTime.Now);
						}

						clsTerminalReport.CommitAndDispose();

						clsEvent.AddEventLn("Done!", true);

                        MessageBox.Show("Z-Read has been initialized for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo + "...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);

						// May 21, 2009      Lemuel E. Aceron
						// added the for auto FTP of file for RLC
						// send the data to RLC
						if (CONFIG.MallCode.ToUpper() == MallCodes.RLC)
							ProcessMallForwarder(dteMAXDateLastInitialized, true);
						
                        // 23Mar2015 : Initialize all reading with the same ORSeriesBranchID and ORSeriesTerminalNo
                        InitializeAllZreadWithSameORSeries(boWithOutTF);

						LoggedOutCashier(false);
					}
					catch (Exception ex)
					{
                        InsertErrorLogToFile(ex, "ERRROR!!! Initializing ZREAD for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo);
                    }

					Cursor.Current = Cursors.Default;
				}
			}
		}
Ejemplo n.º 20
0
		private void SetDataSource(ReportDocument Report)
		{
			ReportDataset rptds = new ReportDataset();

			Data.TerminalReport clsTerminalReport = new Data.TerminalReport();
            Data.Terminal clsTerminal = new Data.Terminal(clsTerminalReport.Connection, clsTerminalReport.Transaction);
            Data.TerminalDetails clsTerminalDetails = clsTerminal.Details(txtTerminalNo.Text);
            clsTerminalReport.SyncTransactionSales(clsTerminalDetails.BranchDetails.BranchID, txtTerminalNo.Text);
			System.Data.DataTable dt = clsTerminalReport.List(txtTerminalNo.Text);
			clsTerminalReport.CommitAndDispose();

			foreach(System.Data.DataRow dr in dt.Rows)
			{
				DataRow drNew = rptds.TerminalReport.NewRow();
				
				foreach (DataColumn dc in rptds.TerminalReport.Columns)
					drNew[dc] = dr[dc.ColumnName]; 
				
				rptds.TerminalReport.Rows.Add(drNew);
			}

			Report.SetDataSource(rptds); 
			SetParameters(Report);
		}