using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;

namespace WSDDBBrowser.Core.Model
{
    public partial class g_tgRecord
    {
        [Key]
        public int ide { get; set; }

        public int? nJb { get; set; }

        public int? nJt { get; set; }

        public int? nProcessId { get; set; }

        [StringLength(10)]
        public string cDeviceId { get; set; }

        public DateTime? tTime { get; set; }

        public int? nPos2 { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nK { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nB { get; set; }

        public bool? bIsND { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nProcessLen { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nVelocity { get; set; }

        public int? nFilmBegin { get; set; }

        public int? nFilmEnd { get; set; }

        public string nValues { get; set; }
    }

    public partial class lc_tgRecord
    {
        [Key]
        public int ide { get; set; }

        public int? nJb { get; set; }

        public int? nJt { get; set; }

        public int? nProcessId { get; set; }

        [StringLength(10)]
        public string cDeviceId { get; set; }

        public DateTime? tTime { get; set; }

        public int? nPos2 { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nK { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nB { get; set; }

        public bool? bIsND { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nProcessLen { get; set; }

        [Column(TypeName = "numeric")]
        public decimal? nVelocity { get; set; }

        public int? nFilmBegin { get; set; }

        public int? nFilmEnd { get; set; }

        public double[] nValues { get; set; }
    }

    public class tgRecordProfile:AutoMapper.Profile
    {
        public tgRecordProfile()
        {
            CreateMap<g_tgRecord, lc_tgRecord>().ForMember(s => s.nValues, opt =>
            {
                opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<double[]>(s.nValues));
            });
        }
    }
}
