public bool AddOneTempMeasureRecord(TempMeasure oneTempMeaRecord)
        {
            string sql = "insert into record_tempmeasure(MeasureTask_Index,MonDev_Index,MeasureValueMin,MeasureValueAvg,MeasureValueMax,AirTemperature,Humidity,Electricty,RecordTime,TVFilePath," +
                         "IRFilePath,VTVFilePath,IRAFilePath,VIRFilePath,TVVImgPath,IRVImgPath,IRHImgPath,Readed) " +
                         " values(@MeasureTask_Index,@MonDev_Index,@MeasureValueMin,@MeasureValueAvg,@MeasureValueMax,@AirTemperature,@Humidity,@Electricty,@RecordTime,@TVFilePath," +
                         "@IRFilePath,@VTVFilePath,@IRAFilePath,@VIRFilePath,@TVVImgPath,@IRVImgPath,@IRHImgPath,@Readed)";
            List <MySqlParameter> parmList = new List <MySqlParameter>();

            parmList.Add(new MySqlParameter("@MeasureTask_Index", oneTempMeaRecord.MeasureTask_Index));
            parmList.Add(new MySqlParameter("@MonDev_Index", oneTempMeaRecord.MonDev_Index));
            parmList.Add(new MySqlParameter("@MeasureValueMin", oneTempMeaRecord.MeasureValueMin));
            parmList.Add(new MySqlParameter("@MeasureValueAvg", oneTempMeaRecord.MeasureValueAvg));
            parmList.Add(new MySqlParameter("@MeasureValueMax", oneTempMeaRecord.MeasureValueMax));
            parmList.Add(new MySqlParameter("@AirTemperature", oneTempMeaRecord.AirTemperature));
            parmList.Add(new MySqlParameter("@Humidity", oneTempMeaRecord.Humidity));
            parmList.Add(new MySqlParameter("@Electricty", oneTempMeaRecord.Electricty));
            parmList.Add(new MySqlParameter("@RecordTime", oneTempMeaRecord.RecordTime));
            parmList.Add(new MySqlParameter("@TVFilePath", oneTempMeaRecord.TVFilePath));
            parmList.Add(new MySqlParameter("@IRFilePath", oneTempMeaRecord.IRFilePath));
            parmList.Add(new MySqlParameter("@VTVFilePath", oneTempMeaRecord.VTVFilePath));
            parmList.Add(new MySqlParameter("@IRAFilePath", oneTempMeaRecord.IRAFilePath));
            parmList.Add(new MySqlParameter("@VIRFilePath", oneTempMeaRecord.VIRFilePath));
            parmList.Add(new MySqlParameter("@TVVImgPath", oneTempMeaRecord.TVVImgPath));
            parmList.Add(new MySqlParameter("@IRVImgPath", oneTempMeaRecord.IRVImgPath));
            parmList.Add(new MySqlParameter("@IRHImgPath", oneTempMeaRecord.IRHImgPath));
            parmList.Add(new MySqlParameter("@Readed", oneTempMeaRecord.Readed));
            MySqlConnection conn = SqlHelper.GetConnection(ip, port, username, password, databaseName);

            return(SqlHelper.AddData(conn, sql, parmList.ToArray()));
        }
Exemple #2
0
        private bool AddSpotMeaTempRecords(int taskId, double temperature)
        {
            MySqlConnection conn   = GlobalCtrl.GetSqlConnection();
            string          strSql = "insert into record_tempmeasure (MeasureTask_Index,MonDev_Index,MeasureValueMin,MeasureValueAvg,MeasureValueMax,AirTemperature,Humidity,Electricty,RecordTime," +
                                     "TVFilePath,IRFilePath,TVVImgPath,IRVImgPath,IRHImgPath,Readed) values(@MeasureTask_Index,@MonDev_Index,@MeasureValueMin,@MeasureValueAvg,@MeasureValueMax,@AirTemperature," +
                                     "@Humidity,@Electricty,@RecordTime,@TVFilePath,@IRFilePath,@TVVImgPath,@IRVImgPath,@IRHImgPath,@Readed)";
            List <MySqlParameter> parameters = new List <MySqlParameter>();

            parameters.Add(new MySqlParameter("@MeasureTask_Index", taskId));
            parameters.Add(new MySqlParameter("@MonDev_Index", 0));
            parameters.Add(new MySqlParameter("@MeasureValueMin", temperature));
            parameters.Add(new MySqlParameter("@MeasureValueAvg", temperature));
            parameters.Add(new MySqlParameter("@MeasureValueMax", temperature));
            parameters.Add(new MySqlParameter("@AirTemperature", 0));
            parameters.Add(new MySqlParameter("@Humidity", 0));
            parameters.Add(new MySqlParameter("@Electricty", 0));
            parameters.Add(new MySqlParameter("@RecordTime", DateTime.Now));
            parameters.Add(new MySqlParameter("@TVFilePath", null));
            parameters.Add(new MySqlParameter("@IRFilePath", null));
            parameters.Add(new MySqlParameter("@TVVImgPath", null));
            parameters.Add(new MySqlParameter("@IRVImgPath", null));
            parameters.Add(new MySqlParameter("@IRHImgPath", null));
            parameters.Add(new MySqlParameter("@Readed", false));

            return(SqlHelper.AddData(conn, strSql, parameters.ToArray()));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Position pos = new Position();

            pos.PositionName  = pos_name.Text;
            pos.Station_Index = Convert.ToInt32(pos_stationIndex.Value);
            string sql = null;
            List <MySqlParameter> pamList = new List <MySqlParameter>();

            if (pos_cruiseType.Text.ToString().Equals("隔时巡检"))
            {
                pos.CruiseType     = 0;
                pos.CruiseInterval = Convert.ToInt32(pos_interval.Value);
                sql = "insert into cruise_position(Station_Index,PositionName,CruiseInterval,CruiseType) values(@Station_Index,@PositionName,@CruiseInterval,@CruiseType)";
                pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index));
                pamList.Add(new MySqlParameter("@PositionName", pos.PositionName));
                pamList.Add(new MySqlParameter("@CruiseInterval", pos.CruiseInterval));
                pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType));
            }
            else if (pos_cruiseType.Text.ToString().Equals("定时巡检"))
            {
                pos.CruiseType      = 1;
                pos.StartCruiseTime = pos_cruiseStartTime.Value;
                sql = "insert into cruise_position(Station_Index, PositionName, StartCruiseTime, CruiseType) values(@Station_Index,@PositionName,@StartCruiseTime,@CruiseType)";
                pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index));
                pamList.Add(new MySqlParameter("@PositionName", pos.PositionName));
                pamList.Add(new MySqlParameter("@StartCruiseTime", pos.StartCruiseTime));
                pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType));
            }
            MySqlConnection conn = GlobalCtrl.GetSqlConnection();

            if (SqlHelper.AddData(conn, sql, pamList.ToArray()))
            {
                sql = "select * from cruise_position where Position_Index = (select max(Position_Index) from cruise_position)";
                DataTable data = SqlHelper.QueryData(conn, sql, null);

                MessageBox.Show("固定点添加成功");
            }
            else
            {
                MessageBox.Show("固定点添加失败");
            }
        }
Exemple #4
0
        public bool AddOneAlarmRecord(AlarmRecord alarmRecord)
        {
            string sql = "insert into record_alarmrecord(TempMeasure_Index,Rule_Index,Rule_Type,AlarmType,AlarmRecordTime,RelMeaVal,RefPreAlarmVal,RefAlarmVal,RefSuperAlarmVal,Readed) " +
                         "values(@TempMeasure_Index,@Rule_Index,@Rule_Type,@AlarmType,@AlarmRecordTime,@RelMeaVal,@RefPreAlarmVal,@RefAlarmVal,@RefSuperAlarmVal,@Readed)";
            List <MySqlParameter> parmList = new List <MySqlParameter>();

            parmList.Add(new MySqlParameter("@TempMeasure_Index", alarmRecord.TempMeasure_Index));
            parmList.Add(new MySqlParameter("@Rule_Index", alarmRecord.Rule_Index));
            parmList.Add(new MySqlParameter("@Rule_Type", alarmRecord.Rule_Type));
            parmList.Add(new MySqlParameter("@AlarmType", alarmRecord.AlarmType));
            parmList.Add(new MySqlParameter("@AlarmRecordTime", alarmRecord.AlarmRecordTime));
            parmList.Add(new MySqlParameter("@RelMeaVal", alarmRecord.RelMeaVal));
            parmList.Add(new MySqlParameter("@RefPreAlarmVal", alarmRecord.RefPreAlarmVal));
            parmList.Add(new MySqlParameter("@RefAlarmVal", alarmRecord.RefAlarmVal));
            parmList.Add(new MySqlParameter("@RefSuperAlarmVal", alarmRecord.RefSuperAlarmVal));
            parmList.Add(new MySqlParameter("@Readed", alarmRecord.Readed));
            MySqlConnection conn = SqlHelper.GetConnection(ip, port, username, password, databaseName);

            return(SqlHelper.AddData(conn, sql, parmList.ToArray()));
        }