protected override string [] printSD(System.Object myObject, int cols)
    {
        MultiChronopic mc = (MultiChronopic)myObject;

        string [] sds = mc.Statistics(false, pDN);         //first boolean is averageOrSD

        string [] myData = new String [19 + 1];
        int       count  = 0;

        myData[count++] = Catalog.GetString("SD");

        for (int i = 0; i < 9; i++)
        {
            myData[count++] = "";
        }

        for (int i = 0; i < 8; i++)
        {
            myData[count++] = Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[i], pDN));
        }

        myData[count++] = "";         //desc
        myData[count++] = "-1";       //mark to non select here, select first line

        return(mc.DeleteCols(myData, maxCPs, false));
    }
Example #2
0
    public static MultiChronopic SelectMultiChronopicData(int uniqueID, bool dbconOpened)
    {
        if (!dbconOpened)
        {
            Sqlite.Open();
        }

        dbcmd.CommandText = "SELECT * FROM " + Constants.MultiChronopicTable + " WHERE uniqueID == " + uniqueID;

        LogB.SQL(dbcmd.CommandText.ToString());

        dbcmd.ExecuteNonQuery();

        SqliteDataReader reader;

        reader = dbcmd.ExecuteReader();
        reader.Read();

        MultiChronopic mc = new MultiChronopic(DataReaderToStringArray(reader, 19));

        reader.Close();
        if (!dbconOpened)
        {
            Sqlite.Close();
        }
        return(mc);
    }
    protected override string [] getLineToStore(System.Object myObject)
    {
        MultiChronopic mc    = (MultiChronopic)myObject;
        ArrayList      array = mc.AsArrayList(pDN);

        string title;

        string typeExtra = mc.GetCPsString();

        if (mc.Type == Constants.RunAnalysisName)
        {
            typeExtra = mc.Vars + "cm " + Util.TrimDecimals(mc.GetTimeRunA(), pDN) + "s " + Util.TrimDecimals(mc.GetAVGSpeedRunA(), pDN) + "m/s";
        }
        title  = mc.Type + " " + typeExtra;
        title += " " + array.Count.ToString() + "n";
        if (mc.Simulated == Constants.Simulated)
        {
            title += Constants.SimulatedTreeview + " ";
        }

        string [] myData = new String [19 + 1];
        int       count  = 0;

        myData[count++] = title;

        for (int i = 0; i < 17; i++)
        {
            myData[count++] = "";
        }

        myData[count++] = mc.Description;
        myData[count++] = mc.UniqueID.ToString();
        return(mc.DeleteCols(myData, maxCPs, false));
    }
    private void initValues()
    {
        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonEventEnded  = new Gtk.Button();
        fakeButtonFinished    = new Gtk.Button();
        fakeButtonThreadDyed  = new Gtk.Button();
        simulated             = false;

        cp1InStr  = "";
        cp1OutStr = "";
        cp2InStr  = "";
        cp2OutStr = "";
        cp3InStr  = "";
        cp3OutStr = "";
        cp4InStr  = "";
        cp4OutStr = "";

        if (type == Constants.RunAnalysisName)
        {
            syncFirst   = false;
            deleteFirst = false;
        }

        //initialize eventDone as a mc
        eventDone = new MultiChronopic();
    }
Example #5
0
    protected override void fillDistance(Event myEvent)
    {
        MultiChronopic mc = (MultiChronopic)myEvent;

        entryDistance                  = mc.Vars.ToString(); //distance
        entry_distance_value.Text      = Util.TrimDecimals(entryDistance, pDN);
        entry_distance_value.Sensitive = true;
    }
    public int UploadMultiChronopic(MultiChronopic myTest)
    {
        int temp = myTest.UniqueID;

        myTest.UniqueID = -1;
        int id = myTest.InsertAtDB(false, Constants.MultiChronopicTable);

        myTest.UniqueID = temp;
        return(id);        //uniqueID of person at server
    }
    //no total here
    protected override void addStatisticInfo(TreeIter iterDeep, System.Object myObject)
    {
        //store.AppendValues(iterDeep, printTotal(myObject, 19+1));

        MultiChronopic mc = (MultiChronopic)myObject;

        if (mc.Type == Constants.RunAnalysisName)
        {
        }
        else
        {
            store.AppendValues(iterDeep, printAVG(myObject, 19 + 1));
            store.AppendValues(iterDeep, printSD(myObject, 19 + 1));
        }
    }
    protected override int getNumOfSubEvents(System.Object myObject)
    {
        MultiChronopic mc = (MultiChronopic)myObject;

        if (mc.Type == Constants.RunAnalysisName)
        {
            int cp2In  = Util.GetNumberOfJumps(mc.Cp2InStr, false);
            int cp2Out = Util.GetNumberOfJumps(mc.Cp2OutStr, false);
            if (cp2In < cp2Out)
            {
                return(1 + cp2In);                      //first "1+" is for the row with column names
            }
            else
            {
                return(1 + cp2Out);                     //first "1+" is for the row with column names
            }
        }

        int cp1 = Util.GetNumberOfJumps(mc.Cp1InStr, false) + Util.GetNumberOfJumps(mc.Cp1OutStr, false);
        int cp2 = Util.GetNumberOfJumps(mc.Cp2InStr, false) + Util.GetNumberOfJumps(mc.Cp2OutStr, false);

        int cp3 = 0;

        if (maxCPs >= 3)
        {
            cp3 = Util.GetNumberOfJumps(mc.Cp3InStr, false) + Util.GetNumberOfJumps(mc.Cp3OutStr, false);
        }
        int cp4 = 0;

        if (maxCPs == 4)
        {
            cp4 = Util.GetNumberOfJumps(mc.Cp4InStr, false) + Util.GetNumberOfJumps(mc.Cp4OutStr, false);
        }

        return(1 + cp1 + cp2 + cp3 + cp4);       //first "1+" is for the row with the initial data
    }
    protected override System.Object getObjectFromString(string [] myStringOfData)
    {
        MultiChronopic mc = new MultiChronopic();

        mc.UniqueID     = Convert.ToInt32(myStringOfData[1].ToString());
        mc.Type         = myStringOfData[4].ToString();
        mc.Cp1StartedIn = Convert.ToInt32(myStringOfData[5].ToString());
        mc.Cp2StartedIn = Convert.ToInt32(myStringOfData[6].ToString());
        mc.Cp3StartedIn = Convert.ToInt32(myStringOfData[7].ToString());
        mc.Cp4StartedIn = Convert.ToInt32(myStringOfData[8].ToString());
        mc.Cp1InStr     = myStringOfData[9].ToString();
        mc.Cp1OutStr    = myStringOfData[10].ToString();
        mc.Cp2InStr     = myStringOfData[11].ToString();
        mc.Cp2OutStr    = myStringOfData[12].ToString();
        mc.Cp3InStr     = myStringOfData[13].ToString();
        mc.Cp3OutStr    = myStringOfData[14].ToString();
        mc.Cp4InStr     = myStringOfData[15].ToString();
        mc.Cp4OutStr    = myStringOfData[16].ToString();
        mc.Vars         = myStringOfData[17].ToString();
        mc.Description  = myStringOfData[18].ToString();
        mc.Simulated    = Convert.ToInt32(myStringOfData[19].ToString());

        return(mc);
    }
Example #10
0
 public System.IAsyncResult BeginUploadMultiChronopic(MultiChronopic myTest, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UploadMultiChronopic", new object[] {
                 myTest}, callback, asyncState);
 }
Example #11
0
    private void treeviewMultiChronopicContextMenu(MultiChronopic mc)
    {
        Menu myMenu = new Menu ();
        Gtk.MenuItem myItem;

        /*
        myItem = new MenuItem ( Catalog.GetString("Play Video") + " " +
                mc.Type + " (" + mc.PersonName + ")");
        if(File.Exists(Util.GetVideoFileName(currentSession.UniqueID,
                Constants.TestTypes.MULTICHRONOPIC, myTreeViewMultiChronopic.EventSelectedID))) {
            myItem.Activated += on_video_play_selected_multi_chronopic_clicked;
            myItem.Sensitive = true;
        } else
            myItem.Sensitive = false;
        myMenu.Attach( myItem, 0, 1, 0, 1 );
        */

        myItem = new MenuItem ( Catalog.GetString("Edit selected") + " " + mc.Type + " (" + mc.PersonName + ")");
        myItem.Activated += on_edit_selected_multi_chronopic_clicked;
        myMenu.Attach( myItem, 0, 1, 0, 1 );

        /*
        myItem = new MenuItem ( Catalog.GetString("Repair selected") + " " + mc.Type + " (" + mc.PersonName + ")");
        myItem.Activated += on_repair_selected_multi_chronopic_clicked;
        myMenu.Attach( myItem, 0, 1, 2, 3 );
        */

        Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem();
        myMenu.Attach( mySep, 0, 1, 1, 2 );

        myItem = new MenuItem ( Catalog.GetString("Delete selected") + " " + mc.Type + " (" + mc.PersonName + ")");
        myItem.Activated += on_delete_selected_multi_chronopic_clicked;
        myMenu.Attach( myItem, 0, 1, 2, 3 );

        myMenu.Popup();
        myMenu.ShowAll();
    }
Example #12
0
    private void on_multi_chronopic_finished(object o, EventArgs args)
    {
        if(multiFinishing)
            return;
        else
            multiFinishing = true;

        currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_multi_chronopic_finished);

        if(currentMultiChronopicType.Name == Constants.RunAnalysisName && ! currentEventExecute.MultiChronopicRunAUsedCP2())
            //new DialogMessage(Constants.MessageTypes.WARNING,
            //		Catalog.GetString("This Run Analysis is not valid because there are no strides."));
            currentEventExecute.RunANoStrides();
        else if ( ! currentEventExecute.Cancel ) {
        Console.WriteLine("T");
            /*
               on runAnalysis test, when cp1 ends, run ends,
               but cp2 is still waiting event
               with this will ask cp2 to press button
               solves problem with threads at ending
               */

            //on_finish_multi_clicked(o, args);
            //this produces also a crash:
            //new DialogMessage(Constants.MessageTypes.INFO, "Please, touch a platform now.");
        Console.WriteLine("U");
            //call write here, because if done in execute/MultiChronopic, will be called n times if n chronopics are working
            currentEventExecute.MultiChronopicWrite(false);
        Console.WriteLine("V");
            currentMultiChronopic = (MultiChronopic) currentEventExecute.EventDone;
        Console.WriteLine("W");
            //move video file if exists
            Util.MoveTempVideo(currentSession.UniqueID,
                    Constants.TestTypes.MULTICHRONOPIC, currentMultiChronopic.UniqueID);

            //this produces also a crash:
            //new DialogMessage(Constants.MessageTypes.INFO, "Please, touch a platform now.");

        Console.WriteLine("W2");

            //if this multichronopic has more chronopics than other in session, then reload treeview, else simply add
            if(currentMultiChronopic.CPs() != SqliteMultiChronopic.MaxCPs(currentSession.UniqueID)) {
                treeview_multi_chronopic_storeReset();
                fillTreeView_multi_chronopic();
            } else
                myTreeViewMultiChronopic.Add(currentPerson.Name, currentMultiChronopic);
        Console.WriteLine("X");

            //since 0.7.4.1 when test is done, treeview select it. action event button have to be shown
            showHideActionEventButtons(true, Constants.MultiChronopicName); //show

            //unhide buttons for delete last test
            sensitiveGuiYesEvent();
        }
        else if( currentEventExecute.ChronopicDisconnected ) {
            Log.WriteLine("DISCONNECTED gui/cj");
            createChronopicWindow(true);
        }

        //unhide buttons that allow doing another test
        Console.WriteLine("RR3");
        sensitiveGuiEventDone();
        Console.WriteLine("RR4");
    }
Example #13
0
    /*
     * maybe we come here four times, one for any chronopic,
     * best is to put one bool in order to only let on get inside
     */
    //bool writingStarted;

    public override void MultiChronopicWrite(bool tempTable)
    {
        LogB.Information("----------WRITING A----------");
        //	if(writingStarted)
        //		return;
        //	else
        //		writingStarted = true; //only one execution can "get in"
        LogB.Information("----------WRITING B----------");

        LogB.Information("cp1 In:" + cp1InStr);
        LogB.Information("cp1 Out:" + cp1OutStr + "\n");
        LogB.Information("cp2 In:" + cp2InStr);
        LogB.Information("cp2 Out:" + cp2OutStr + "\n");
        LogB.Information("cp3 In:" + cp3InStr);
        LogB.Information("cp3 Out:" + cp3OutStr + "\n");
        LogB.Information("cp4 In:" + cp4InStr);
        LogB.Information("cp4 Out:" + cp4OutStr + "\n");


        /*
         * if on run analysis arrive to 2nd platform while we are flying, then
         * there are more TCs than TFs
         * if last event was tc, it has no sense, it should be deleted
         */
        if (type == Constants.RunAnalysisName)
        {
            cp2InStr = Util.DeleteLastTcIfNeeded(cp2InStr, cp2OutStr);
        }


        if (tempTable)        //TODO
        {
            uniqueID = SqliteMultiChronopic.Insert(false, Constants.TempMultiChronopicTable, "NULL",
                                                   personID, sessionID, type,
                                                   Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                                                   Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                                                   cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                                                   cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                                                   vars, //distance
                                                   description, Util.BoolToNegativeInt(simulated)
                                                   );
        }
        else
        {
            uniqueID = SqliteMultiChronopic.Insert(false, Constants.MultiChronopicTable, "NULL",
                                                   personID, sessionID, type,
                                                   Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                                                   Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                                                   cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                                                   cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                                                   vars, //distance
                                                   description, Util.BoolToNegativeInt(simulated)
                                                   );

            //define the created object
            eventDone = new MultiChronopic(uniqueID, personID, sessionID, type,
                                           Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                                           Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                                           cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                                           cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                                           vars, //distance
                                           description, Util.BoolToNegativeInt(simulated));
        }
    }
    protected override System.Object getObjectFromString(string [] myStringOfData)
    {
        MultiChronopic mc = new MultiChronopic();
        mc.UniqueID = Convert.ToInt32(myStringOfData[1].ToString());
        mc.Type = myStringOfData[4].ToString();
        mc.Cp1StartedIn = Convert.ToInt32(myStringOfData[5].ToString());
        mc.Cp2StartedIn = Convert.ToInt32(myStringOfData[6].ToString());
        mc.Cp3StartedIn = Convert.ToInt32(myStringOfData[7].ToString());
        mc.Cp4StartedIn = Convert.ToInt32(myStringOfData[8].ToString());
        mc.Cp1InStr = myStringOfData[9].ToString();
        mc.Cp1OutStr = myStringOfData[10].ToString();
        mc.Cp2InStr = myStringOfData[11].ToString();
        mc.Cp2OutStr = myStringOfData[12].ToString();
        mc.Cp3InStr = myStringOfData[13].ToString();
        mc.Cp3OutStr = myStringOfData[14].ToString();
        mc.Cp4InStr = myStringOfData[15].ToString();
        mc.Cp4OutStr = myStringOfData[16].ToString();
        mc.Vars = myStringOfData[17].ToString();
        mc.Description = myStringOfData[18].ToString();
        mc.Simulated = Convert.ToInt32(myStringOfData[19].ToString());

        return mc;
    }
Example #15
0
    protected void printMCs(string title)
    {
        int dec=preferences.digitsNumber; //decimals

        ArrayList myData = new ArrayList(1);

        if(myMCs.Length > 0)
            printTitles(title);

        foreach (string testString in myMCs) {
            myData = new ArrayList(1);

            myData.Add( "\n" +
                    Catalog.GetString("Person ID") + ":" +
                    Catalog.GetString("Person name") + ":" +
                    Catalog.GetString("MC ID") + ":" +
                    Catalog.GetString("Type") + ":" +
                    Catalog.GetString("Description") + ":" +
                    Catalog.GetString("Simulated") );

            string [] myStr = testString.Split(new char[] {':'});
            MultiChronopic mc = new MultiChronopic();
            mc.UniqueID = Convert.ToInt32(myStr[1].ToString());
            mc.PersonID = Convert.ToInt32(myStr[2].ToString());
            mc.Type = myStr[4].ToString();
            mc.Cp1StartedIn = Convert.ToInt32(myStr[5].ToString());
            mc.Cp2StartedIn = Convert.ToInt32(myStr[6].ToString());
            mc.Cp3StartedIn = Convert.ToInt32(myStr[7].ToString());
            mc.Cp4StartedIn = Convert.ToInt32(myStr[8].ToString());
            mc.Cp1InStr = myStr[9].ToString();
            mc.Cp1OutStr = myStr[10].ToString();
            mc.Cp2InStr = myStr[11].ToString();
            mc.Cp2OutStr = myStr[12].ToString();
            mc.Cp3InStr = myStr[13].ToString();
            mc.Cp3OutStr = myStr[14].ToString();
            mc.Cp4InStr = myStr[15].ToString();
            mc.Cp4OutStr = myStr[16].ToString();
            mc.Vars = myStr[17].ToString();
            mc.Description = myStr[18].ToString();
            mc.Simulated = Convert.ToInt32(myStr[19].ToString());

            string typeExtra = mc.GetCPsString();
            if(mc.Type == Constants.RunAnalysisName)
                typeExtra = mc.Vars + " cm.";

            myData.Add (
                    mc.PersonID + ":" +
                    myStr[0] + ":" +  mc.UniqueID + ":" +  	//person.name, mc.uniqueID
                    mc.Type + " " + typeExtra  + ":" +
                    Util.RemoveNewLine(mc.Description, true) + ":" +
                    Util.SimulatedTestNoYes(Convert.ToInt32(mc.Simulated.ToString()))
                   );

            writeData(myData);

            myData = new ArrayList(1);

            string cols4 = ": : : :";
            myData.Add( mc.DeleteCols(
                        " " + ":" +
                        Catalog.GetString ("Time") + ":" +
                        Catalog.GetString ("State") + cols4 +
                        Catalog.GetString ("Change") + cols4 +
                        Catalog.GetString ("IN-IN") + cols4 +
                        Catalog.GetString ("OUT-OUT") + cols4
                        , mc.CPs(), false)
                  );

            string titleStr = "CP1:CP2:CP3:CP4:";
            myData.Add( mc.DeleteCols(
                        " " + ":" +
                        " " + ":" +
                        titleStr +
                        titleStr +
                        titleStr +
                        titleStr
                        , mc.CPs(), false)
                  );

            string [] averages = mc.Statistics(true, dec); //first boolean is averageOrSD
            int count = 0;
            myData.Add( mc.DeleteCols(
                        Catalog.GetString("AVG") + ": : " + cols4 + " " + cols4 +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( averages[count++], dec ))
                        , mc.CPs(), false)
                  );

            string [] sds = mc.Statistics(false, dec); //first boolean is averageOrSD
            count = 0;
            myData.Add( mc.DeleteCols(
                        Catalog.GetString("SD") + ": : " + cols4 + " " + cols4 +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec )) + ":" +
                        Util.RemoveZeroOrMinus(Util.TrimDecimals( sds[count++], dec ))
                        , mc.CPs(), false)

                    );

            ArrayList array = mc.AsArrayList(dec);
            foreach(string row in array)
                myData.Add(mc.DeleteCols(row, mc.CPs(), true));

            writeData(myData);
            writeData("VERTICAL-SPACE");
        }
    }
Example #16
0
 public void UploadMultiChronopicAsync(MultiChronopic myTest, object userState)
 {
     if ((this.UploadMultiChronopicOperationCompleted == null)) {
         this.UploadMultiChronopicOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadMultiChronopicCompleted);
     }
     this.InvokeAsync("UploadMultiChronopic", new object[] {
                 myTest}, this.UploadMultiChronopicOperationCompleted, userState);
 }
    public static MultiChronopic SelectMultiChronopicData(int uniqueID, bool dbconOpened)
    {
        if(!dbconOpened)
            dbcon.Open();

        dbcmd.CommandText = "SELECT * FROM " + Constants.MultiChronopicTable + " WHERE uniqueID == " + uniqueID;

        Log.WriteLine(dbcmd.CommandText.ToString());

        dbcmd.ExecuteNonQuery();

        SqliteDataReader reader;
        reader = dbcmd.ExecuteReader();
        reader.Read();

        MultiChronopic mc = new MultiChronopic(DataReaderToStringArray(reader, 19));

        reader.Close();
        if(!dbconOpened)
            dbcon.Close();
        return mc;
    }
Example #18
0
    //upload a test
    private static Constants.UploadCodes serverUploadTest(ChronojumpServer myServer, Constants.TestTypes type, string tableName, Event myTest)
    {
        Constants.UploadCodes uCode;

        if (myTest.Simulated == Constants.Simulated)
        {
            //Test is simulated, don't upload
            uCode = Constants.UploadCodes.SIMULATED;
        }
        else if (myTest.Simulated > 0)
        {
            //Test is already uploaded, don't upload
            uCode = Constants.UploadCodes.EXISTS;
        }
        else
        {
            int idAtServer = -1;
            switch (type)
            {
            case Constants.TestTypes.JUMP:
                Jump jump = (Jump)myTest;
                idAtServer = myServer.UploadJump(jump);
                break;

            case Constants.TestTypes.JUMP_RJ:
                JumpRj jumpRj = (JumpRj)myTest;
                idAtServer = myServer.UploadJumpRj(jumpRj);
                break;

            case Constants.TestTypes.RUN:
                Run run = (Run)myTest;
                idAtServer = myServer.UploadRun(run);
                break;

            case Constants.TestTypes.RUN_I:
                RunInterval runI = (RunInterval)myTest;
                idAtServer = myServer.UploadRunI(runI);
                break;

            case Constants.TestTypes.RT:
                ReactionTime rt = (ReactionTime)myTest;
                idAtServer = myServer.UploadRT(rt);
                break;

            case Constants.TestTypes.PULSE:
                Pulse pulse = (Pulse)myTest;
                idAtServer = myServer.UploadPulse(pulse);
                break;

            case Constants.TestTypes.MULTICHRONOPIC:
                MultiChronopic mc = (MultiChronopic)myTest;
                idAtServer = myServer.UploadMultiChronopic(mc);
                break;
            }


            //update test (simulated) on client database
            myTest.Simulated = idAtServer;
            SqliteEvent.UpdateSimulated(true, tableName, myTest.UniqueID, idAtServer);

            uCode = Constants.UploadCodes.OK;
        }
        return(uCode);
    }
    protected override string [] getSubLineToStore(System.Object myObject, int lineCount)
    {
        MultiChronopic mc = (MultiChronopic)myObject;

        //write line for treeview
        string [] myData = new String [19 + 1];

        if (mc.Type == Constants.RunAnalysisName)
        {
            if (lineCount == 0)
            {
                int count = 0;
                myData[count++] = Catalog.GetString("Stride");
                myData[count++] = "TC";
                myData[count++] = "TF";
                myData[count++] = "TT";
                myData[count++] = Catalog.GetString("Freq.");
                myData[count++] = Catalog.GetString("Width");
                myData[count++] = Catalog.GetString("Height");
                myData[count++] = Catalog.GetString("Angle");
                for (int i = 0; i < 10; i++)
                {
                    myData[count++] = "";
                }

                myData[count++] = "";                 //description column
                myData[count++] = "-1";               //mark to non select here, select first line
                return(mc.DeleteCols(myData, maxCPs, false));
            }
            else
            {
                ArrayList array = mc.AsArrayList(pDN);
                return(mc.DeleteCols(array[lineCount - 1].ToString().Split(new char[] { ':' }), maxCPs, false));
            }
        }

        //not runAnalsysis
        if (lineCount == 0)
        {
            int count = 0;
            myData[count++] = "0";
            myData[count++] = "0";
            myData[count++] = Util.BoolToInOut(Util.IntToBool(mc.Cp1StartedIn));
            myData[count++] = Util.BoolToInOut(Util.IntToBool(mc.Cp2StartedIn));
            myData[count++] = Util.BoolToInOut(Util.IntToBool(mc.Cp3StartedIn));
            myData[count++] = Util.BoolToInOut(Util.IntToBool(mc.Cp4StartedIn));

            for (int i = 0; i < 12; i++)
            {
                myData[count++] = "";
            }

            myData[count++] = "";             //description column
            myData[count++] = "-1";           //mark to non select here, select first line
            return(mc.DeleteCols(myData, maxCPs, false));
        }
        else
        {
            ArrayList array = mc.AsArrayList(pDN);
            return(mc.DeleteCols(array[lineCount - 1].ToString().Split(new char[] { ':' }), maxCPs, false));
        }
    }
    /*
    maybe we come here four times, one for any chronopic,
    best is to put one bool in order to only let on get inside
    */
    //bool writingStarted;
    public override void MultiChronopicWrite(bool tempTable)
    {
        Log.WriteLine("----------WRITING A----------");
        //	if(writingStarted)
        //		return;
        //	else
        //		writingStarted = true; //only one execution can "get in"
        Log.WriteLine("----------WRITING B----------");

        Console.WriteLine("cp1 In:" + cp1InStr);
        Console.WriteLine("cp1 Out:" + cp1OutStr + "\n");
        Console.WriteLine("cp2 In:" + cp2InStr);
        Console.WriteLine("cp2 Out:" + cp2OutStr + "\n");
        Console.WriteLine("cp3 In:" + cp3InStr);
        Console.WriteLine("cp3 Out:" + cp3OutStr + "\n");
        Console.WriteLine("cp4 In:" + cp4InStr);
        Console.WriteLine("cp4 Out:" + cp4OutStr + "\n");

        /*
           if on run analysis arrive to 2nd platform while we are flying, then
           there are more TCs than TFs
           if last event was tc, it has no sense, it should be deleted
        */
        if(type == Constants.RunAnalysisName)
            cp2InStr = Util.DeleteLastTcIfNeeded(cp2InStr, cp2OutStr);

        if(tempTable) //TODO
            uniqueID = SqliteMultiChronopic.Insert(false, Constants.TempMultiChronopicTable, "NULL",
                    personID, sessionID, type,
                    Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                    Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                    cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                    cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                    vars, //distance
                    description, Util.BoolToNegativeInt(simulated)
                    );
        else {
            uniqueID = SqliteMultiChronopic.Insert(false, Constants.MultiChronopicTable, "NULL",
                    personID, sessionID, type,
                    Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                    Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                    cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                    cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                    vars, //distance
                    description, Util.BoolToNegativeInt(simulated)
                    );

            //define the created object
            eventDone = new MultiChronopic(uniqueID, personID, sessionID, type,
                    Util.BoolToInt(cp1StartedIn), Util.BoolToInt(cp2StartedIn),
                    Util.BoolToInt(cp3StartedIn), Util.BoolToInt(cp4StartedIn),
                    cp1InStr, cp1OutStr, cp2InStr, cp2OutStr,
                    cp3InStr, cp3OutStr, cp4InStr, cp4OutStr,
                    vars, //distance
                    description, Util.BoolToNegativeInt(simulated));
        }
    }
    private void initValues()
    {
        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonEventEnded = new Gtk.Button();
        fakeButtonFinished = new Gtk.Button();
        simulated = false;

        cp1InStr = "";
        cp1OutStr = "";
        cp2InStr = "";
        cp2OutStr = "";
        cp3InStr = "";
        cp3OutStr = "";
        cp4InStr = "";
        cp4OutStr = "";

        if(type == Constants.RunAnalysisName) {
            syncFirst = false;
            deleteFirst = false;
        }

        //initialize eventDone as a mc
        eventDone = new MultiChronopic();
    }
Example #22
0
 public int UploadMultiChronopic(MultiChronopic myTest)
 {
     object[] results = this.Invoke("UploadMultiChronopic", new object[] {
                 myTest});
     return ((int)(results[0]));
 }
Example #23
0
 public void UploadMultiChronopicAsync(MultiChronopic myTest)
 {
     this.UploadMultiChronopicAsync(myTest, null);
 }
Example #24
0
    private static void on_server_upload_session_started()
    {
        int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));

        try {
            ChronojumpServer myServer = new ChronojumpServer();
            LogB.Information(myServer.ConnectDatabase());

            int state = (int)Constants.ServerSessionStates.UPLOADINGSESSION;
            //create ServerSession based on Session currentSession
            ServerSession serverSession = new ServerSession(currentSession, evalSID, progName + " " + progVersion,
                                                            UtilAll.GetOS(), DateTime.Now, state);

            //if uploading session for first time
            if (currentSession.ServerUniqueID == Constants.ServerUndefinedID)
            {
                //upload ServerSession
                int idAtServer = myServer.UploadSession(serverSession);

                //update session currentSession (serverUniqueID) on client database
                currentSession.ServerUniqueID = idAtServer;
                SqliteSession.UpdateServerUniqueID(currentSession.UniqueID, currentSession.ServerUniqueID);
            }

            state = (int)Constants.ServerSessionStates.UPLOADINGDATA;
            myServer.UpdateSession(currentSession.ServerUniqueID, state);

            sessionUploadPersonData.testTypes = "";
            string testTypesSeparator = "";
            sessionUploadPersonData.sports = "";
            string sportsSeparator = "";

            //upload persons (updating also person.serverUniqueID locally)
            ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
                serverSession.UniqueID,
                false);                         //means: do not returnPersonAndPSlist

            Constants.UploadCodes uCode;
            ArrayList             notToUpload = SqlitePersonSessionNotUpload.SelectAll(currentSession.UniqueID);

            //store in variable for updating progressBar from other thread
            progressBarPersonsNum = persons.Count - notToUpload.Count;

            foreach (Person p in persons)
            {
                Person person = p;

                //do not continue with this person if has been banned to upload
                if (Util.FoundInArrayList(notToUpload, person.UniqueID.ToString()))
                {
                    continue;
                }

                PersonSession ps = SqlitePersonSession.Select(person.UniqueID, currentSession.UniqueID);

                //check person if exists
                if (person.ServerUniqueID != Constants.ServerUndefinedID)
                {
                    uCode = Constants.UploadCodes.EXISTS;
                }
                else
                {
                    uCode = Constants.UploadCodes.OK;

                    person = serverUploadPerson(myServer, person, serverSession.UniqueID);
                }

                //if sport is user defined, upload it
                //and when upload the person, do it with new sportID
                Sport sport = SqliteSport.Select(false, ps.SportID);
                //but record old sport ID because locally will be a change in serverUniqueID
                //(with slite update)
                //but local sport has not to be changed
                int sportUserDefinedLocal = -1;

                if (sport.UserDefined)
                {
                    sportUserDefinedLocal = sport.UniqueID;

                    //this will be uploaded
                    int newSport = myServer.UploadSport(sport);
                    if (newSport != -1)
                    {
                        ps.SportID = newSport;
                        sessionUploadPersonData.sports += sportsSeparator + sport.Name;
                        sportsSeparator = ", ";
                    }
                }

                //a person can be in the database for one session,
                //but maybe now we add jumps from another session and we should add an entry at personsession
                serverUploadPersonSessionIfNeeded(myServer, person.ServerUniqueID,
                                                  currentSession.ServerUniqueID, ps, sportUserDefinedLocal);

                //other thread updates the gui:
                sessionUploadPersonData.person     = person;
                sessionUploadPersonData.personCode = uCode;

                //upload jumps
                int countU = 0;
                int countE = 0;
                int countS = 0;

                string [] jumps = SqliteJump.SelectJumps(false, currentSession.UniqueID, person.UniqueID, "", "",
                                                         Sqlite.Orders_by.DEFAULT, -1);
                Sqlite.Open();
                foreach (string myJump in jumps)
                {
                    string [] js = myJump.Split(new char[] { ':' });
                    //select jump
                    Jump test = SqliteJump.SelectJumpData(Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;

                    //if test is not simulated and has not been uploaded,
                    //see if it's type is not predefined and is not in the database
                    //then upload it first
                    if (test.Simulated == 0)
                    {
                        //upload jumpType if is user defined and doesn't exists in server database
                        //JumpType type = new JumpType(test.Type);
                        JumpType type = SqliteJumpType.SelectAndReturnJumpType(test.Type, true);
                        if (!type.IsPredefined)
                        {
                            //Console.WriteLine("USER DEFINED TEST: " + test.Type);
                            //
                            //this uploads the new type, as it's user created, it will be like this
                            //eg: for user defined jumpType: "supra" of evaluatorServerID: 9
                            //at server will be "supra-9"
                            //then two problems get solved:
                            //1.- every evaluator that uploads a type will have a different name
                            //than other evaluator uploading a type that is named the same but could be different
                            //(one can think that "supra" is another thing
                            //2- when the same evaluator upload some supra's, only a new type is created

                            //test.Type = myServer.UploadJumpType(type, evalSID);
                            //int testType = (int) Constants.TestTypes.JUMP;
                            //string insertedType = myServer.UploadTestType(Constants.TestTypes.JUMP, type, evalSID);
                            //string insertedType = myServer.UploadTestType(testType, type, evalSID);
                            string insertedType = myServer.UploadJumpType(type, evalSID);
                            if (insertedType != "-1")
                            {
                                //record type in test (with the "-7" if it's done by evaluator 7)
                                test.Type = insertedType;

                                //show user uploaded type (without the "-7")
                                sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
                                testTypesSeparator = ", ";
                            }

                            //test.Type in the server will have the correct name "supra-9"
                        }
                    }

                    //upload... (if not because of simulated or uploaded before, report also the user)
                    uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP, Constants.JumpTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.jumpsU = countU;
                sessionUploadPersonData.jumpsE = countE;
                sessionUploadPersonData.jumpsS = countS;

                //upload jumpsRj
                countU = 0;
                countE = 0;
                countS = 0;

                string [] jumpsRj = SqliteJumpRj.SelectJumps(false, currentSession.UniqueID, person.UniqueID, "", "");
                Sqlite.Open();
                foreach (string myJump in jumpsRj)
                {
                    string [] js = myJump.Split(new char[] { ':' });
                    //select jump
                    JumpRj test = SqliteJumpRj.SelectJumpData(Constants.JumpRjTable, Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;

                    if (test.Simulated == 0)
                    {
                        JumpType type = SqliteJumpType.SelectAndReturnJumpRjType(test.Type, true);
                        if (!type.IsPredefined)
                        {
                            string insertedType = myServer.UploadJumpRjType(type, evalSID);
                            if (insertedType != "-1")
                            {
                                test.Type = insertedType;
                                sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
                                testTypesSeparator = ", ";
                            }
                        }
                    }

                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP_RJ, Constants.JumpRjTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.jumpsRjU = countU;
                sessionUploadPersonData.jumpsRjE = countE;
                sessionUploadPersonData.jumpsRjS = countS;

                //upload runs
                countU = 0;
                countE = 0;
                countS = 0;

                string [] runs = SqliteRun.SelectRuns(false, currentSession.UniqueID, person.UniqueID, "",
                                                      Sqlite.Orders_by.DEFAULT, -1);

                Sqlite.Open();
                foreach (string myRun in runs)
                {
                    string [] js = myRun.Split(new char[] { ':' });
                    //select run
                    Run test = SqliteRun.SelectRunData(Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;

                    if (test.Simulated == 0)
                    {
                        RunType type = SqliteRunType.SelectAndReturnRunType(test.Type, true);
                        if (!type.IsPredefined)
                        {
                            string insertedType = myServer.UploadRunType(type, evalSID);
                            if (insertedType != "-1")
                            {
                                test.Type = insertedType;
                                sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
                                testTypesSeparator = ", ";
                            }
                        }
                    }

                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.RUN, Constants.RunTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.runsU = countU;
                sessionUploadPersonData.runsE = countE;
                sessionUploadPersonData.runsS = countS;

                //upload runs intervallic
                countU = 0;
                countE = 0;
                countS = 0;

                string [] runsI = SqliteRunInterval.SelectRuns(false, currentSession.UniqueID, person.UniqueID, "");
                Sqlite.Open();
                foreach (string myRun in runsI)
                {
                    string [] js = myRun.Split(new char[] { ':' });
                    //select run
                    RunInterval test = SqliteRunInterval.SelectRunData(Constants.RunIntervalTable, Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;

                    if (test.Simulated == 0)
                    {
                        RunType type = SqliteRunIntervalType.SelectAndReturnRunIntervalType(test.Type, true);
                        if (!type.IsPredefined)
                        {
                            string insertedType = myServer.UploadRunIntervalType(type, evalSID);
                            if (insertedType != "-1")
                            {
                                test.Type = insertedType;
                                sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
                                testTypesSeparator = ", ";
                            }
                        }
                    }
                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.RUN_I, Constants.RunIntervalTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.runsIU = countU;
                sessionUploadPersonData.runsIE = countE;
                sessionUploadPersonData.runsIS = countS;

                //upload reaction times
                countU = 0;
                countE = 0;
                countS = 0;

                string [] rts = SqliteReactionTime.SelectReactionTimes(false, currentSession.UniqueID, person.UniqueID,
                                                                       Sqlite.Orders_by.DEFAULT, -1);

                Sqlite.Open();
                foreach (string myRt in rts)
                {
                    string [] js = myRt.Split(new char[] { ':' });
                    //select rt
                    ReactionTime test = SqliteReactionTime.SelectReactionTimeData(Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;
                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.RT, Constants.ReactionTimeTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.rtsU = countU;
                sessionUploadPersonData.rtsE = countE;
                sessionUploadPersonData.rtsS = countS;

                //upload pulses
                countU = 0;
                countE = 0;
                countS = 0;

                string [] pulses = SqlitePulse.SelectPulses(false, currentSession.UniqueID, person.UniqueID);
                Sqlite.Open();
                foreach (string myPulse in pulses)
                {
                    string [] js = myPulse.Split(new char[] { ':' });
                    //select pulse
                    Pulse test = SqlitePulse.SelectPulseData(Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;
                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.PULSE, Constants.PulseTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.pulsesU = countU;
                sessionUploadPersonData.pulsesE = countE;
                sessionUploadPersonData.pulsesS = countS;

                //upload multiChronopic
                countU = 0;
                countE = 0;
                countS = 0;

                string [] mcs = SqliteMultiChronopic.SelectTests(false, currentSession.UniqueID, person.UniqueID);
                Sqlite.Open();
                foreach (string mc in mcs)
                {
                    string [] js = mc.Split(new char[] { ':' });
                    //select mc
                    MultiChronopic test = SqliteMultiChronopic.SelectMultiChronopicData(Convert.ToInt32(js[1]), true);                     //uniqueID
                    //fix it to server person, session keys
                    test.PersonID  = person.ServerUniqueID;
                    test.SessionID = currentSession.ServerUniqueID;
                    //upload...
                    uCode = serverUploadTest(myServer, Constants.TestTypes.MULTICHRONOPIC, Constants.MultiChronopicTable, test);

                    if (uCode == Constants.UploadCodes.OK)
                    {
                        countU++;
                    }
                    else if (uCode == Constants.UploadCodes.EXISTS)
                    {
                        countE++;
                    }
                    else                     //SIMULATED
                    {
                        countS++;
                    }
                }
                Sqlite.Close();

                //other thread updates the gui:
                sessionUploadPersonData.mcsU = countU;
                sessionUploadPersonData.mcsE = countE;
                sessionUploadPersonData.mcsS = countS;

                needUpdateServerSession = true;
                while (needUpdateServerSession)
                {
                    //wait until data is printed on the other thread
                }
            }

            state = (int)Constants.ServerSessionStates.DONE;
            //myServer.UpdateSession(currentSession.ServerUniqueID, (ServerSessionStates)  Constants.ServerSessionStates.DONE);
            myServer.UpdateSession(currentSession.ServerUniqueID, state);

            LogB.Information(myServer.DisConnectDatabase());
        } catch {
            //other thread updates the gui:
            serverSessionError = true;
        }
    }
 public int UploadMultiChronopic(MultiChronopic myTest)
 {
     int temp = myTest.UniqueID;
     myTest.UniqueID = -1;
     int id = myTest.InsertAtDB(false, Constants.MultiChronopicTable);
     myTest.UniqueID = temp;
     return id; //uniqueID of person at server
 }
Example #26
0
    protected void printMCs(string title)
    {
        int dec = preferences.digitsNumber;       //decimals

        ArrayList myData = new ArrayList(1);

        if (myMCs.Length > 0)
        {
            printTitles(title);
        }

        foreach (string testString in myMCs)
        {
            myData = new ArrayList(1);

            myData.Add("\n" +
                       Catalog.GetString("Person ID") + ":" +
                       Catalog.GetString("Person name") + ":" +
                       Catalog.GetString("MC ID") + ":" +
                       Catalog.GetString("Type") + ":" +
                       Catalog.GetString("Description") + ":" +
                       Catalog.GetString("Simulated"));

            string []      myStr = testString.Split(new char[] { ':' });
            MultiChronopic mc    = new MultiChronopic();
            mc.UniqueID     = Convert.ToInt32(myStr[1].ToString());
            mc.PersonID     = Convert.ToInt32(myStr[2].ToString());
            mc.Type         = myStr[4].ToString();
            mc.Cp1StartedIn = Convert.ToInt32(myStr[5].ToString());
            mc.Cp2StartedIn = Convert.ToInt32(myStr[6].ToString());
            mc.Cp3StartedIn = Convert.ToInt32(myStr[7].ToString());
            mc.Cp4StartedIn = Convert.ToInt32(myStr[8].ToString());
            mc.Cp1InStr     = myStr[9].ToString();
            mc.Cp1OutStr    = myStr[10].ToString();
            mc.Cp2InStr     = myStr[11].ToString();
            mc.Cp2OutStr    = myStr[12].ToString();
            mc.Cp3InStr     = myStr[13].ToString();
            mc.Cp3OutStr    = myStr[14].ToString();
            mc.Cp4InStr     = myStr[15].ToString();
            mc.Cp4OutStr    = myStr[16].ToString();
            mc.Vars         = myStr[17].ToString();
            mc.Description  = myStr[18].ToString();
            mc.Simulated    = Convert.ToInt32(myStr[19].ToString());

            string typeExtra = mc.GetCPsString();
            if (mc.Type == Constants.RunAnalysisName)
            {
                typeExtra = mc.Vars + " cm.";
            }

            myData.Add(
                mc.PersonID + ":" +
                myStr[0] + ":" + mc.UniqueID + ":" +                            //person.name, mc.uniqueID
                mc.Type + " " + typeExtra + ":" +
                Util.RemoveNewLine(mc.Description, true) + ":" +
                Util.SimulatedTestNoYes(Convert.ToInt32(mc.Simulated.ToString()))
                );

            writeData(myData);

            myData = new ArrayList(1);

            string cols4 = ": : : :";
            myData.Add(mc.DeleteCols(
                           " " + ":" +
                           Catalog.GetString("Time") + ":" +
                           Catalog.GetString("State") + cols4 +
                           Catalog.GetString("Change") + cols4 +
                           Catalog.GetString("IN-IN") + cols4 +
                           Catalog.GetString("OUT-OUT") + cols4
                           , mc.CPs(), false)
                       );

            string titleStr = "CP1:CP2:CP3:CP4:";
            myData.Add(mc.DeleteCols(
                           " " + ":" +
                           " " + ":" +
                           titleStr +
                           titleStr +
                           titleStr +
                           titleStr
                           , mc.CPs(), false)
                       );

            string [] averages = mc.Statistics(true, dec);             //first boolean is averageOrSD
            int       count    = 0;
            myData.Add(mc.DeleteCols(
                           Catalog.GetString("AVG") + ": : " + cols4 + " " + cols4 +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(averages[count++], dec))
                           , mc.CPs(), false)
                       );

            string [] sds = mc.Statistics(false, dec);             //first boolean is averageOrSD
            count = 0;
            myData.Add(mc.DeleteCols(
                           Catalog.GetString("SD") + ": : " + cols4 + " " + cols4 +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec)) + ":" +
                           Util.RemoveZeroOrMinus(Util.TrimDecimals(sds[count++], dec))
                           , mc.CPs(), false)

                       );

            ArrayList array = mc.AsArrayList(dec);
            foreach (string row in array)
            {
                myData.Add(mc.DeleteCols(row, mc.CPs(), true));
            }


            writeData(myData);
            writeData("VERTICAL-SPACE");
        }
    }