Exemple #1
0
 private void _initfromRow(DataRow dr)
 {
     FrameId = dr.IntOrZero("FrameId");
     PanelId = dr.IntOrZero("PanelId");
     Duration = dr.IntOrDefault("Duration", 60);
     Sort = dr.IntOrZero("Sort");
     BeginsOn = dr["BeginsOn"] == DBNull.Value ? null : (DateTime?)dr["BeginsOn"];
     EndsOn = dr["EndsOn"] == DBNull.Value ? null : (DateTime?)dr["EndsOn"];
     DateCreated = dr["DateCreated"] == DBNull.Value ? null : (DateTime?)dr["DateCreated"];
     TemplateName = dr.StringOrDefault("TemplateName", "default");
     Html = dr.StringOrBlank("Html");
     FrameType = (FrameTypes)dr.IntOrZero("FrameType");
     CacheInterval = dr.IntOrZero("CacheInterval");
     CacheInterval = CacheInterval < 0 ? 0 : CacheInterval;
     Version = BitConverter.ToUInt64((byte[])dr["Version"], 0);       // is never a null
 }
Exemple #2
0
        private void _initFromRow(DataRow r)
		{
            this.LocationId = r.IntOrZero("LocationId");
            this.LevelId = r.IntOrZero("LevelId");
            this.TemperatureUnit = r.StringOrDefault("TemperatureUnit", "C").ToLower();
            this.DateFormat = r.StringOrDefault("DateFormat", "LL");
            this.TimeFormat = r.StringOrDefault("TimeFormat", "LT");
            this.Name = r.StringOrBlank("Name");
            if (this.Name == "")
                this.Name = string.Format("Location {0}", this.LocationId);

            this.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(
                r.StringOrDefault("TimeZone", ServerGeoData.TimeZone.Id)
                );

            double? latitude = r["Latitude"] as Nullable<double>;
            if (latitude != null)
                this.Latitude = latitude.Value;
            else
                this.Latitude = ServerGeoData.Latitude;

            double? longitude = r["Longitude"] as Nullable<double>;
            if (longitude != null)
                this.Longitude = longitude.Value;
            else
                this.Longitude = ServerGeoData.Longitude;

            int? woeid = r["Woeid"] as Nullable<int>;
            this.Woeid = woeid ?? 0;

            this.Culture = r.StringOrBlank("Culture");
        }