Beispiel #1
0
        public void Add(SCPI e)
        {
            var sefact = new NhibernateUtils().GetSessionFactory();

            using (var session = sefact.OpenSession())
            {
                using (var tx = session.BeginTransaction())
                {
                    session.Save(e);
                    tx.Commit();
                }
            }
        }
Beispiel #2
0
        public SCPI GetSCPIByID(int id)
        {
            var scpis  = new SCPI();
            var sefact = new NhibernateUtils().GetSessionFactory();

            using (var session = sefact.OpenSession())
            {
                using (var tx = session.BeginTransaction())
                {
                    scpis = (SCPI)session.CreateCriteria <SCPI>().Add(Restrictions.Eq("ID", id)).UniqueResult();
                    tx.Commit();
                }
            }
            return(scpis);
        }
Beispiel #3
0
        public void AddPart(Part p, int id)
        {
            var scpis  = new SCPI();
            var sefact = new NhibernateUtils().GetSessionFactory();

            using (var session = sefact.OpenSession())
            {
                using (var tx = session.BeginTransaction())
                {
                    scpis = (SCPI)session.CreateCriteria <SCPI>().Add(Restrictions.Eq("ID", id)).UniqueResult();
                    scpis.AddPart(p);
                    session.Save(scpis);
                    tx.Commit();
                }
            }
        }
Beispiel #4
0
 public bool SCPIconnect()
 {
     if (scpitalker == null)
     {
         try
         {
             scpitalker = new MessageBasedSession("TCPIP::" + signalIP);
             functiongenerator = new SCPI(scpitalker);
         }
         catch (System.ArgumentException)
         {
             if (Global.AskError("Check your signal generator connection settings") == DialogResult.Retry)
                 SCPIconnect();
         }
     }
     return scpitalker != null;
 }
Beispiel #5
0
 public U2001Scpi(string visaAddress) : base(visaAddress)
 {
     m_scpi = new SCPI(visaAddress);
 }