예제 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            lblProduct1.Text = "Black Tea ";
            lblProduct2.Text = "Green Tea ";
            lblProduct3.Text = "Milk Tea ";
            lblProduct4.Text = "Flower Tea ";
            lblProduct5.Text = "Juice ";

            Price1 = 35.0;
            Price2 = 40.0;
            Price3 = 45.0;
            Price4 = 50.0;
            Price5 = 55.0;

            lblPrice1.Text = Price1.ToString();
            lblPrice2.Text = Price2.ToString();
            lblPrice3.Text = Price3.ToString();
            lblPrice4.Text = Price4.ToString();
            lblPrice5.Text = Price5.ToString();

            Percent = 10.0;
        }
예제 #2
0
        private string EncodePrice3()
        {
            //if (Price3 == null)
            //    return "";

            string _price3 = Price3.ToString("F2");

            _price3 = _price3.Replace(".", "");

            //remove all the zeroes on the left
            while (_price3.StartsWith("0"))
            {
                _price3 = _price3.Remove(0, 1);
            }

            char[] _price3Array = _price3.ToCharArray();

            for (int i = 0; i <= _price3Array.Length - 1; i++)
            {
                switch (_price3Array[i])
                {
                case '0':
                    _price3Array[i] = 'O';
                    break;

                case '1':
                    _price3Array[i] = '-';
                    break;

                case '2':
                    _price3Array[i] = ')';
                    break;

                case '3':
                    _price3Array[i] = 'L';
                    break;

                case '4':
                    _price3Array[i] = 'H';
                    break;

                case '5':
                    _price3Array[i] = 'V';
                    break;

                case '6':
                    _price3Array[i] = 'Z';
                    break;

                case '8':
                    _price3Array[i] = 'C';
                    break;

                case '9':
                    _price3Array[i] = 'A';
                    break;
                }
            }

            _price3 = new string(_price3Array);

            return(_price3);
        }