Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Best way to create statistics out of a DB with Lists<T>

$
0
0
Hello guys

I'm doing some practice with Lists in C# to get more experience, so I thought I could do some statistics with data stored in a database.

My idea:
I have a Sqlite DB with some data about customers calls. Who called, when did he call, how much time did the call last, and other values that I do not care about. Now I would like to get out theese values and calculate how many times every customer called per month and per year. Afterwards, calculate how much time was invested for every customer per month and per year.

How to do it:
The calculation in fact is not difficult and getting everything out of the DB aswell. I did that already. What I want, tough, is to create a well structured list to fill out.

How would you structure your list?

As there are over 200000 rows in the DB I thought it would be best to insert every customer only once in the list and than update the specified fields to increase the desired values. With this in mind I began with creating a class for my list:
public class KdStats
        {
            public Int32 customernumber { get; set; }
            public String customername { get; set; }
            public Int32 calls { get; set; }
            public Decimal time { get; set; }
            public Int32 month { get; set; }
            public Int32 year { get; set; }
        }

but I realized soon, that this way I can not make a calculation per month/year. So my first thought was: is there a possibility to define an array within my list's class? this would solve my problem, wouldn't it? I tried to define for example "public Int32[] calls { get; set; }" but afterwards I do not know where to inizialize the array. (in the class or in the function, where I modify the list's vlaues) I did not find anything while googling... :(

Do you have other suggestions on how to do something like that? Or would it really be possible to do it with an array in my list?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>