Stat.processDataMultiSession C# (CSharp) Method

processDataMultiSession() protected method

protected processDataMultiSession ( ArrayList arrayFromSql, bool makeAVGSD, int sessionsNum ) : void
arrayFromSql ArrayList
makeAVGSD bool
sessionsNum int
return void
    protected void processDataMultiSession(ArrayList arrayFromSql, bool makeAVGSD, int sessionsNum)
    {
        this.makeAVGSD = makeAVGSD;

        statPrintedData = new ArrayList();

        string [] rowFromSql = new string [sessionsNum +1];
        string [] sendRow = new string [sessionsNum +1];
        int i;

        //initialize values
        for(int j=1; j< sessionsNum+1 ; j++) {
            sendRow[j] = "-";
        }

        //removes persons in personsWithData
        personsWithData = new ArrayList();

        string oldStat = "-1";

        //process all SQL results line x line
        for (i=0 ; i < arrayFromSql.Count ; i ++) {
            rowFromSql = arrayFromSql[i].ToString().Split(new char[] {':'});

            if (rowFromSql[0] != oldStat) {
                //print the values, except on the first iteration
                if (i>0) {
                    printData( calculateRowAVGSD(sendRow) );
                }

                //add people who are in this stat into personsWithData
                //for being selected on comboCheckboxes
                personsWithData = Util.AddToArrayListIfNotExist(
                        personsWithData, fetchNameOnStatsData(rowFromSql[0]));

                //process another stat
                sendRow[0] = rowFromSql[0]; //first value to send (the name of stat)
                for(int j=1; j< sessionsNum+1 ; j++) {
                    sendRow[j] = "-";
                }
            }

            for (int j=0; j < sessions.Count ; j++) {
                string [] str = sessions[j].ToString().Split(new char[] {':'});
                if(rowFromSql[1] == str[0]) { //if matches the session num
                    sendRow[j+1] = Util.TrimDecimals(rowFromSql[2], pDN); //put value from sql in the desired pos of sendRow
                }
            }
            oldStat = sendRow[0];
        }

        //only show the row if sqlite returned values
        if(i > 0)
        {
            printData( calculateRowAVGSD(sendRow) );

            if(makeAVGSD) {
                CreateOrUpdateAVGAndSD();
            }
        } else {
            //if we cannot access the treeview, also don't allow to graph or report
            LogB.Information("no rows Clicking in stats/main.cs multi session");
            fakeButtonNoRowsSelected.Click();
        }
    }