C# Multidimensional Arrays -


i bit confused own work, seemed have complicated issue.

i pulling data off call dialer, dialer logs calls agents , each agent in queue, there can multiple agents in same queue.

my basic calculations in sql can pull date, queue, hours , number of calls per each hour looks follows:

calldate    queueid    chour    numberofcalls 2013-05-03  no queue     0            1 2013-05-03  no queue     2            1 2013-05-03  no queue     6            1 2013-05-03  no queue     7            7 2013-05-03  no queue     8            6 2013-05-03  no queue     9            14 2013-05-03  no queue     10           6 2013-05-03  no queue     11           5 2013-05-03  no queue     12           8 2013-05-03  17001        7            114 2013-05-03  17001        8            238 2013-05-03  17001        9            227 2013-05-03  17001        10           190 2013-05-03  17001        11           221 2013-05-03  17001        12           73 2013-05-03  17002        6            3 2013-05-03  17002        7            125  

there can see queue, hour , how many calls hour (hour being 7am, 8am... etc).

i need know if create multidimensional array stor queue, hour , number of calls each queue, each hour (if makes sense?) can later use graph?

here sample code have gotten stuck to:

xaml:

<window x:class="wpfapplication1.mainwindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:dv="clr-namespace:system.windows.controls.datavisualization;assembly=system.windows.controls.datavisualization.toolkit"     xmlns:dvc="clr-namespace:system.windows.controls.datavisualization.charting;assembly=system.windows.controls.datavisualization.toolkit"     xmlns:thememanager.themename="metropolisdark"     title="mainwindow" height="350" width="525"> <grid>      <dvc:chart name="chart"                background="#463f3f">                         <dvc:chart.plotareastyle>             <style targettype="grid">                 <setter property="background" value="transparent" />             </style>         </dvc:chart.plotareastyle>     </dvc:chart>  </grid> 

c#:

    private void allagenthourdata()     {         string[] queueid = new string[100];         int[] callhour = new int[100];         int count = 0;         int counter = 0;          sqlconnection sqlconnection1 = new sqlconnection("server=nl-reportserver;database=rc_dailer_wh;user id=sa;password=d@t0r@.001");         sqlcommand cmd = new sqlcommand();         sqldatareader reader;          //cmd.commandtext = "select * rc_call_logs convert(date,call_logdate,120) = convert(date,getdate(),120)";         cmd.commandtext = "select distinct queueid rc_call_logs order queueid";         cmd.commandtype = commandtype.text;         cmd.connection = sqlconnection1;          sqlconnection1.open();          reader = cmd.executereader();         if (reader.hasrows)         {             while (reader.read())             {                 queueid[count] = reader.getstring(0);             }         }         else         {             messagebox.show("no error message");         }         reader.close();          sqlconnection1.close();          random random = new random();          //chart chart object in xaml         //declare series         (int = 1; < 10; i++)         {             lineseries ls = new lineseries();              ls.title = i.tostring();             ls.independentvaluebinding = new binding("key");             ls.dependentvaluebinding = new binding("value");              ls.itemssource = new keyvaluepair<datetime, int>[]{             new keyvaluepair<datetime,int>(datetime.now             , random.next(1000)),             new keyvaluepair<datetime,int>(datetime.now.addmonths(1), random.next(10, 1000)),             new keyvaluepair<datetime,int>(datetime.now.addmonths(2), random.next(10, 1000)),             new keyvaluepair<datetime,int>(datetime.now.addmonths(3), random.next(10, 1000)),             new keyvaluepair<datetime,int>(datetime.now.addmonths(4), random.next(10, 1000))};              // add chart             chart.series.add(ls);         }      } 

i'm not sure you're trying achieve may help.

dictionary<datetime, dictionary<string, keyvaluepair<int,int>>> dicdata 

datetime being datetime, string being queue , int,int in keyvaluepair hour , numberofcall pair.

edit 1:

actually has list of keyvaluepair. , here example:

dictionary<datetime, dictionary<string, list<keyvaluepair<int, int>>>> dicdata = new dictionary<datetime, dictionary<string, list<keyvaluepair<int, int>>>>();         //dt result sql query         foreach (datarow dr in dt.rows)         {             datetime dtm = datetime.parse(dr["datetime"].tostring());             string queue = dr["queue"].tostring();             int hours = int.parse(dr["hours"].tostring());             int cycles = int.parse(dr["cycles"].tostring());              //adding distinct datetime objects key             if(!dicdata.containskey(dtm))             {                 dicdata[dtm] = new dictionary<string, keyvaluepair<int, int>>();             }              //adding distinct queue object key under datetime dictionary             if (!dicdata.containskey(queue))             {                 dicdata[dtm][queue] = new list<keyvaluepair<int, int>>();             }             dicdata[dtm][queue].add(new keyvaluepair<int, int>(hours, cycles));         } 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -