public SerialControl()
        {
            _singletonConnection = BaseConnection.Instance;
            _transactionForm = new MakeTransaction();
            _memberAccess = new Member();
            _queuingPriceTags = new Queue<Pricetag>();

            AllRegister_AllTransactions = getRegistersFromMemory();
            Pricetaglist = getPriceTagsFromMemory();

            /*
            Pricetag myTest = new Pricetag("20529", "12345678", "Computer Bag", "55.95");
            string cats = myTest.getMessage();
            */
            /*
            AllRegister_AllTransactions.Add(new SingleRegister_AllTransactions("21041", "lol", "register"));
            receive("SHR1100050580050Z;");
            receive("SHR1881200000000K;");
            receive("SHR1123450000000M;");
            receive("SHR1101003380010Z;");
            receive("SHR1000000000000C;");
             */
        }
Ejemplo n.º 2
0
        private void ShopEntryForm_Load(object sender, EventArgs e)
        {
            _searchForm = new Search();
            _salesSummaryForm = new SalesSummary();
            _makeTransactionForm = new MakeTransaction();
            _cashierAccess = new Cashier();
            _memberAccess = new Member();
            _updateAccess = new HqReport();
            _priceDisplayAccess = new PriceDisplay();
            _opsController = new Controller();
            _productResultCache = new List<SearchRowResult>();
            _transResultCache = new List<TransRowResult>();
            _updateCache = new List<UpdateRowResult>();
            _salesSummaryCache = new List<SalesSummaryRowResult>();
            _memberCache = new List<List<string>>();
            _pageLimit = 10;
            _pageCurrStart = 0;
            _updatePageLimit = 10;
            _updatePageCurrStart = 0;
            _salesSumPageLimit = 10;
            _salesSumCurrStart = 0;
            _buffer = EMPTY;
            _cBuffer = EMPTY;
            _shuffle = false;
            //Ensure that date picker is always set to today's date by default
            transactionToDatePicker.Value = DateTime.Today;

            var ports = System.IO.Ports.SerialPort.GetPortNames();
            portComboBox.DataSource = ports;

            foreach (string option in _searchForm.getTransactionSearchOptions())
                transactionComboOptions.Items.Add(option);
            if (transactionComboOptions.Items.Count > 0)
                transactionComboOptions.SelectedIndex = 0;

            foreach (string option in _salesSummaryForm.getSalesSearchOptions())
                salesOptionComboOptions.Items.Add(option);
            if (salesOptionComboOptions.Items.Count > 0)
                salesOptionComboOptions.SelectedIndex = 0;

            //Set current cashier to be admin superuser
            string user = _opsController.getLoggedinUserName();
            MySqlDataReader queryOutcome = _opsController.queryDatabase(
                _cashierAccess.getCashierQuery(user));
            if (queryOutcome != null)
            {
                if (queryOutcome.Read())
                    makeTransCashierIdBox.Text =
                        queryOutcome[CASHIER_QUERY_ID].ToString();
            }
            else
            {
                //Connection fail processing here.
            }

            //Get all category for search form
            categorySearchCombo.Items.Add(SEARCH_OPTION_NONE);
            queryOutcome = _opsController.queryDatabase(
                _searchForm.getCategoryOptionsQuery());
            if (queryOutcome != null)
            {
                while (queryOutcome.Read())
                    categorySearchCombo.Items.Add(
                        queryOutcome[SEARCH_QUERY_NAME]);

                if (categorySearchCombo.Items.Count > 0)
                    categorySearchCombo.SelectedIndex = 0;
            }
            else
            {
                //Connection fail processing here.
            }

            makeTransCashierIdBox.Text = "1";
            setAllPriceDisplayComboOptions();
            setupPriceDisplayGridView();
            updateview();
            serialPortWrite.DiscardInBuffer();
            //cats();
        }