Insert() public static method

public static Insert ( bool dbconOpened, string tableName, string uniqueID, int personID, int sessionID, string type, double distance, double time, string description, int simulated, bool initialSpeed ) : int
dbconOpened bool
tableName string
uniqueID string
personID int
sessionID int
type string
distance double
time double
description string
simulated int
initialSpeed bool
return int
Example #1
0
    protected override void write()
    {
        LogB.Information(string.Format("TIME: {0}", time.ToString()));

        /*
         * string myStringPush =   Catalog.GetString("Last run") + ": " + RunnerName + " " +
         *      type + " " + Catalog.GetString("time") + ": " + Util.TrimDecimals( time.ToString(), pDN ) +
         *      " " + Catalog.GetString("speed") + ": " + Util.TrimDecimals ( (distance/time).ToString(), pDN );
         */
        if (simulated)
        {
            feedbackMessage = Catalog.GetString(Constants.SimulatedMessage);
        }
        else
        {
            feedbackMessage = "";
        }
        needShowFeedbackMessage = true;


        string description = "";

        if (type == "Margaria")
        {
            // P = W * 9.8 * D / t
            // W: person weight
            // D: distance between 3d and 9th stair
            double weight         = SqlitePersonSession.SelectAttribute(false, personID, sessionID, Constants.Weight);
            double distanceMeters = distance / 1000;
            description = "P = " + Util.TrimDecimals((weight * 9.8 * distanceMeters / time).ToString(), pDN) + " (Watts)";
        }
        else if (type == "Gesell-DBT")
        {
            description = "0";
        }


        string table = Constants.RunTable;

        uniqueID = SqliteRun.Insert(false, table, "NULL", personID, sessionID,
                                    type, distance, time, description,
                                    Util.BoolToNegativeInt(simulated),
                                    !startIn    //initialSpeed true if not startIn
                                    );

        //define the created object
        eventDone = new Run(uniqueID, personID, sessionID, type, distance, time, description, Util.BoolToNegativeInt(simulated), !startIn);


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

        //app1.PrepareRunSimpleGraph(time, distance/time);
        PrepareEventGraphRunSimpleObject = new PrepareEventGraphRunSimple(time, distance / time, sessionID, personID, table, type);
        needUpdateGraphType = eventType.RUN;
        needUpdateGraph     = true;

        needEndEvent = true;         //used for hiding some buttons on eventWindow
    }
Example #2
0
 public override int InsertAtDB(bool dbconOpened, string tableName)
 {
     return(SqliteRun.Insert(dbconOpened, tableName,
                             uniqueID.ToString(),
                             personID, sessionID,
                             type, distance, time,
                             description, simulated, initialSpeed));
 }