当前位置: 首页>>代码示例>>C#>>正文


C# IDataReader.GetDateTime方法代码示例

本文整理汇总了C#中IDataReader.GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetDateTime方法的具体用法?C# IDataReader.GetDateTime怎么用?C# IDataReader.GetDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataReader的用法示例。


在下文中一共展示了IDataReader.GetDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendRecordToGraphite

 private void SendRecordToGraphite(string path, IDataReader myReader)
 {
     using (var client = new Graphite.GraphiteTcpClient(this.hostname, this.port, string.Empty))
     {
         while (myReader.Read())
         {
             var value = myReader.GetInt32(1);
             var datetime = myReader.GetDateTime(0);
             this.log.Debug(string.Format("Sending {2} [{0}] {1}", value, datetime, path));
             client.Send(path, myReader.GetInt32(1), myReader.GetDateTime(0));
         }
     }
 }
开发者ID:matthewskelton,项目名称:SqlToGraphite,代码行数:13,代码来源:SqlGetter.cs

示例2: GetDateTime

        public static DateTime GetDateTime(IDataReader dr, string columnName)
        {
            int ordinal = dr.GetOrdinal(columnName);
            bool isDbNull = dr.IsDBNull(ordinal);

            return isDbNull ? DateTime.MinValue : dr.GetDateTime(ordinal);
        }
开发者ID:aserdaray,项目名称:Projects,代码行数:7,代码来源:DataExtractor.cs

示例3: getDateTime

        protected static DateTime getDateTime(IDataReader dataReader, int column)
        {
            if (!dataReader.IsDBNull(column))
                return dataReader.GetDateTime(column);

            return new DateTime();
        }
开发者ID:Letractively,项目名称:rpcwc,代码行数:7,代码来源:RPCWCDAO.cs

示例4: Select

 /// <summary>
 /// Mapea un IDataReader a una entidad Proyecto.
 /// </summary>
 /// <param name="reader">Interfas IDataReader</param>
 /// <returns>Proyecto</returns>
 public static Proyecto Select(IDataReader reader)
 {
     return new Proyecto
     {
         Id = reader.GetInt("CODIGO"),
         Nombre = reader.GetString("NOMBRE"),
         Descripcion = reader.GetString("DESCRIPCION"),
         FechaInicio = reader.GetDateTime("FECHA_INICIO"),
         FechaFin = reader.GetDateTime("FECHA_FIN"),
         JefeProyecto = new Usuario
         {
              Id = reader.GetInt("CODIGO_JEFE_PROYECTO")
         },
         Estado = reader.GetString("ESTADO")
     };
 }
开发者ID:berczeck,项目名称:TMD.GestionConfiguracion,代码行数:21,代码来源:ProyectoDataMap.cs

示例5: CreateRowFromReader

        public override Row CreateRowFromReader(IDataReader reader)
        {
            GetSchemaTable(reader);
            Row r = new Row();
            for (int i = 0; i < reader.FieldCount; i++)
            {
                Type fType = reader.GetFieldType(i);
                if (fType == typeof(System.Decimal))
                {
                    GetDecimal(reader, r, i);
                }
                else if (fType == typeof(System.DateTime))
                {
                    object o = reader.GetValue(i);
                    if (o != DBNull.Value)
                    {
                        DateTime dtime = reader.GetDateTime(i);
                        if (dtime < MinDateTime)
                        {
                            o = NullDateTime.Add(new TimeSpan(dtime.Hour, dtime.Minute, dtime.Second));
                        }
                        r[reader.GetName(i)] = o;
                    }
                }
                else
                {
                    r[reader.GetName(i)] = reader.GetValue(i);
                }
            }

            return r;
        }
开发者ID:Zawulon,项目名称:ETL,代码行数:32,代码来源:OdbcCommandActivator.cs

示例6: GetDateNullCheck

 public static string GetDateNullCheck(IDataReader reader, int ordinal, string myFormat = "dd/MM/yyyy HH:mm:ss")
 {
     try {
         return reader.IsDBNull(ordinal) ? "" : reader.GetDateTime(ordinal).ToString(myFormat);
     } catch (Exception) {
         return "";
     }
 }
开发者ID:Josimar,项目名称:UpperCash,代码行数:8,代码来源:Utilities.cs

示例7: GetValueByIndex

        /// <summary>
        /// Gets a column value by the index
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="dataReader"></param>
        /// <returns></returns>
		public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
        {
            if (dataReader.IsDBNull(mapping.ColumnIndex))
			{
				return DBNull.Value;
			}
            return dataReader.GetDateTime(mapping.ColumnIndex);
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:14,代码来源:DateTimeTypeHandler.cs

示例8: GetValueByName

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="dataReader"></param>
        /// <returns></returns>
        public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
        {
            int index = dataReader.GetOrdinal(mapping.ColumnName);

            if (dataReader.IsDBNull(index))
            {
                return DBNull.Value;
            }
            return new DateTime?( dataReader.GetDateTime(index) );
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:16,代码来源:NullableDateTimeTypeHandler.cs

示例9: ReadMovie

 public static Movie ReadMovie(IDataReader reader)
 {
     Movie movie = new Movie();
     movie.ID = reader.GetInt32(0);
     movie.Title = reader.GetString(1);
     movie.ReleaseDate = reader.GetDateTime(2).Date;
     movie.Genre = reader.GetString(3);
     movie.Price = reader.GetDecimal(4);
     return movie;
 }
开发者ID:mark06,项目名称:WebApplication1,代码行数:10,代码来源:Movie.cs

示例10: Flight

        public Flight(IDataReader reader)
        {
            ID = reader.GetInt32(reader.GetOrdinal("id"));
            location = reader.GetInt32(reader.GetOrdinal("location"));

            DateTime start_time = reader.GetDateTime(reader.GetOrdinal("start_time"));
            DateTime start_date = reader.GetDateTime(reader.GetOrdinal("start_date"));
            start = new DateTime(start_date.Year, start_date.Month, start_date.Day, start_time.Hour, start_time.Minute, start_time.Second);

            DateTime end_time = reader.GetDateTime(reader.GetOrdinal("end_time"));
            DateTime end_date = reader.GetDateTime(reader.GetOrdinal("end_date"));
            end = new DateTime(end_date.Year, end_date.Month, end_date.Day, end_time.Hour, end_time.Minute, end_time.Second);

            airplane = reader.GetInt32(reader.GetOrdinal("airplane"));
            template = reader.GetInt32(reader.GetOrdinal("template"));

            DateTime travelDateTime = reader.GetDateTime(reader.GetOrdinal("travel_time"));
            travelTime = new TimeSpan(days: travelDateTime.Day, hours: travelDateTime.Hour, minutes: travelDateTime.Minute, seconds: travelDateTime.Second);
        }
开发者ID:KommuSoft,项目名称:CplKul2012,代码行数:19,代码来源:Flight.cs

示例11: GetConcepts

        public override IEnumerable<IEntity> GetConcepts(Concept concept, IDataReader reader, KeyMasterOffset keyMaster)
        {
            long? relevantConditionConceptId = 0;
             DateTime? endDate = null;

             if(Concepts.Length == 2)
             {
            var relevantConcepts = Concepts[1].GetValues(Vocabulary, Concepts[1].Fields[0], reader);

            if (relevantConcepts.Count > 0)
                relevantConditionConceptId = relevantConcepts.Min(c => c.ConceptId);
             }

             foreach (var c in base.GetConcepts(concept, reader, keyMaster))
             {
            var e = (Entity) c;

            var calculatedDaysSupply = GetDaysSupply(reader, e);
            if (!string.IsNullOrEmpty(EndDate))
            {
               if (calculatedDaysSupply > 0 && calculatedDaysSupply <= 365)
                  endDate = e.StartDate.AddDays(calculatedDaysSupply - 1);
               else
                  endDate = reader.GetDateTime(EndDate);
            }

            var refillString = reader.GetString(Refill);

            int? refill = null;

            if (!string.IsNullOrEmpty(refillString))
            {
               int refillValue;

               // in Optum Refill looks like: 01, 02...
               int.TryParse(refillString, out refillValue);

               refill = refillValue;
            }

            yield return new DrugExposure(e)
                            {
                               Id = keyMaster.DrugExposureId,
                               Refills = refill,
                               DaysSupply = reader.GetInt(DaysSupply),
                               CalculatedDaysSupply = calculatedDaysSupply,
                               Quantity = GetQuantity(reader),
                               RelevantConditionConceptId = relevantConditionConceptId,
                               EndDate = endDate == DateTime.MinValue ? null : endDate,
                               GetEraConceptIdsCall = Vocabulary.LookupIngredientLevel
                            };

             }
        }
开发者ID:bradanton,项目名称:ETL-CDMBuilder,代码行数:54,代码来源:DrugExposureDefinition.cs

示例12: Select

 /// <summary>
 ///  Mapea un IDataReader a una entidad Linea Base.
 /// </summary>
 /// <param name="reader">Interfas IDataReader</param>
 /// <returns>LineaBase</returns>
 public static LineaBase Select(IDataReader reader)
 {
     return new LineaBase
     {
         Id = reader.GetInt("CODIGO"),
         Nombre = reader.GetString("NOMBRE"),
         Descripcion = reader.GetString("DESCRIPCION"),
         ProyectoFase = new ProyectoFase { Id = reader.GetInt("CODIGO_PROYECTO_FASE"), Fase = new Fase { Nombre = reader.GetString("NOMBRE_FASE") } },
         Estado = reader.GetString("ESTADO"),
         FechaLiberacion = reader.GetDateTime("FECHA_LIBERACION")
     };
 }
开发者ID:berczeck,项目名称:TMD.GestionConfiguracion,代码行数:17,代码来源:LineaBaseMap.cs

示例13: NullSafeGet

		public object NullSafeGet(IDataReader rs, string[] names, object owner)
		{
			int ordinal = rs.GetOrdinal(names[0]);
			if (rs.IsDBNull(ordinal))
			{
				return DateTime.MinValue;
			}
			else
			{
				return rs.GetDateTime(ordinal);
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:12,代码来源:NullDateUserType.cs

示例14: CreateLocalViewwwJobFromReader

 private LocalViewwwJob CreateLocalViewwwJobFromReader(IDataReader reader)
 {
     return new LocalViewwwJob
     {
         RecordId = reader.GetInt32(0),
         Creator = reader.GetInt32(1),
         Created = reader.GetDateTime(2),
         Session = reader.GetInt32(3),
         StartTime = reader.GetDateTime(4),
         Duration = reader.GetInt32(5),
         Customer = reader.GetInt32(6),
         Project = reader.GetInt32(7),
         ProjectId = reader.GetString(8),
         ProjectDescription = reader.GetString(9),
         JobType = reader.GetInt32(10),
         RateGroup = reader.GetInt32(11),
         RateName = reader.GetInt32(12),
         Description = reader.GetString(13),
         Enabled = reader.GetBoolean(14),
         ForceJobsEnabled = reader.GetBoolean(15)
     };
 }
开发者ID:Dimweed,项目名称:temporary-viewwwsearcher,代码行数:22,代码来源:LocalViewwwAccessLayer.cs

示例15: GetValue

 public override object GetValue(IDataReader reader, int columnIndex)
 {
     try
     {
         return reader.GetDateTime(columnIndex);
     }
     catch (Exception ex)
     {
         var dateStr = reader.GetString(columnIndex);
         Log.Warn("Error reading string as DateTime in Sqlite: " + dateStr, ex);
         return DateTime.Parse(dateStr);
     }
 }
开发者ID:navarromattal,项目名称:ServiceStack.OrmLite,代码行数:13,代码来源:SqliteDateTimeConverter.cs


注:本文中的IDataReader.GetDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。