コード例 #1
0
        public void setVhEventTypeToFlexsimDB(string vh_id, ProtocolFormat.OHTMessage.EventType event_type)
        {
            lock (connection)
            {
                //try
                //{
                //    StringBuilder sb = new StringBuilder();
                //    sb.Append("UPDATE AVEHICLEINFO").Append(" ");
                //    sb.Append("SET").Append(" ");
                //    sb.Append($"EVENT_TYPE = {(int)event_type}").Append(" ");
                //    sb.Append($"WHERE [ID] = '{vh_id.Trim()}'");


                //    //string commandString = $@"UPDATE AVEHICLEINFO SET CUR_ADR_ID = {current_adr_id.Trim()} ACC_SEC_DIST = {sec_dis} WHERE [ID] = '{vh_id.Trim()}'";
                //    SqlCommand command = new SqlCommand(sb.ToString(), connection);
                //    connection.Open();
                //    command.ExecuteNonQuery();
                //}
                //catch (Exception ex)
                //{
                //    NLog.LogManager.GetCurrentClassLogger().Error(ex, "Exception");
                //}
                //finally
                //{
                //    connection.Close();
                //}
            }
        }
コード例 #2
0
        public void setVhStatusToFlexsimDB(string vh_id, string current_adr_id, double sec_dis, ProtocolFormat.OHTMessage.EventType event_type,
                                           string cst_id, ProtocolFormat.OHTMessage.VHModeStatus mode_status, ProtocolFormat.OHTMessage.VHActionStatus action_status,
                                           VhStopSingle obs_pause, VhStopSingle block_pause, VhStopSingle pause, VhStopSingle hid_pause, VhStopSingle error, VhStopSingle earth_quake_pause,
                                           VhStopSingle safety_pause)
        {
            lock (connection)
            {
                //try
                //{
                //    StringBuilder sb = new StringBuilder();
                //    sb.Append("UPDATE AVEHICLEINFO").Append(" ");
                //    sb.Append("SET").Append(" ");
                //    sb.Append($"CUR_ADR_ID = '{current_adr_id.Trim()}'").Append(",");
                //    sb.Append($"ACC_SEC_DIST = {sec_dis}").Append(",");
                //    sb.Append($"CST_ID = '{cst_id?.Trim()}'").Append(",");
                //    sb.Append($"MODE_STATUS = {(int)mode_status}").Append(",");
                //    sb.Append($"ACT_STATUS = {(int)action_status}").Append(",");
                //    sb.Append($"OBS_PAUSE = {(int)obs_pause}").Append(",");
                //    sb.Append($"BLOCK_PAUSE = {(int)block_pause}").Append(",");
                //    sb.Append($"PAUSE = {(int)pause}").Append(",");
                //    sb.Append($"HID_PAUSE = {(int)hid_pause}").Append(",");
                //    sb.Append($"ERROR = {(int)error}").Append(",");
                //    sb.Append($"EARTHQUAKE_PAUSE = {(int)earth_quake_pause}").Append(",");
                //    sb.Append($"SAFETY_DOOR_PAUSE = {(int)safety_pause}").Append(" ");
                //    sb.Append($"WHERE [ID] = '{vh_id.Trim()}'");


                //    //string commandString = $@"UPDATE AVEHICLEINFO SET CUR_ADR_ID = {current_adr_id.Trim()} ACC_SEC_DIST = {sec_dis} WHERE [ID] = '{vh_id.Trim()}'";
                //    SqlCommand command = new SqlCommand(sb.ToString(), connection);
                //    connection.Open();
                //    command.ExecuteNonQuery();
                //}
                //catch (Exception ex)
                //{
                //    NLog.LogManager.GetCurrentClassLogger().Error(ex, "Exception");
                //}
                //finally
                //{
                //    connection.Close();
                //}
            }
        }