
January 25th, 2013, 06:42 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 14 m 11 sec
Reputation Power: 0
|
|
|
Detecting incoming calls
Dear Giovanni,
The customer data is retrieved from the database by calling the method shown in the code below. This method is defined in the DatabaseConnection class and performs the SELECT commands needed for retrieving the proper data.
Here is the code i mentioned:
Code:
1. public CustomerDatasheet getCustomerDatasheet(string PhoneNumber)
2. {
3. DbDataReader reader;
4. Int64 id;
5. string fullName;
6. List<string> phoneNumbers = new List<string>();
7. SortedDictionary<DateTime, string> notes = new SortedDictionary<DateTime,
string>();
8. string sql = string.Format("SELECT c.customer_id, c.fullname, n.phone FROM
customer c INNER JOIN number n ON c.customer_id = n.customer_id WHERE n.phone = '{0}'",
PhoneNumber);
9. reader = this.CreateDbCommand(sql).ExecuteReader();
10. if (!reader.Read())
11. {
12. return null;
13. }
14. id = (Int64)reader["customer_id"];
15. fullName = (string)reader["fullname"];
16. while (reader.Read())
17. {
18. phoneNumbers.Add((string)reader["phone"]);
19. }
20. reader.Close();
21.
22. reader = this.CreateDbCommand(string.Format("SELECT n.created, n.note FROM note
n WHERE n.customer_id = {0} ORDER BY n.created ASC", id)).ExecuteReader();
23. while (reader.Read())
24. {
25. notes.Add((DateTime)reader["created"], (string)reader["note"]);
26. }
27. reader.Close();
28.
29. return new CustomerDatasheet(id, fullName, phoneNumbers, notes);
30. }
If you stuck in your project again or you need more help then I recommend you to take a look at voip-sip-sdk[dot]com/p_432-voip-incoming-call-detection-voip[dot]html. (Sorry but I am not allowed to give you the link in its original form because you know, it runs against the rules of the forum.)
Regards,
Dr. Amit Kumar
|