GetTimeSpan() публичный Метод

public GetTimeSpan ( int column ) : System.TimeSpan
column int
Результат System.TimeSpan
Пример #1
0
        public ArrayList getTrips()
        {
            MySql.Data.MySqlClient.MySqlConnection conn;
            string myConnectionString = ConfigurationManager.ConnectionStrings["PhpMySqlRemoteDB"].ConnectionString;

            conn = new MySql.Data.MySqlClient.MySqlConnection();
            try
            {
                conn.ConnectionString = myConnectionString;
                conn.Open();

                ArrayList tripArray = new ArrayList();

                MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null;

                string sqlString = "SELECT * FROM Trips";
                MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn);

                mySQLReader = cmd.ExecuteReader();
                while (mySQLReader.Read())
                {
                    Trip t = new Trip();

                    t.TripID                       = mySQLReader.GetInt32(0);
                    t.Username                     = mySQLReader.GetString(1);
                    t.From_City_Country            = mySQLReader.GetString(2);
                    t.To_City_Country              = mySQLReader.GetString(3);
                    t.TransportationType           = mySQLReader.GetString(4);
                    t.OutboundTripDetails_Day      = mySQLReader.GetDateTime(5);
                    t.OutboundTripDetails_Time     = mySQLReader.GetTimeSpan(6);
                    t.OutboundTripDetails_Duration = mySQLReader.GetFloat(7);
                    t.AddAReturnTrip               = mySQLReader.GetBoolean(8);
                    t.ReturnTripDetails_Day        = mySQLReader.GetDateTime(9);
                    t.ReturnTripDetails_Time       = mySQLReader.GetTimeSpan(10);
                    t.ReturnTripDetails_Duration   = mySQLReader.GetFloat(11);
                    t.AvailableWeight              = mySQLReader.GetFloat(12);
                    t.ExcludedCategories           = mySQLReader.GetString(13);
                    t.TripNote                     = mySQLReader.GetString(14);

                    tripArray.Add(t);
                }
                return(tripArray);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
 private static void _mediaReadFields(MySqlDataReader dataReader, PersistentMedia media)
 {
     uint flags = dataReader.IsDBNull(dataReader.GetOrdinal("flags")) ? (uint)0 : dataReader.GetUInt32("flags");
     byte typVideo = dataReader.IsDBNull(dataReader.GetOrdinal("typVideo")) ? (byte)0 : dataReader.GetByte("typVideo");
     media._mediaName = dataReader.IsDBNull(dataReader.GetOrdinal("MediaName")) ? string.Empty : dataReader.GetString("MediaName");
     media._duration = dataReader.IsDBNull(dataReader.GetOrdinal("Duration")) ? default(TimeSpan) : dataReader.GetTimeSpan("Duration");
     media._durationPlay = dataReader.IsDBNull(dataReader.GetOrdinal("DurationPlay")) ? default(TimeSpan) : dataReader.GetTimeSpan("DurationPlay");
     media._folder = dataReader.IsDBNull(dataReader.GetOrdinal("Folder")) ? string.Empty : dataReader.GetString("Folder");
     media._fileName = dataReader.IsDBNull(dataReader.GetOrdinal("FileName")) ? string.Empty : dataReader.GetString("FileName");
     media._fileSize = dataReader.IsDBNull(dataReader.GetOrdinal("FileSize")) ? 0 : dataReader.GetUInt64("FileSize");
     media.idFormat = dataReader.IsDBNull(dataReader.GetOrdinal("idFormat")) ? 0 : dataReader.GetUInt64("idFormat");
     media._lastUpdated = _readDateTimeField(dataReader, "LastUpdated");
     media._mediaStatus = (TMediaStatus)(dataReader.IsDBNull(dataReader.GetOrdinal("statusMedia")) ? 0 : dataReader.GetInt32("statusMedia"));
     media._mediaType = (TMediaType)(dataReader.IsDBNull(dataReader.GetOrdinal("typMedia")) ? 0 : dataReader.GetInt32("typMedia"));
     media._tCStart = dataReader.IsDBNull(dataReader.GetOrdinal("TCStart")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCStart");
     media._tCPlay = dataReader.IsDBNull(dataReader.GetOrdinal("TCPlay")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCPlay");
     media.idProgramme = dataReader.IsDBNull(dataReader.GetOrdinal("idProgramme")) ? 0 : dataReader.GetUInt64("idProgramme");
     media._audioVolume = dataReader.IsDBNull(dataReader.GetOrdinal("AudioVolume")) ? 0 : dataReader.GetDecimal("AudioVolume");
     media._audioLevelIntegrated = dataReader.IsDBNull(dataReader.GetOrdinal("AudioLevelIntegrated")) ? 0 : dataReader.GetDecimal("AudioLevelIntegrated");
     media._audioLevelPeak = dataReader.IsDBNull(dataReader.GetOrdinal("AudioLevelPeak")) ? 0 : dataReader.GetDecimal("AudioLevelPeak");
     media._audioChannelMapping = dataReader.IsDBNull(dataReader.GetOrdinal("typAudio")) ? TAudioChannelMapping.Stereo : (TAudioChannelMapping)dataReader.GetByte("typAudio");
     media.HasExtraLines = (typVideo & (byte)0x80) > 0;
     media._videoFormat = (TVideoFormat)(typVideo & 0x7F);
     media._idAux = dataReader.IsDBNull(dataReader.GetOrdinal("idAux")) ? string.Empty : dataReader.GetString("idAux");
     media._killDate = _readDateTimeField(dataReader, "KillDate");
     media._mediaGuid = dataReader.IsDBNull(dataReader.GetOrdinal("MediaGuid")) ? Guid.Empty : dataReader.GetGuid("MediaGuid");
     media._mediaEmphasis = (TMediaEmphasis)((flags >> 8) & 0xF);
     media._parental = (TParental)((flags >> 12) & 0xF);
     if (media is ServerMedia)
         ((ServerMedia)media)._doNotArchive = (flags & 0x1) != 0;
     media._mediaCategory = (TMediaCategory)((flags >> 4) & 0xF); // bits 4-7 of 1st byte
 }
 private static Event _EventRead(Engine engine, MySqlDataReader dataReader)
 {
     Event aEvent = new Event(engine);
     uint flags = dataReader.IsDBNull(dataReader.GetOrdinal("flagsEvent")) ? 0 : dataReader.GetUInt32("flagsEvent");
     aEvent._idRundownEvent = dataReader.GetUInt64("idRundownEvent");
     aEvent._layer = (VideoLayer)dataReader.GetSByte("Layer");
     aEvent._eventType = (TEventType)dataReader.GetByte("typEvent");
     aEvent._startType = (TStartType)dataReader.GetByte("typStart");
     aEvent._scheduledTime = _readDateTimeField(dataReader, "ScheduledTime");
     aEvent._duration = dataReader.IsDBNull(dataReader.GetOrdinal("Duration")) ? default(TimeSpan) : aEvent.Engine.AlignTimeSpan(dataReader.GetTimeSpan("Duration"));
     aEvent._scheduledDelay = dataReader.IsDBNull(dataReader.GetOrdinal("ScheduledDelay")) ? default(TimeSpan) : aEvent.Engine.AlignTimeSpan(dataReader.GetTimeSpan("ScheduledDelay"));
     aEvent._scheduledTC = dataReader.IsDBNull(dataReader.GetOrdinal("ScheduledTC")) ? TimeSpan.Zero : dataReader.GetTimeSpan("ScheduledTC");
     aEvent._mediaGuid = (dataReader.IsDBNull(dataReader.GetOrdinal("MediaGuid"))) ? Guid.Empty : dataReader.GetGuid("MediaGuid");
     aEvent._eventName = dataReader.IsDBNull(dataReader.GetOrdinal("EventName")) ? default(string) : dataReader.GetString("EventName");
     var psb = dataReader.GetByte("PlayState");
     aEvent._playState = (TPlayState)psb;
     if (aEvent._playState == TPlayState.Playing || aEvent._playState == TPlayState.Paused)
         aEvent._playState = TPlayState.Aborted;
     if (aEvent._playState == TPlayState.Fading)
         aEvent._playState = TPlayState.Played;
     aEvent._startTime = _readDateTimeField(dataReader, "StartTime");
     aEvent._startTC = dataReader.IsDBNull(dataReader.GetOrdinal("StartTC")) ? TimeSpan.Zero : dataReader.GetTimeSpan("StartTC");
     aEvent._requestedStartTime = dataReader.IsDBNull(dataReader.GetOrdinal("RequestedStartTime")) ? null : (TimeSpan?)dataReader.GetTimeSpan("RequestedStartTime");
     aEvent._transitionTime = dataReader.IsDBNull(dataReader.GetOrdinal("TransitionTime")) ? default(TimeSpan) : dataReader.GetTimeSpan("TransitionTime");
     aEvent._transitionType = (TTransitionType)dataReader.GetByte("typTransition");
     aEvent._audioVolume = dataReader.IsDBNull(dataReader.GetOrdinal("AudioVolume")) ? 0 : dataReader.GetDecimal("AudioVolume");
     aEvent._idProgramme = dataReader.IsDBNull(dataReader.GetOrdinal("idProgramme")) ? 0 : dataReader.GetUInt64("idProgramme");
     aEvent._idAux = dataReader.IsDBNull(dataReader.GetOrdinal("IdAux")) ? default(string) : dataReader.GetString("IdAux");
     aEvent._enabled = (flags & (1 << 0)) != 0;
     aEvent._hold = (flags & (1 << 1)) != 0;
     EventGPI.FromUInt64(ref aEvent._gPI, (flags >> 4) & EventGPI.Mask);
     aEvent._nextLoaded = false;
     return aEvent;
 }