コード例 #1
0
        string IElectricity.retrievePhoneNumber()
        {
            string     rePhoneNum;
            VietNamCus VNCus = new VietNamCus();

            rePhoneNum = +84 + VNCus.Phone;
            return(rePhoneNum);
        }
コード例 #2
0
        public void InsertData()
        {
            int  choice = 0;
            bool flag   = true;
            int  count  = 1;

            while (flag)
            {
                Console.WriteLine("--------Case 1-------");
                Console.WriteLine("1.Nhap thong tin KH Viet Nam");
                Console.WriteLine("2.Nhap thong tin KH Nuoc Ngoai");
                Console.WriteLine("3.Ket thuc");
                choice = Convert.ToInt16(Console.ReadLine());
                Console.WriteLine("--------Case 1-------");
                switch (choice)
                {
                case 1:
                    VietNamCus VNcu = new VietNamCus();
                    VNcu.Id     = count;
                    VNcu.Name   = "Duc" + count;
                    VNcu.Phone  = "035235480" + count;
                    VNcu.Wallet = 100000;
                    VNcu.Type   = "VN";
                    VNcu.Kw     = count * 10;
                    VNcu.Date   = 05022019;
                    VNcu.Bill   = String.Format("{0:#.##} ", VNcu.invoice());
                    VNCuArr.Add(VNcu);
                    break;

                case 2:
                    ForeignCus FGcu = new ForeignCus();
                    FGcu.Id     = count;
                    FGcu.Name   = "My" + count;
                    FGcu.Phone  = "333333333" + count;
                    FGcu.Wallet = 100000;
                    FGcu.Type   = "FG";
                    FGcu.Kw     = count * 10;
                    FGcu.Date   = 05022019;
                    FGCuArr.Add(FGcu);
                    break;

                case 3:
                    flag = false;
                    Console.WriteLine("Bye");
                    break;

                default:
                    Console.WriteLine("Bye..");
                    break;
                }
                count++;
            }
        }
コード例 #3
0
        public float invoice()
        {
            float      _paid = 0;
            VietNamCus VNCu  = new VietNamCus();
            QtyPrice   Price = new QtyPrice();

            if (VNCu.Kw <= Price.Quota)
            {
                _paid = (float)(VNCu.Kw * Price.Price);
            }
            else
            {
                _paid = (float)((VNCu.Kw - Price.Quota) * 1.5 * Price.Price + Price.Quota * Price.Price);
            }
            return(_paid);
        }