static void Main()
        {
            Random randomGenerator = new Random();

            GSM NokiaMobile = new GSM("Lamia", "Nokia");
            GSM SamsungMobile = new GSM("Grifin", "Samsung");
            GSM HtcMobile = new GSM("Eno", "HTC");

            for (int i = 0; i < 10; i++)
            {
                DateTime callDate = DateTime.Now.AddSeconds(randomGenerator.Next(1000000));
                string mobileNumber = randomGenerator.Next(800000000, 1000000000).ToString();
                int durationInSeconds = randomGenerator.Next(3600);
                Calls someCall = new Calls(callDate, mobileNumber, durationInSeconds);
                NokiaMobile.AddCall(someCall);
            }
            NokiaMobile.DisplayCalls();

            RemoveLongestCall(NokiaMobile);

            Console.WriteLine("\n ==== Longest call removed ==== \n");

            NokiaMobile.DisplayCalls();

            NokiaMobile.DeleteCallHistory();

            Console.WriteLine("\n ==== Call History Deleted ==== \n");

            NokiaMobile.DisplayCalls();
        }
示例#2
0
文件: MainWindow.cs 项目: ibarra/bot
        public void OnPublic(UserInfo user, string channel, string message)
        {
            Calls c = new Calls();
            string txt = c.CallPublic(user.Nick.ToString(), message, channel, connection);
            textviewLog.Buffer.Text = txt.ToString();

            //connection.Sender.PublicMessage(channel, user + " " + "Cuando digas mi nombre lavate la boca ingenuo mortal");
        }
        static void Main()
        {
            Calls callHistory = new Calls(DateTime.Now, "0883333999", 34);

            Console.Write(callHistory.DateAndTime + " " + ",");
            Console.Write(callHistory.DialedPhoneNumber + " " + ",");
            Console.Write(callHistory.Duration);
            Console.WriteLine();
        }
示例#4
0
        public DataSet LoadData(string fileName)
        {
            const int GRID_COLUMN_NUM = 2;
            const string DELIMETER_SYMBOL = ",";
            const string CALLS_GRID_NAME = "gridCalls";

            StreamReader sReader = null;
            DataSet dataset = new DataSet();
            Globals.LCalls = new List<Calls>();

            try
            {
                sReader = new StreamReader(fileName);
                dataset.Tables.Add(CALLS_GRID_NAME);
                // The phone number
                dataset.Tables[CALLS_GRID_NAME].Columns.Add("Phone Number");
                // The call duration in seconds
                dataset.Tables[CALLS_GRID_NAME].Columns.Add("Call Duration (seconds)");

                string allData = sReader.ReadToEnd();
                string[] rows = allData.Split(Globals.LINE_FOLDING.ToCharArray());

                foreach (string row in rows)
                {
                    if (row.Length == 0) continue;
                    string[] columns = row.Split(DELIMETER_SYMBOL.ToCharArray());
                    if (columns.Length != GRID_COLUMN_NUM)
                        throw new DataException("Invalid " + fileName + " file format.");

                    dataset.Tables[CALLS_GRID_NAME].Rows.Add(columns);

                    string phone = columns[0].ToString().Trim();
                    string duration = columns[1].ToString().Trim();

                    Calls call = new Calls(phone, duration);
                    Globals.LCalls.Add(call);
                }
            }
            catch (DirectoryNotFoundException e)
            {
                Console.WriteLine(e);
            }
            catch (IOException e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                sReader.Close();
                sReader.Dispose();
            }

            return dataset;
        }
        public override void AddCall(Wybecom.TalkPortal.CTI.Call call, string extension)
        {
            Calls ccall = new Calls();
            ccall.callee = call.callee;
            ccall.caller = call.caller;
            ccall.id = call.callId;
            ccall.calltype = call.type.ToString();
            ccall.startdatetime = call.startTime;
            ccall.extension = extension;
            ccall.enddatetime = call.endTime;
            _codif.AddToCalls(ccall);
            _codif.SaveChanges();

        }
        /*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(string[] args)
        {
            GSM gsm = new GSM("someModel", "Nokia");

            Console.WriteLine("Enter number of calls: ");
            int numberOfCalls = int.Parse(Console.ReadLine());
            Random rnd = new Random();
            string dialledNumber = "088";

            for (int i = 0; i < numberOfCalls; i++)
            {
                DateTime startCall = DateTime.Now.AddMinutes(rnd.Next(40000));
                Calls newCall = new Calls(startCall, startCall.AddSeconds(rnd.Next(0, 360)), dialledNumber + rnd.Next(9999999).ToString());
                gsm.AddCalls(newCall);

            }

            foreach (Calls call in gsm.CallHistory)
            {
                Console.WriteLine("Call info: \n Date of call: {0:MM/dd/yyyy} \n Time of call: {1:hh:mm:ss} \n Duration: {2} seconds \n Dialled Number: {3}", call.timeAndDateOfCall, call.timeAndDateOfCall,
                    call.duration, call.dialledNumber);

            }

            Console.WriteLine();
            Console.WriteLine("Total costs: {0:C}", gsm.CalculatePrice());

            double bestDuration = 0;
            int bestIndex = 0;
            for (int i = 0; i < gsm.CallHistory.Count; i++)
            {
                if (gsm.CallHistory[i].duration > bestDuration)
                {
                    bestIndex = i;
                }
            }

            gsm.DeleteCalls(bestIndex);
            Console.WriteLine();
            Console.WriteLine("Total costs after removing longest duration call: {0:C}", gsm.CalculatePrice());

            gsm.ClearCallHistory();
            if (gsm.CallHistory.Count < 1)
            {
                Console.WriteLine();
                Console.WriteLine("Call history successfully deleted.");
            }
        }
示例#7
0
        public static void Main()
        {
            try
            {
                Display display = new Display(4, 16000000);
                Battery battery = new Battery(620, 8, Battery.BatteryModel.NiMH);
                GSM phone = new GSM("One", "HTC", 850, "Person", battery, display);

                GSMTest test = new GSMTest();
                Console.WriteLine("=============");
                test.GSMTesting();
                Console.WriteLine("=============");

                DateTime time = new DateTime();
                time = DateTime.Now;

                Calls[] call = new Calls[5];

                //making some phone calls
                for (int i = 0; i < 5; i++)
                {
                    time = time.AddDays(i);
                    string phoneNumber = "0888999999";
                    int duration = i + 100;
                    call[i] = new Calls(time, phoneNumber, duration);
                    phone.AddCall(call[i]);
                }

                Console.WriteLine();
                decimal pricePerMinute = 0.37m;

                //display call information
                phone.CallHistory();
                Console.WriteLine("=============");
                phone.TotalPriceOfCalls(pricePerMinute);
                Console.WriteLine("=============");
                phone.FindLongestCall();
                phone.TotalPriceOfCalls(pricePerMinute);
                Console.WriteLine("=============");
                phone.ClearCallHistory();
                phone.CallHistory();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        static void Main()
        {
            Battery samsungBattery = new Battery("EB-L1G6LLA", 30, 15, BatteryType.NiMH);
            Display bigDisplay = new Display(11, 16000000);
            GSM samsungNote = new GSM("GalaxyNote", "Samsung", 600.00, "Samsung", samsungBattery, bigDisplay);

            decimal pricePerMin = 0.37M;

            Calls call = new Calls( DateTime.Today, DateTime.Now.TimeOfDay, "+359887841089", 120);
            samsungNote.AddCall(call);
            Calls call2 = new Calls(DateTime.Today, DateTime.Now.TimeOfDay, "+359887845655", 400);
            samsungNote.AddCall(call2);
            Calls call3 = new Calls(DateTime.Today, DateTime.Now.TimeOfDay, "+359888999954", 324);
            samsungNote.AddCall(call3);
            Calls call4 = new Calls(DateTime.Today, DateTime.Now.TimeOfDay, "+359854454322", 487);
            samsungNote.AddCall(call4);

            Console.WriteLine("SORTED CALL LIST");
            List<Calls> tempList = samsungNote.HISTORY;
            tempList.Sort();
            foreach (var calls in tempList)
            {

                Console.WriteLine(calls.ToString());
            }

            Console.WriteLine("\nPrice per minute is: {0}. Total cost: {1}\n", pricePerMin.ToString("C", CultureInfo.CurrentCulture), samsungNote.CalculateCalls(pricePerMin).ToString("C", CultureInfo.CurrentCulture));

            Console.WriteLine("DELETING THE LONGEST CALL");
            samsungNote.DeleteCall(tempList[tempList.Count - 1]);

            foreach (var calls in tempList)
            {
                Console.WriteLine(calls.ToString());
            }

            Console.WriteLine("\nPrice per minute is: {0}. Total cost: {1}\n", pricePerMin.ToString("C", CultureInfo.CurrentCulture), samsungNote.CalculateCalls(pricePerMin).ToString("C", CultureInfo.CurrentCulture));

            Console.WriteLine("CLEARING THE WHOLE CALL LIST");
            samsungNote.ClearCall();
            foreach (var calls in tempList)
            {
                Console.WriteLine(calls.ToString());
            }
            Console.WriteLine("\nPrice per minute is: {0}. Total cost: {1}\n", pricePerMin.ToString("C", CultureInfo.CurrentCulture), samsungNote.CalculateCalls(pricePerMin).ToString("C", CultureInfo.CurrentCulture));
        }
示例#9
0
 public void DeleteCall(Calls call)
 {
     this.PerformedCalls.Remove(call);
 }
示例#10
0
 /// <summary>
 /// To update or modify the records in Zoho CRM
 /// </summary>
 /// <param name="CallId">Specify unique ID of the record</param>
 /// <param name="Call">Call with updated data</param>
 /// <param name="parameters">
 /// Dictionary:                 key: wfTrigger,         value: Set value as true to trigger the workflow rule while inserting record into CRM Call. By default, this parameter is false.
 ///                             key: newFormat	        value: (1 or 2)	newFormat=1: To exclude fields with "null" values while fetching data from your CRM Call.
 ///                             key: version            value: (1 -4 Default value: 1)</param>
 /// <returns>True if updated successfully or throws an exception if it could not updated properly</returns>
 public bool updateRecords(long CallId, Calls Call, Dictionary<string, string> parameters)
 {
     List<Calls> listCalls = new List<Calls>();
     listCalls.Add(Call);
     return this.updateRecords(module, CallId, listCalls, parameters);
 }
            public AsyncUnaryCall <global::Google.Protobuf.Empty> DeleteTableAsync(global::Google.Bigtable.Admin.Table.V1.DeleteTableRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                var call = CreateCall(__Method_DeleteTable, new CallOptions(headers, deadline, cancellationToken));

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#12
0
            public global::Google.Datastore.V1Beta3.CommitResponse Commit(global::Google.Datastore.V1Beta3.CommitRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_Commit, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
示例#13
0
            public AsyncUnaryCall <global::Google.Datastore.V1Beta3.AllocateIdsResponse> AllocateIdsAsync(global::Google.Datastore.V1Beta3.AllocateIdsRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                var call = CreateCall(__Method_AllocateIds, new CallOptions(headers, deadline, cancellationToken));

                return(Calls.AsyncUnaryCall(call, request));
            }
            public global::Google.Bigtable.Admin.Table.V1.Table GetTable(global::Google.Bigtable.Admin.Table.V1.GetTableRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_GetTable, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
示例#15
0
            public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken))
            {
                var call = new Grpc.Core.Call <DivArgs, DivReply>(divMethod, channel);

                return(Calls.BlockingUnaryCall(call, request, token));
            }
示例#16
0
 public void AddCall(Calls call)
 {
     this.conversations.Add(call);
 }
示例#17
0
            public ClientStreamingAsyncResult <Num, Num> Sum(CancellationToken token = default(CancellationToken))
            {
                var call = new Grpc.Core.Call <Num, Num>(sumMethod, channel);

                return(Calls.AsyncClientStreamingCall(call, token));
            }
示例#18
0
            public IObserver <DivArgs> DivMany(IObserver <DivReply> responseObserver, CancellationToken token = default(CancellationToken))
            {
                var call = new Grpc.Core.Call <DivArgs, DivReply>(divManyMethod, channel);

                return(Calls.DuplexStreamingCall(call, responseObserver, token));
            }
示例#19
0
            public void Fib(FibArgs request, IObserver <Num> responseObserver, CancellationToken token = default(CancellationToken))
            {
                var call = new Grpc.Core.Call <FibArgs, Num>(fibMethod, channel);

                Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
            }
示例#20
0
            public Task <DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken))
            {
                var call = new Grpc.Core.Call <DivArgs, DivReply>(divMethod, channel);

                return(Calls.AsyncUnaryCall(call, request, token));
            }
示例#21
0
            public AsyncUnaryCall <global::Google.Datastore.V1Beta3.AllocateIdsResponse> AllocateIdsAsync(global::Google.Datastore.V1Beta3.AllocateIdsRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_AllocateIds, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#22
0
            public AsyncUnaryCall <global::Google.Datastore.V1Beta3.BeginTransactionResponse> BeginTransactionAsync(global::Google.Datastore.V1Beta3.BeginTransactionRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_BeginTransaction, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#23
0
 // Problem 10. Delete calls
 // This will delete the last call
 public void RemoveCall(Calls call)
 {
     int index = callHistory.IndexOf(call);
     if (index >= 0)
     {
         this.callHistory.RemoveAt(index);
     }
     else
     {
         throw new ArgumentOutOfRangeException("There is no matching call in the Call history");
     }
 }
示例#24
0
 public List<Calls> DeleteCall(Calls call)
 {
     GSM.callHistory.Remove(call);
     return GSM.CallHistory;
 }
示例#25
0
            public AsyncUnaryCall <global::Google.Datastore.V1Beta3.RollbackResponse> RollbackAsync(global::Google.Datastore.V1Beta3.RollbackRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_Rollback, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#26
0
            public global::Google.Datastore.V1Beta3.RollbackResponse Rollback(global::Google.Datastore.V1Beta3.RollbackRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                var call = CreateCall(__Method_Rollback, new CallOptions(headers, deadline, cancellationToken));

                return(Calls.BlockingUnaryCall(call, request));
            }
示例#27
0
            public global::Google.Datastore.V1Beta3.AllocateIdsResponse AllocateIds(global::Google.Datastore.V1Beta3.AllocateIdsRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_AllocateIds, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
示例#28
0
文件: MainWindow.cs 项目: ibarra/bot
 public void OnPrivate(UserInfo user, string message)
 {
     Calls c = new Calls();
     c.CallPrivate(user.Nick.ToString(), connection);
 }
 public void RemoveFromCalls(DependencyMethod calledMethod)
 {
     Calls.Remove(calledMethod);
 }
            public global::Google.Bigtable.Admin.Table.V1.Table GetTable(global::Google.Bigtable.Admin.Table.V1.GetTableRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                var call = CreateCall(__Method_GetTable, new CallOptions(headers, deadline, cancellationToken));

                return(Calls.BlockingUnaryCall(call, request));
            }
示例#31
0
            public AsyncClientStreamingCall <global::math.Num, global::math.Num> Sum(CancellationToken token = default(CancellationToken))
            {
                var call = CreateCall(__ServiceName, __Method_Sum);

                return(Calls.AsyncClientStreamingCall(call, token));
            }
            public AsyncUnaryCall <global::Google.Bigtable.Admin.Table.V1.Table> GetTableAsync(global::Google.Bigtable.Admin.Table.V1.GetTableRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_GetTable, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#33
0
            public global::math.DivReply Div(global::math.DivArgs request, CancellationToken token = default(CancellationToken))
            {
                var call = CreateCall(__ServiceName, __Method_Div);

                return(Calls.BlockingUnaryCall(call, request, token));
            }
            public AsyncUnaryCall <global::Google.Protobuf.Empty> DeleteTableAsync(global::Google.Bigtable.Admin.Table.V1.DeleteTableRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_DeleteTable, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#35
0
            public Task <global::math.DivReply> DivAsync(global::math.DivArgs request, CancellationToken token = default(CancellationToken))
            {
                var call = CreateCall(__ServiceName, __Method_Div);

                return(Calls.AsyncUnaryCall(call, request, token));
            }
示例#36
0
 public void AddCall(Calls call)
 {
     this.PerformedCalls.Add(call);
 }
示例#37
0
            public AsyncDuplexStreamingCall <global::math.DivArgs, global::math.DivReply> DivMany(CancellationToken token = default(CancellationToken))
            {
                var call = CreateCall(__ServiceName, __Method_DivMany);

                return(Calls.AsyncDuplexStreamingCall(call, token));
            }
示例#38
0
 /// <summary>
 /// To update or modify the records in Zoho CRM
 /// </summary>
 /// <param name="CallId">Specify unique ID of the record</param>
 /// <param name="Call">Call with updated data</param>
 /// <returns>True if updated successfully or throws an exception if it could not updated properly</returns>
 public bool updateRecords(long CallId, Calls Call)
 {
     List<Calls> listCalls = new List<Calls>();
     listCalls.Add(Call);
     return this.updateRecords(module, CallId, listCalls);
 }
示例#39
0
            public AsyncServerStreamingCall <global::math.Num> Fib(global::math.FibArgs request, CancellationToken token = default(CancellationToken))
            {
                var call = CreateCall(__ServiceName, __Method_Fib);

                return(Calls.AsyncServerStreamingCall(call, request, token));
            }
示例#40
0
 //Adding calls in the history (by making an instance of the class Calls)
 public void AddCalls(DateTime dateAndTime, string dialedPhoneNumber, double duration)
 {
     Calls call = new Calls(dateAndTime, dialedPhoneNumber, duration);
     callHistory.Add(call);
 }
示例#41
0
            public AsyncUnaryCall <global::Google.Datastore.V1Beta3.CommitResponse> CommitAsync(global::Google.Datastore.V1Beta3.CommitRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_Commit, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#42
0
 public List<Calls> AddCall(Calls call)
 {
     GSM.CallHistory.Add(call);
     return GSM.CallHistory;
 }
示例#43
0
 public DialInfo()
 {
     Calls       = new Calls();
     ConnectMode = new ConnectMode();
 }
示例#44
0
 public void AddCalls(Calls newCall)
 {
     this.callsHistory.Add(newCall);
 }
示例#45
0
 /// <summary>
 /// Il n'existe aucun commentaire pour Calls dans le schéma.
 /// </summary>
 public void AddToCalls(Calls calls)
 {
     base.AddObject("Calls", calls);
 }
示例#46
0
 public void DeleteCall(Calls call)
 {
     this.conversations.Remove(call);
 }
示例#47
0
文件: GSM.cs 项目: stoyans/Telerik
 public void AddCall(Calls call)
 {
     callsTotal.Add(call);
 }
示例#48
0
 public void AddCall(Calls call)
 {
     this.callHistory.Add(call);
 }
示例#49
0
            public global::Google.Datastore.V1Beta3.BeginTransactionResponse BeginTransaction(global::Google.Datastore.V1Beta3.BeginTransactionRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_BeginTransaction, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
        public void RemoveCall(Calls call)
        {
            int index = callHistory.IndexOf(call);

            this.callHistory.RemoveAt(index);
        }
            public AsyncUnaryCall <global::Google.Bigtable.Admin.Table.V1.ListTablesResponse> ListTablesAsync(global::Google.Bigtable.Admin.Table.V1.ListTablesRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_ListTables, options);

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#52
0
 /// <summary>
 /// Créez un nouvel objet Calls.
 /// </summary>
 /// <param name="extension">Valeur initiale de extension.</param>
 /// <param name="calltype">Valeur initiale de calltype.</param>
 /// <param name="startdatetime">Valeur initiale de startdatetime.</param>
 /// <param name="callid">Valeur initiale de callid.</param>
 /// <param name="enddatetime">Valeur initiale de enddatetime.</param>
 public static Calls CreateCalls(string extension, string calltype, global::System.DateTime startdatetime, long callid, global::System.DateTime enddatetime)
 {
     Calls calls = new Calls();
     calls.extension = extension;
     calls.calltype = calltype;
     calls.startdatetime = startdatetime;
     calls.callid = callid;
     calls.enddatetime = enddatetime;
     return calls;
 }
示例#53
0
            public global::Google.Datastore.V1Beta3.RollbackResponse Rollback(global::Google.Datastore.V1Beta3.RollbackRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_Rollback, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
            public global::Google.Bigtable.Admin.Table.V1.ListTablesResponse ListTables(global::Google.Bigtable.Admin.Table.V1.ListTablesRequest request, CallOptions options)
            {
                var call = CreateCall(__Method_ListTables, options);

                return(Calls.BlockingUnaryCall(call, request));
            }
            public AsyncUnaryCall <global::Google.Bigtable.Admin.Table.V1.ListTablesResponse> ListTablesAsync(global::Google.Bigtable.Admin.Table.V1.ListTablesRequest request, Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                var call = CreateCall(__Method_ListTables, new CallOptions(headers, deadline, cancellationToken));

                return(Calls.AsyncUnaryCall(call, request));
            }
示例#56
0
 public void DeleteCall(Calls call)
 {
     this.callHistory.Remove(call);
 }
示例#57
0
 // Problem 10
 public void AddCall(string dialedNumber, int duration)
 {
     Calls call = new Calls(dialedNumber, duration);
     this.callHistory.Add(call);
 }