Пример #1
0
 public virtual void Insert(Screen screen)
 {
     if (screen == null)
         throw new ArgumentNullException("screen");
     var meta = this.Converter(screen);
     this._screenData.Insert(meta);
     screen.Id = meta.Id;
 }
Пример #2
0
 /// <summary>
 /// 转换器
 /// </summary>
 /// <param name="screen"></param>
 /// <returns></returns>
 protected ScreenMeta Converter(Screen screen, ScreenMeta meta = null)
 {
     if (meta == null)
     {
         meta = new ScreenMeta();
         meta.CreateTime = DateTime.Now;
     }
     meta.Address = screen.Address != null ? screen.Address.Description : string.Empty;
     meta.Code = screen.Code;
     meta.CoordinateType = screen.Address != null && screen.Address.Point != null ? screen.Address.Point.CoordinateType : string.Empty;
     meta.Enabled = screen.Enabled;
     meta.Geohash = screen.Address != null && screen.Address.Point != null ? screen.Address.Point.Geohash : string.Empty;
     meta.Height = screen.Height;
     meta.Latitude = screen.Address != null && screen.Address.Point != null ? screen.Address.Point.Latitude : 0;
     meta.LocationCode = screen.Address != null ? screen.Address.Code : string.Empty;
     meta.LocationName = screen.Address != null ? screen.Address.Name : string.Empty;
     meta.Longitude = screen.Address != null && screen.Address.Point != null ? screen.Address.Point.Longitude : 0;
     meta.Status = screen.Status;
     meta.UpdateTime = DateTime.Now;
     meta.Width = screen.Width;
     return meta;
 }
Пример #3
0
 public virtual void Update(long id, Screen screen)
 {
     if (screen == null)
         throw new ArgumentNullException("screen");
     var meta = this._screenData.GetByID(id);
     if (meta == null)
         throw new BaseException("没有这个屏幕数据");
     meta=this.Converter(screen,meta);
     this._screenData.Update(meta);
 }