Beispiel #1
0
        private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = (SerialPort)sender;
            string     indata = sp.ReadLine();

            indata = indata.Remove(indata.Length - 1); //removing last character \r from indata
            User user = User.searchByCardID(indata);

            if (user == null)
            {
                //TODO: iim IDtai hereglegch bhgu bna!!!
                Console.WriteLine("Burtgelgui kart baina!");
                return;
            }

            if (user.Uld == 0)
            {
                //TODO: Uldegedel duussan bna!!!
                Console.WriteLine("Uldegdel duussan baina!");
                displayUser(user);
                return;
            }

            user.Uld = user.Uld - 1;
            user.update();
            displayUser(user);
            populateLV();
        }
Beispiel #2
0
        private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = (SerialPort)sender;
            string     indata = sp.ReadLine();

            indata = indata.Remove(indata.Length - 1); //removing last character \r from indata
            User user = User.searchByCardID(indata);

            if (user == null)
            {
                //TODO: iim IDtai hereglegch bhgu bna!!!
                Console.WriteLine("Burtgelgui kart baina!");
                return;
            }

            displayUser(user);

            using (GetQuantityDialog getQuantityDialog = new GetQuantityDialog(user.Uld))
            {
                if (getQuantityDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Console.WriteLine("Selected quantity is: {0}", getQuantityDialog.selectedQuantity);
                    user.Uld += getQuantityDialog.selectedQuantity;
                    user.update();
                }
            }
        }