当前位置: 首页>>代码示例>>C#>>正文


C# GSM.DeleteCall方法代码示例

本文整理汇总了C#中GSM.DeleteCall方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.DeleteCall方法的具体用法?C# GSM.DeleteCall怎么用?C# GSM.DeleteCall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GSM的用法示例。


在下文中一共展示了GSM.DeleteCall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CallsInfo

    private static void CallsInfo()
    {
        // 12. Test the call history functionality of the GSM class.
        GSM gsm = new GSM("Optimus", "LG"); // 12.1 Create an instance of the GSM class.

        // 12.2 Add few calls.
        gsm.AddCall(DateTime.Now, 0871111111, 60);
        gsm.AddCall(DateTime.Now, 0882222222, 200);
        gsm.AddCall(DateTime.Now, 0893333333, 1234);

        // 12.3 Display the information about the calls.
        gsm.PrintHistory();

        /* 12.4 Assuming that the price per minute is 0.37
                Calculate and print the total price of the calls in the history. */
        Console.WriteLine("The cost of calls is: {0:C2}", gsm.CallPrice(0.37f));

        // 12.5 Remove the longest call from the history and calculate the total price again.
        gsm.DeleteCall(1234);
        Console.WriteLine("The cost of calls without the longest one is: {0:C2}", gsm.CallPrice(0.37f));

        // 12.6 Finally clear the call history and print it.
        gsm.ClearHistory();
        gsm.PrintHistory();
        Console.WriteLine("History is cleared!" + Environment.NewLine);

        Main();
    }
开发者ID:unbelt,项目名称:Telerik,代码行数:28,代码来源:GSMTest.cs

示例2: Main

        static void Main(string[] args)
        {
            try
            {
                //Create battery and display for the GSM
                Battery battery = new Battery("BL-5C",360,7,Battery.BatteryType.LithiumLon);
                Display display = new Display(3,65536);
                //Create GSM
                GSM gsm = new GSM("1208", "nokia", 50, "Georgi", battery, display);
                //Console.WriteLine(gsm.ToString()); //Print GSM data

                //Mace some calls and print the history
                gsm.AddCall(new Call(new DateTime(2013, 02, 22, 19, 01, 22), "00359888888888", 200));
                gsm.AddCall(new Call(new DateTime(2013,02,22,20,02,33),"0887888888",302));
                gsm.AddCall(new Call(new DateTime(2013, 02, 22, 20, 30, 19), "0889-88-88-88", 178));
                gsm.PrintCallHistiry();
                //Calculate the price of all calls
                decimal price = 0.37m;
                gsm.CalculateTotalCallsPrice(price);

                //Remove the longest call and calculate the price again
                gsm.DeleteCall(1); //The calls in the list start from 0, so the second call(longest) is 1
                gsm.CalculateTotalCallsPrice(price);

                //Clear the history and print it
                gsm.ClearCallHistory();
                gsm.PrintCallHistiry();

            }
            catch (Exception ex)
            {

                Console.WriteLine("Error!"+ex.Message);
            }
        }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:35,代码来源:GSMCallHistoryTest(Main).cs

示例3: Main

        static void Main()
        {
            GSM NokiaN92 = new GSM("Nokia", "N82", 190, "Pesho Gosho", new Battery(Battery.Type.NiCD, 150, 13.5), new Display(2.5, 2000000000));

            Console.WriteLine("Add some calls...");
            NokiaN92.AddCall("0892023111", 250, 2013, 2, 25, 21, 9, 3);
            NokiaN92.AddCall("0892023111", 50, 2013, 2, 22, 12, 2, 30);
            NokiaN92.AddCall("0892023111", 110, 2013, 1, 7, 18, 3, 12);
            Console.WriteLine("Print the calls:");
            foreach (var item in NokiaN92.CallHistory)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));

            Console.WriteLine("Deleting longest call duration  with the method .DeleteCall(Call)");
            NokiaN92.DeleteCall(NokiaN92.CallHistory[0]);
            Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));

            Console.WriteLine("Clear the CallHistory and print it:");
            NokiaN92.ClearCallHistory();
            foreach (var item in NokiaN92.CallHistory)
            {
                Console.WriteLine(item);
            }
        }
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:27,代码来源:GSMCallHistoryTest.cs

示例4: Main

    static void Main(string[] args)
    {
        GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

        phone.MakeCall(DateTime.Now, "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
        phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);

        Console.WriteLine("Calls ordered by date: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.DeleteCall(2);
        Console.WriteLine("New calls: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.ClearCallHistory();
        Console.WriteLine("\nNothing will show, because history is deleted: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }
    }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:29,代码来源:AddDeleteHistory.cs

示例5: Main

    static void Main()
    {
        GSM nokia = new GSM("N73", "Nokia", "Pesho", 360,
            new Battery("BP-6M", 370, 6, BatteryType.LiIon), new Display(2.4, 243000));

        GSM samsung = new GSM("GalaxyS III", "Samsung", "Gosho", 819,
            new Battery("HR32", 790, 50, BatteryType.LiIon), new Display(4.8, 16000000));

        GSM sonyEricsson = new GSM("Xperia Z", "Sony Ericsson", "Kiro", 864,
            new Battery("PM63", 550, 40, BatteryType.LiIon), new Display(5, 16000000));

        GSM vertu = new GSM("Ascent", "Vertu", "Dimcho", 10400,
            new Battery("RP-M4", 150, 4, BatteryType.LiIon), new Display(0.87, 6));

        GSM[] mobilePhones = { nokia, samsung, sonyEricsson, vertu, GSM.IPhone4S };

        foreach (var phone in mobilePhones)
        {
            Console.WriteLine(phone);
            Console.WriteLine("------------------------------");
        }

        Call callOne = new Call("0885131618", 125);
        Call callTwo = new Call("0886933601", 563);
        Call callThree = new Call("0886948266", 256);

        vertu.AddCall(callOne);
        vertu.AddCall(callTwo);
        vertu.AddCall(callThree);

        Console.WriteLine("Total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));

        double maxDuration = 0;
        string number = "";

        foreach (var call in vertu.CallHistory)
        {
            if (maxDuration < call.Duration)
            {
                maxDuration = call.Duration;
                number = call.DialedPhoneNumber;
            }
        }

        Call longestCall = new Call(number, maxDuration);

        Console.WriteLine("The longest call lasted {0} seconds and it is made with number {1}.", maxDuration, number);
        vertu.DeleteCall(longestCall);
        Console.WriteLine("Now the longest call is removed from the call history.");
        Console.WriteLine("New total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));
        vertu.ClearCallHistory();
        Console.WriteLine("Call history is now cleared!!!");
    }
开发者ID:powerslider,项目名称:TelerikAcademyHomeworks,代码行数:53,代码来源:GSMTest.cs

示例6: Main

 static void Main()
 {
     GSM nokia = new GSM("N7", "Nokia");
     nokia.AddCall(360);
     nokia.AddCall(500);
     nokia.AddCall(1500);
     nokia.DisplayCalls();
     Console.WriteLine("The total price of the calls with 0.37st/min is {0}", nokia.CallPrice(0.37));
     nokia.DeleteCall(1500);
     nokia.DisplayCalls();
     Console.WriteLine("The total price of the calls without the longest call is {0}", nokia.CallPrice(0.37));
 }
开发者ID:TeodorKostadinov,项目名称:TelerikOOP-1,代码行数:12,代码来源:GSMCallHistoryTest.cs

示例7: Main

    static void Main()
    {
        try
        {
            //adding battery type i the battery constructor
            Battery batteryOne = new Battery("SameModel", 10, 20, BatteryType.LiIon);
            Console.WriteLine("-------------------------EX3---------------------------");
            Console.WriteLine(batteryOne.Type);
            // creating phone
            Display displayOne = new Display(55f);
            GSM gsm = new GSM("55k33", "Nokia", 666, "Nqkoi", batteryOne, displayOne);
            // test for override method ToString()
            Console.WriteLine("-------------------------EX4---------------------------");
            Console.WriteLine(gsm.ToString());
            Console.WriteLine("-------------------------EX.7--------------------------");
            //creating object test
            GSMTests test = new GSMTests();
            test.Tests();//call its method  It is void method so it will directly write the data
            //ex.9
            Console.WriteLine("------------------------EX9---------------------------");
            string dateTime ="22.12.2013 01.05.35";

            DateTime day = DateTime.ParseExact(dateTime, "dd.MM.yyyy HH.mm.ss", CultureInfo.InvariantCulture);//date
            string dateTime2 = "20.12.2013 01.05.35";
            DateTime day2 = DateTime.ParseExact(dateTime2, "dd.MM.yyyy HH.mm.ss", CultureInfo.InvariantCulture);//date
            Call firstCall = new Call(day,"0555555555",78);
            Call secondCall = new Call(day2, "0555555555", 105);
            Console.WriteLine(firstCall.DateAndTime);
            gsm.AddCalls(firstCall);
            gsm.AddCalls(secondCall);
            Console.WriteLine();
            Console.WriteLine(gsm.CallHistory[0].DateAndTime);
            Console.WriteLine(gsm.CallHistory[1].DateAndTime);
            Console.WriteLine("------------------------EX10--------------------------");
            gsm.DeleteCall(secondCall);
            for (int i = 0; i < gsm.CallHistory.Count; i++)
            {
                 Console.WriteLine(gsm.CallHistory[i].DateAndTime);
            }
            gsm.ClearCallHistory();
            Console.WriteLine("There is {0} call in the call history",gsm.CallHistory.Count);
            Console.WriteLine("--------------------------EX12------------------------");
            GSMCallHistoryTest testHistory = new GSMCallHistoryTest();
            testHistory.GSMCallHistoryTests();

        }
        catch (ArgumentException exep)
        {
            Console.WriteLine("There is incorrect data!");
            Console.WriteLine(exep.ToString());
        }
    }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:52,代码来源:CreatingGsm.cs

示例8: Main

    public static void Main()
    {
        // Create the phone
        GSM myPhone = new GSM("Nexus 5", "Google");
        Console.WriteLine("Your phone: {0} {1}\n", myPhone.Manufacturer, myPhone.Model);

        // Let's make some random calls
        int numCalls = 5;
        Random rand = new Random();
        int callNumber;
        int callDuration;
        for (int i = 0; i < numCalls; i++)
        {
            callNumber = rand.Next(884000000, 899999999);
            callDuration = rand.Next(30, 300);

            myPhone.OpenCall("+359" + callNumber);
            myPhone.CloseCall(callDuration);
        }

        // Display the call history
        DisplayCallHistory(myPhone);

        // Display total cost of all calls
        decimal pricePerMinute = 0.37m;
        PrintTotalCost(myPhone, pricePerMinute);

        // Get the longest call
        int longestCallIndex = 0;
        for (int i = 0; i < myPhone.CallHistory.Count; i++)
        {
            if (myPhone.CallHistory[i].Duration > myPhone.CallHistory[longestCallIndex].Duration)
            {
                longestCallIndex = i;
            }
        }

        // Remove the longest call
        myPhone.DeleteCall(longestCallIndex);

        // Display total cost of all calls
        Console.WriteLine("\nAfter removing the longest call from the history:");
        PrintTotalCost(myPhone, pricePerMinute);

        // Clear the call history and print it. 
        Console.WriteLine("\nClear call history...");
        myPhone.ClearCallHistory();
        Console.WriteLine();
        DisplayCallHistory(myPhone);      
    }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:50,代码来源:GSMCallHistoryTest.cs

示例9: Main

    static void Main()
    {
        GSM phone1 = new GSM("Samsung", "Germany", 1000);
            GSM phone2 = new GSM("Nokia", "Italy", 200.99m, "Boris");
            GSM phone3 = GSM.IPhone4S;

            GSM[] phones = new GSM[] { phone1, phone2, phone3 };

            Call newCall1 = new Call("05.03.2013",  "0882203628", 100);
            Call newCall2 = new Call("01.02.2013", "11:00", "0882203628", 60);
            Call newCall3 = new Call("0882203628", 10);
            Call newCall4 = new Call("08.03.2013", "21:00", "0882203628", 360);

            phone1.AddCall(newCall1);
            phone1.AddCall(newCall2);
            phone1.AddCall(newCall3);
            phone1.AddCall(newCall4);

            //Print CallHistory
            StringBuilder result = new StringBuilder();
            foreach (var call in phone1.CallHistory)
            {
                result.AppendFormat("Date: {0}\nTime: {1}\nDialedNumber: {2}\nDuration (in seconds): {3}\n\n",
                    call.date, call.time, call.dialedPnoneNumber, call.duration);
            }

            Console.WriteLine(result.ToString());

            //Calculate TotalPrice
            decimal price = phone1.TotalPrice(0.37m);
            Console.WriteLine("{0:F2}лв.", price);

            //Calculate TotalPrice without long call
            phone1.DeleteCall(newCall4);
            decimal priceWithoutLongCall = phone1.TotalPrice(0.37m);
            Console.WriteLine("{0:F2}лв.", priceWithoutLongCall);

            //Clear CallHistory
            phone1.ClearCallHistory();

            StringBuilder resultClear = new StringBuilder();
            foreach (var call in phone1.CallHistory)
            {
                resultClear.AppendFormat("Date: {0}\nTime: {1}\nDialedNumber: {2}\nDuration (in seconds): {3}\n\n",
                    call.date, call.time, call.dialedPnoneNumber, call.duration);
            }
            Console.WriteLine();
            Console.WriteLine("The result after clear is: \n", resultClear.ToString());
    }
开发者ID:rumyanaaleksandrova,项目名称:Classes_1,代码行数:49,代码来源:GSMCallHistoryTest.cs

示例10: Print

    static public void Print()
    {
        
        GSM phone = new GSM("galaxy", "samsung");

        string date1 = "07/07/2011 10:48:12";
        string date2 = "17/03/2012 08:43:08";
        string date3 = "08/06/2012 02:52:24";
        Call call1 = new Call(ParseDate(date1).ToString("dd/MM/yyyy"), ParseDate(date1).ToString("hh:mm:ss"), 0898456456, 450);
        Call call2 = new Call(ParseDate(date2).ToString("dd/MM/yyyy"), ParseDate(date2).ToString("hh:mm:ss"), 0898324456, 350);
        Call call3 = new Call(ParseDate(date3).ToString("dd/MM/yyyy"), ParseDate(date3).ToString("hh:mm:ss"), 0898324879, 620);

        Console.WriteLine(call1);
        Console.WriteLine(new string('-', 20));
        Console.WriteLine(call2);
        Console.WriteLine(new string('-', 20));
        Console.WriteLine(call3);

        phone.AddCall(call1);
        phone.AddCall(call2);
        phone.AddCall(call3);

        decimal sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
        Console.WriteLine("price of all calls in History is {0}", sum);

        ulong maxDuration = 0;
        int maxIndex = -1;
        for (int i = 0; i < phone.CallHistory.Count; i++)
        {
            if (maxDuration < phone.CallHistory[i].Duration)
            {
                maxDuration = phone.CallHistory[i].Duration;
                maxIndex = i;
            }
        }

        phone.DeleteCall(phone.CallHistory[maxIndex]);

        sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
        Console.WriteLine("price of all calls in History is {0}", sum);

        phone.ClearCallHistory();
        Console.WriteLine("there are {0} calls in call history", phone.CallHistory.Count);
        //Console.WriteLine(call1.Date + " " + call1.Time + " " + call1.DialedNumber + " " + call1.Duration);

    }
开发者ID:hristo11111,项目名称:TelerikAcademy-HristoBratanov,代码行数:46,代码来源:GSMCallHistoryTest.cs

示例11: Main

        static void Main(string[] args)
        {
            GSM[] gsmDevices = new GSM[5];

            gsmDevices[0] = new GSM(
                "N95",
                "Nokia",
                650.60m,
                "Kukata",
                new Display(15, 65000),
                new Battery("Takashi", Battery.BatteryType.NiMH, 0, 0));

            gsmDevices[1] = new GSM("Touch Pro 2", "HTC", "VGeorgiev");
            gsmDevices[2] = new GSM("Galaxy", "Samsung", "Penka");
            gsmDevices[3] = new GSM("Touch Diamond", "HTC", "Stoki");
            gsmDevices[4] = new GSM();

            for (int i = 0; i < gsmDevices.Length; i++)
            {
                Console.WriteLine("Manufacturer: {0} , Model: {1}", gsmDevices[i].Manufacturer, gsmDevices[i].Model);
            }

            Console.WriteLine();

            Console.WriteLine(GSM.IPhone4S.ToString());

            // CAll i

                var device = new GSM("Touch Pro 2", "HTC", "Vlado");

                Call firstCall = new Call(DateTime.Now, 180);
                Call secondCall = new Call(DateTime.Now, 560);
                Call thirdCall = new Call(DateTime.Now, 340);
                device.AddCall(firstCall);
                device.AddCall(secondCall);
                device.AddCall(thirdCall);

                device.DeleteCall(firstCall);

                Console.WriteLine("Call duration: {0}s, Call price: {1:c}", device.CallHistoryDuration(), device.CallHystoryPrice());

                GSM.IPhone4S.Owner = "Pesho";
                Console.WriteLine(GSM.IPhone4S.Owner);


        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:46,代码来源:Program.cs

示例12: Main

        //12.Write a class GSMCallHistoryTest to test the call history functionality of the GSM class.
        //-Create an instance of the GSM class.
        //-Add few calls.
        //-Display the information about the calls.
        //-Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history.
        //-Remove the longest call from the history and calculate the total price again.
        //-Finally clear the call history and print it.

        static void Main()
        {
            const decimal callPerMinutePrice = 0.37M;

            GSM phone = new GSM("Galaxy S2", "Samsung", 450, "Gogo", new Battery("A1920", BatteryType.LiIon), new Display(3.2M, 100000UL));
            phone.AddCall(new Call("29.02.2012", "10:10:10", "0845333444", 60));
            phone.AddCall(new Call("15.12.2013", "12:00:00", "0879123456", 480));
            phone.AddCall(new Call("20.07.2011", "15:00:00", "0863123456", 960));

            //print every call information
            foreach (Call call in phone.CallHistory)
            {
                Console.WriteLine(call.ToString());
                Console.WriteLine();
            }

            decimal phoneCallsPrice = phone.CalculateCallsPrice(callPerMinutePrice);
            Console.WriteLine("Total cost of all calls: {0}", phoneCallsPrice);
            Console.WriteLine();

            phone.DeleteCall(2);

            phoneCallsPrice = phone.CalculateCallsPrice(callPerMinutePrice);
            Console.WriteLine("Total cost of all calls after deleted the longest call: {0}", phoneCallsPrice);
            Console.WriteLine();

            //after the deleted call
            Console.ForegroundColor = ConsoleColor.Cyan;
            foreach (var call in phone.CallHistory)
            {
                Console.WriteLine(call.ToString());
                Console.WriteLine();
            }

            phone.ClearCallHistory();
            //try to print calls, but history is deleted
            //there is no calls in the call history and nothing happens
            foreach (var call in phone.CallHistory)
            {
                Console.WriteLine(call.ToString());
                Console.WriteLine();
            }
            Console.ResetColor();
        }
开发者ID:jesusico83,项目名称:Telerik,代码行数:52,代码来源:CallHistoryTest.cs

示例13: TestCallRate

        public void TestCallRate()
        {
            GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

            phone.MakeCall(DateTime.Now, "0899999999", 3.44);
            phone.MakeCall(DateTime.Now, "0899999999", 3.44);
            phone.MakeCall(DateTime.Now, "0889666999", 9.44);
            phone.MakeCall(DateTime.Now, "0009666999", 9.44);

            phone.setCallRate = 0.37;

            Assert.AreEqual("9.5312", Convert.ToString(phone.CalculateTotalPriceOfCalls()));

            phone.DeleteCall(3);
            Assert.AreEqual("6.0384", Convert.ToString(phone.CalculateTotalPriceOfCalls()));

            phone.ClearCallHistory();
            Assert.AreEqual("0", Convert.ToString(phone.CalculateTotalPriceOfCalls()));
        }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:19,代码来源:GSMHistoryTest.cs

示例14: Main

        static void Main(string[] args)
        {
            //Create an instance of the GSM class.
            Battery phoneBattery = new Battery("NiCd", 30.6, 5.6);
            Display phoneDisplay = new Display(5.0, 16000000);
            GSM phone = new GSM("Galaxy Note", "Samsung", 866, "Goran Bregovic", phoneBattery, phoneDisplay);

            //Add few calls.
            DateTime dateAndTime = new DateTime(2013, 3, 5, 11, 59, 59);
            Call callOne = new Call(dateAndTime, "0888455455", 110);
            Call callTwo = new Call(dateAndTime, "0899455455", 50);
            Call callThree = new Call(dateAndTime, "0886455455", 230);

            phone.AddCall(callOne);
            phone.AddCall(callTwo);
            phone.AddCall(callThree);
            //Display the information about the calls.
            //Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history.
            Console.WriteLine(phone.CallHistoryToString);
            double price = phone.CalculatePrice(0.37);
            Console.WriteLine("The price for the whole history is {0}", price);

            //Remove the longest call from the history and calculate the total price again.
            uint maxDuritation = uint.MinValue;
            Call callToRemove = new Call(dateAndTime, "0886455455", 0);
            for (int i = 0; i < phone.CallHistory.Count; i++)
            {
                if (phone.CallHistory[i].Duritation > maxDuritation)
                {
                    maxDuritation = phone.CallHistory[i].Duritation;
                    callToRemove = phone.CallHistory[i];
                }
            }
            phone.DeleteCall(callToRemove);
            price = phone.CalculatePrice(0.37);
            Console.WriteLine("The new price after we removed the longest call is {0}", price);

            //Finally clear the call history and print it.
            Console.WriteLine();
            Console.WriteLine("Clearing History...");
            phone.ClearHistory();
            Console.WriteLine("Call History: {0}", phone.CallHistoryToString);
        }
开发者ID:Jarolim,项目名称:HomeWork,代码行数:43,代码来源:CallHistoryTest.cs

示例15: TestCallHistory

        public static void TestCallHistory()
        {
            GSM gsm = new GSM("Samsung Galaxy S Duos S7582", "Samsung", 100M,
                new Battery(BatteryTypes.LiIon, 310, 8), new Display(4, 16 * 1024));

            Call call = new Call("0899798546", 100);
            gsm.AddCall(call);
            call = new Call("+35902364972", 50);
            gsm.AddCall(call);
            call = new Call("+35905235678", 1000);
            gsm.AddCall(call);

            Console.WriteLine("Information about the calls:");
            Console.WriteLine(gsm.CallHistoryToString());
            Console.WriteLine();

            decimal price = gsm.CalculateCallHistoryPrice(0.37M);
            Console.WriteLine("Calls total price");
            Console.WriteLine("{0:F2}", price);
            Console.WriteLine();

            Call longestCall = gsm.CallHistory.OrderByDescending(x => x.Duration).FirstOrDefault();

            if (longestCall != null)
            {
                gsm.DeleteCall(longestCall);
                Console.WriteLine("Longest call is removed.");
            }
            else
            {
                Console.WriteLine("Longest call is not found.");
            }

            price = gsm.CalculateCallHistoryPrice(0.37M);
            Console.WriteLine("Calls total price");
            Console.WriteLine("{0:F2}", price);
            Console.WriteLine();

            gsm.ClearCallHistory();
            Console.WriteLine("Call history is cleared");
            Console.WriteLine("Information about the calls:");
            Console.WriteLine(gsm.CallHistoryToString());
        }
开发者ID:ValMomchilova,项目名称:TelerikAcademyHomeWorks,代码行数:43,代码来源:GSMCallHistoryTest+.cs


注:本文中的GSM.DeleteCall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。