Example #1
0
        public void insert(Model.YLInfo djs)
        {
            OracleTransaction tran = null;

            using (OracleConnection conn = new OracleConnection(OracleHelper.ConnectionStringOrderDistributedTransaction))
            {
                try
                {
                    conn.Open();
                    tran = conn.BeginTransaction();


                    if (string.IsNullOrEmpty(djs.SrcId) || string.IsNullOrEmpty(djs.DstId))
                    {
                        throw new Exception("设备ID为空!");
                    }
                    OracleParameter[] parms = GetAdapterParameters();
                    SetAdapterParameters(parms, djs);
                    OracleHelper.ExecuteNonQuery(tran, CommandType.Text, SQL_INSERT_YL, parms);

                    tran.Commit();
                }
                catch (Exception e)
                {
                    if (null != tran)
                    {
                        tran.Rollback();
                    }
                    throw (e);
                }
            }
        }
Example #2
0
        public void insert(Model.YLInfo djs)
        {
            if (djs == null)
            {
                return;
            }
            IYLiang dal = SensorHub.DALFactory.YLiang.Create();

            dal.insert(djs);
        }