public static bool InsertKey(BaseDBKey _Key, BindingSource _bs) { Tube.DBKey Key = _Key as Tube.DBKey; int new_id = FindNewId(_bs); if (new ExecSQLX(string.Format("insert into {0}.SGTubePars values({1},{2},0)", BaseItem.Schema, Key.TubeId.ToString(), new_id.ToString())).Exec() == 1) { _bs.Position = _bs.Add(new TubePars(Key, new_id, 0)); return(true); } else { return(false); } }
public static void LoadKey(BaseDBKey _Key, BindingSource _bs) { _bs.Clear(); if (_Key == null) { return; } Tube.DBKey Key = _Key as Tube.DBKey; _bs.Clear(); Select S = new Select(string.Format("SELECT par, val from {0}.SGTubePars where tube_id={1} order by par", BaseItem.Schema, Key.TubeId )); while (S.Read()) { _bs.Add(new TubePars(Key, (int)S["par"], SD(S["val"]))); } S.Dispose(); }
TubePars(Tube.DBKey _parentKey, int _Id, double _Val) { ownKey = new DBKey(_parentKey, _Id); Val = _Val; }
public DBKey(Tube.DBKey _parentKey, int _Id) : base(_parentKey) { TubeParsId = _Id; }