Insert() публичный статический Метод

public static Insert ( bool dbconOpened, string tableName, string uniqueID, int personID, int sessionID, string type, double tvMax, double tcMax, double fall, double weight, string description, double tvAvg, double tcAvg, string tvString, string tcString, int jumps, double time, string limited, string angleString, int simulated ) : int
dbconOpened bool
tableName string
uniqueID string
personID int
sessionID int
type string
tvMax double
tcMax double
fall double
weight double
description string
tvAvg double
tcAvg double
tvString string
tcString string
jumps int
time double
limited string
angleString string
simulated int
Результат int
Пример #1
0
 public override int InsertAtDB(bool dbconOpened, string tableName)
 {
     return(SqliteJumpRj.Insert(dbconOpened, tableName,
                                uniqueID.ToString(),
                                personID, sessionID,
                                type, TvMax, TcMax, fall, weight,
                                description, TvAvg, TcAvg, tvString, tcString,
                                jumps, time, limited,
                                angleString, simulated));
 }
Пример #2
0
    protected void writeRj(bool tempTable)
    {
        LogB.Information("----------WRITING----------");
        int    jumps;
        string limitString = "";
        string description = "";

        //if user clicked in finish earlier
        //or toggled with shouldFinishAtNextTime
        if (finish)
        {
            //if user clicked finish and last event was tc, probably there are more TCs than TFs
            //if last event was tc, it has no sense, it should be deleted
            tcString = Util.DeleteLastTcIfNeeded(tcString, tvString);

            //when we mark that jump should finish by time, chronopic thread is probably capturing data
            //check if it captured more than date limit, and if it has done, delete last(s) jump(s)
            //also have in mind that allowFinishAfterTime exist
            bool deletedEvent = false;
            if (!jumpsLimited && limitAsDouble != -1)
            {
                bool eventPassed = Util.EventPassedFromMaxTime(tcString, tvString, limitAsDouble, allowFinishAfterTime);
                while (eventPassed)
                {
                    tcString = Util.DeleteLastSubEvent(tcString);
                    tvString = Util.DeleteLastSubEvent(tvString);
                    LogB.Information("Deleted one event out of time");
                    eventPassed  = Util.EventPassedFromMaxTime(tcString, tvString, limitAsDouble, allowFinishAfterTime);
                    deletedEvent = true;
                }
            }
            if (deletedEvent)
            {
                //update graph if a event was deleted
                PrepareEventGraphJumpReactiveObject = new PrepareEventGraphJumpReactive(Util.GetLast(tvString), Util.GetLast(tcString), tvString, tcString);
                needUpdateGraphType = eventType.JUMPREACTIVE;
                needUpdateGraph     = true;



                //try to fix this:
                //http://mail.gnome.org/archives/chronojump-list/2007-June/msg00013.html
                updateProgressBar = new UpdateProgressBar(
                    true,                                                     //isEvent
                    jumpsLimited,                                             //if jumpsLimited: do fraction; if time limited: do pulse
                    Util.GetNumberOfJumps(tvString, false)
                    );
                needUpdateEventProgressBar = true;
                //and this:
                //http://mail.gnome.org/archives/chronojump-list/2007-June/msg00017.html
                updateTimerCountWithChronopicData(tcString, tvString);
            }

            jumps = Util.GetNumberOfJumps(tvString, false);


            if (jumpsLimited)
            {
                limitString = jumps.ToString() + "J";
            }
            else
            {
                limitString = Util.GetTotalTime(tcString, tvString) + "T";
                limited     = limitString;             //define limited because it's checked in treeviewJump, and possibly it's not the initial defined time (specially when allowFinishRjAfterTime is true)
                //leave the initial selected time into description/comments:
                description = string.Format(Catalog.GetString("Initially selected {0} seconds"), limitAsDouble.ToString());
            }
        }
        else
        {
            if (jumpsLimited)
            {
                limitString = limitAsDouble.ToString() + "J";
                jumps       = (int)limitAsDouble;
            }
            else
            {
                //if time finished and the last event was tc, probably there are more TCs than TFs
                //if last event was tc, it has no sense, it should be deleted
                //this is not aplicable in tempTable
                if (!tempTable)
                {
                    tcString = Util.DeleteLastTcIfNeeded(tcString, tvString);
                }

                //limitString = limitAsDouble.ToString() + "T";
                limitString = Util.GetTotalTime(tcString, tvString) + "T";
                limited     = limitString;             //define limited because it's checked in treeviewJump, and possibly it's not the initial defined time (specially when allowFinishRjAfterTime is true)

                //leave the initial selected time into description/comments:
                description = string.Format(Catalog.GetString("Initially selected {0} seconds"), limitAsDouble.ToString());

                string [] myStringFull = tcString.Split(new char[] { '=' });
                jumps = myStringFull.Length;
            }
        }

        if (type == Constants.RunAnalysisName)
        {
            //double speed = (fall /10) / Util.GetTotalTime(tcString, tvString);

            /*
             *		Josep Ma Padullés test
             *
             *              string tcStringWithoutFirst = Util.DeleteFirstSubEvent(tcString);
             *              string tvStringWithoutFirst = Util.DeleteFirstSubEvent(tvString);
             *
             *              double averagePlatformTimes = ( Util.GetAverage(tcStringWithoutFirst) + Util.GetAverage(tvStringWithoutFirst) ) / 2;
             *              double freq = 1 / averagePlatformTimes;
             *
             *              //amplitud
             *              double range = speed / freq;
             *
             *              //don't put "=" because can appear problems in different parts of the code
             *              description =
             *                      Catalog.GetString ("AVG speed") + "->" + Util.TrimDecimals(speed.ToString(), pDN) + "m/s, " +
             *                      Catalog.GetString ("AVG frequencies") + "->" + Util.TrimDecimals(freq.ToString(), pDN) + "Hz, " +
             *                      Catalog.GetString ("AVG range") + "->" + Util.TrimDecimals(range.ToString(), pDN) + "m.";
             */
        }


        if (tempTable)
        {
            SqliteJumpRj.Insert(false, Constants.TempJumpRjTable, "NULL", personID, sessionID,
                                type, Util.GetMax(tvString), Util.GetMax(tcString),
                                fall, weight, description,
                                Util.GetAverage(tvString), Util.GetAverage(tcString),
                                tvString, tcString,
                                jumps, Util.GetTotalTime(tcString, tvString), limitString, angleString, Util.BoolToNegativeInt(simulated)
                                );
        }
        else
        {
            uniqueID = SqliteJumpRj.Insert(false, Constants.JumpRjTable, "NULL", personID, sessionID,
                                           type, Util.GetMax(tvString), Util.GetMax(tcString),
                                           fall, weight, description,
                                           Util.GetAverage(tvString), Util.GetAverage(tcString),
                                           tvString, tcString,
                                           jumps, Util.GetTotalTime(tcString, tvString), limitString, angleString, Util.BoolToNegativeInt(simulated)
                                           );

            //define the created object
            eventDone = new JumpRj(uniqueID, personID, sessionID, type, tvString, tcString, fall, weight, description, jumps, Util.GetTotalTime(tcString, tvString), limitString, angleString, Util.BoolToNegativeInt(simulated));


            //event will be raised, and managed in chronojump.cs

            /*
             * string myStringPush =
             *      //Catalog.GetString("Last jump: ") +
             *      personName + " " +
             *      type + " (" + limitString + ") " +
             *      " " + Catalog.GetString("AVG TF") + ": " + Util.TrimDecimals( Util.GetAverage (tvString).ToString(), pDN ) +
             *      " " + Catalog.GetString("AVG TC") + ": " + Util.TrimDecimals( Util.GetAverage (tcString).ToString(), pDN ) ;
             */
            if (simulated)
            {
                feedbackMessage = Catalog.GetString(Constants.SimulatedMessage);
            }
            else
            {
                feedbackMessage = "";
            }
            needShowFeedbackMessage = true;


            //event will be raised, and managed in chronojump.cs
            fakeButtonFinished.Click();

            needEndEvent = true;             //used for hiding some buttons on eventWindow, and also for updateTimeProgressBar here
        }
    }