Insert() public static method

public static Insert ( RunType, t, string tableName, bool dbconOpened ) : int
t RunType,
tableName string
dbconOpened bool
return int
コード例 #1
0
    public string UploadRunIntervalType(RunType type, int evalSID)
    {
        string typeServer = type.Name + "-" + evalSID.ToString();

        Console.WriteLine("RUN_I" + typeServer + ":" + type.Distance + ":" + type.Description);
        if (!Sqlite.Exists(false, Constants.RunIntervalTypeTable, typeServer))
        {
            type.Name = typeServer;
            SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, false);
            return(typeServer);
        }
        return("-1");
    }
コード例 #2
0
ファイル: runType.cs プロジェクト: kleopatra999/chronojump
 //used by Sqlite.convertTables
 //public override int InsertAtDB (bool dbconOpened, string tableName, bool interval) {
 public int InsertAtDB(bool dbconOpened, string tableName, bool interval)
 {
     if (interval)
     {
         /*
          * return SqliteRunIntervalType.Insert(dbconOpened, tableName,
          *              name, distance, tracksLimited, fixedValue,
          *              unlimited, description);
          */
         return(SqliteRunIntervalType.Insert(this, tableName, dbconOpened));
     }
     else
     {
         /*
          * return SqliteRunType.Insert(dbconOpened, tableName,
          *              name, distance, description);
          */
         return(SqliteRunType.Insert(this, tableName, dbconOpened));
     }
 }
コード例 #3
0
ファイル: runType.cs プロジェクト: davidfombella/chronojump
    void on_button_accept_clicked(object o, EventArgs args)
    {
        //ConsoleB.Information(getEntriesString());
        string name = Util.RemoveTildeAndColonAndDot(entry_name.Text);

        //check if this run type exists, and check it's name is not AllRunsName
        bool runTypeExists = Sqlite.Exists(false, Constants.RunTypeTable, name);

        if (name == Constants.AllRunsName)
        {
            runTypeExists = true;
        }

        if (runTypeExists)
        {
            string myString = string.Format(Catalog.GetString("Race type: '{0}' exists. Please, use another name"), name);
            LogB.Information(myString);
            ErrorWindow.Show(myString);
        }
        else
        {
            RunType type = new RunType();
            type.Name        = name;
            type.Description = Util.RemoveTildeAndColon(textview_description.Buffer.Text);

            if (radiobutton_dist_variable.Active)
            {
                type.Distance = 0;
            }
            else if (radiobutton_dist_fixed.Active)
            {
                type.Distance = spin_distance_fixed.Value;
            }
            else
            {
                //dist_different (only on intervallic)
                type.Distance        = -1;
                type.DistancesString = getEntriesString();
            }

            if (radiobutton_simple.Active)
            {
                SqliteRunType.Insert(type, Constants.RunTypeTable, false);                 //false, because dbcon is not opened
                InsertedSimple = true;
            }
            else
            {
                if (radiobutton_unlimited.Active)
                {
                    //unlimited (but in runs do like if it's limited by seconds: TracksLimited = false
                    //(explanation in sqlite/jumpType.cs)
                    type.TracksLimited = false;
                    type.FixedValue    = 0;
                    type.Unlimited     = true;
                }
                else
                {
                    type.TracksLimited = radiobutton_limited_tracks.Active;

                    if (checkbutton_limited_fixed.Active)
                    {
                        type.FixedValue = Convert.ToInt32(spin_fixed_tracks_or_time.Value);
                    }
                    else
                    {
                        type.FixedValue = 0;
                    }


                    type.Unlimited = false;
                }

                SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, false);                 //false, because dbcon is not opened
                InsertedSimple = false;
            }

            //LogB.Information(string.Format("Inserted: {0}", type));

            fakeButtonAccept.Click();

            RunTypeAddWindowBox.run_type_add.Hide();
            RunTypeAddWindowBox = null;
        }
    }