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(); } } }
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); }
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(); } } }
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; }
public U2001Scpi(string visaAddress) : base(visaAddress) { m_scpi = new SCPI(visaAddress); }