Beispiel #1
0
        private void toolStripMenuItem9_Click(object sender, EventArgs e)
        {
            Tube    tube = dgvTube.Current as Tube;
            Execute E    = new Execute(string.Format("{0}.GetSG", Schema));

            E.Input("@id", tube.Id);
            E.OutputString("@group", 50);
            E.OutputDouble("@probability");
            E.OutputInt("@color");
            if (E.Exec() != 1)
            {
                prs("Не удалось рассчитать трубу (проверьте параметры трубы и эталонов)");
                return;
            }
            tube.SG     = E.AsString("@group");
            tube.Metric = E.AsDouble("@probability");
            dgvTube.bs.ResetCurrentItem();
            prs("Ок");
        }
Beispiel #2
0
        public static int TubeToEtalon(Tube _tb, Group.DBKey _gKey)
        {
            if (_gKey == null)
            {
                return(-1);
            }
            string SQL = string.Format(
                "insert {0}.SGEtalons output Inserted.ID" +
                " select '{1}','{2}'," +
                " (select isnull(max(id)+1,0) from {0}.SGEtalons where typeSize='{1}'and sGroup='{2}')" +
                " ,t.dt, t.sop, 'True', t.img" +
                " from Uran.SGTubes t where t.id={3}",
                BaseItem.Schema,
                _gKey.TSName,
                _gKey.GroupName,
                _tb.Id.ToString());
            Select S = new Select(SQL);

            if (!S.Read())
            {
                S.Dispose();
                return(-1);
            }
            int new_id = (int)S["id"];

            S.Dispose();
            SQL = string.Format(
                "insert {0}.SGEtalonPars" +
                " select '{1}','{2}',{3},p.par,p.val" +
                " from {0}.SGTubePars p" +
                " where p.tube_id={4}",
                BaseItem.Schema,
                _gKey.TSName,
                _gKey.GroupName,
                new_id.ToString(),
                _tb.Id.ToString());
            new ExecSQLX(SQL).Exec();
            return(new_id);
        }
Beispiel #3
0
 private void dg_DragDrop(object sender, DragEventArgs e)
 {
     if (DragTo)
     {
         Tube        tb     = e.Data.GetData(typeof(Tube)) as Tube;
         Group.DBKey gKey   = parentKey as Group.DBKey;
         int         new_id = Etalon.TubeToEtalon(tb, gKey);
         if (new_id < 0)
         {
             prs("Не удалось записать трубу в эталон");
             return;
         }
         RLoad();
         foreach (Etalon o in bs)
         {
             if (o.Id == new_id)
             {
                 bs.Position = bs.IndexOf(o);
                 break;
             }
         }
     }
 }