示例#1
0
        public bool InsertPoint(PointInfo point, DbTransaction tran)
        {
            object o = processor.QueryScalar("select 1 from pointinfo where id=" + point.ID.ToString(), null);

            if (o != null && o.ToString() != "")
            {
                point.ID = GetPointPKValue() + 1;
            }
            return(processor.Insert <PointInfo>(point, tran));
        }
示例#2
0
 /// <summary>
 /// 保存设备信息
 /// </summary>
 /// <returns></returns>
 public bool SaveDeviceInfomation(Device device, PointInfo points, LogConfig log, List <AlarmConfig> alarm, List <DigitalSignature> ds)
 {
     using (System.Data.SQLite.SQLiteConnection conn = SQLiteHelper.SQLiteHelper.CreateConn())
     {
         PointTempBLL        _point   = new PointTempBLL();
         LogConfigBLL        _log     = new LogConfigBLL();
         AlarmConfigBLL      _alarm   = new AlarmConfigBLL();
         ReportEditorBLL     _report  = new ReportEditorBLL();
         DigitalSignatureBLL _digital = new DigitalSignatureBLL();
         if (conn.State != System.Data.ConnectionState.Open)
         {
             conn.Open();
         }
         System.Data.Common.DbTransaction tran = conn.BeginTransaction();
         try
         {
             //保存设备信息
             if (InsertDevice(device, tran) &&
                 //保存温度点信息
                 _point.InsertPoint(points, tran) &&
                 //保存log信息
                 _log.InsertLogConfig(log, tran) &&
                 //保存alarm信息
                 _alarm.InsertAlarmConfig(alarm, tran) &&
                 _digital.InsertDigitalSignature(ds, tran)
                 )
             {
                 tran.Commit();
             }
             else
             {
                 tran.Rollback();
             }
         }
         catch (Exception ex)
         {
             tran.Rollback();
             conn.Close();
             _tracing.Error(ex, "save data to db failed!");
             return(false);
         }
         finally
         {
             if (conn.State == ConnectionState.Open)
             {
                 conn.Close();
             }
         }
     }
     return(true);
 }
示例#3
0
 public bool InsertPoint(PointInfo point)
 {
     return(InsertPoint(point, null));
 }