Skip to content
Snippets Groups Projects
AddDeviceResponseContract.cs 3 KiB
Newer Older
Michal Ondrejička's avatar
Michal Ondrejička committed
using Core.Enum;
using SDK.Communication;
Michal Ondrejička's avatar
Michal Ondrejička committed
using SDK.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SDK.Contracts.Communication
{
    class AddDeviceResponseContract : PostResponseContract
    {
        public int Id { get; set; }

        public string Mac { get; set; }

        public int BranchId { get; set; }

Michal Ondrejička's avatar
Michal Ondrejička committed
        public int? SectorId { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public int? ValidSectorId { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed

        public string Title { get; set; }

        public string Note { get; set; }

Michal Ondrejička's avatar
Michal Ondrejička committed
        public long? LastTimeOnline { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public long? ValidLastTimeOnline { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? X { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? Y { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? ValidX { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? ValidY { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed

        public string AppVersion { get; set; }

        public bool IsMoving { get; set; }

Michal Ondrejička's avatar
Michal Ondrejička committed
        public FallType FallStatus { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? Battery { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed

        public int DeviceTypeId { get; set; }

        public string DeviceType { get; set; }

        public bool Position { get; set; }

        public bool Geofence { get; set; }

Michal Ondrejička's avatar
Michal Ondrejička committed
        public float? GeofenceRange { get; set; }
Michal Ondrejička's avatar
Michal Ondrejička committed

        public string Login { get; set; }

        //public string Password { get; set; }

        //public string Salt { get; set; }

        public static explicit operator DeviceContract(AddDeviceResponseContract addDeviceResponseContract)
        {
            return new DeviceContract
            {
                Id = addDeviceResponseContract.Id,
                Mac = addDeviceResponseContract.Mac,
                BranchId = addDeviceResponseContract.BranchId,
                SectorId = addDeviceResponseContract.SectorId,
                ValidSectorId = addDeviceResponseContract.ValidSectorId,
                Title = addDeviceResponseContract.Title,
                Note = addDeviceResponseContract.Note,
                LastTimeOnline = addDeviceResponseContract.LastTimeOnline,
                ValidLastTimeOnline = addDeviceResponseContract.ValidLastTimeOnline,
                X = addDeviceResponseContract.X,
                Y = addDeviceResponseContract.Y,
                ValidX = addDeviceResponseContract.ValidX,
                ValidY = addDeviceResponseContract.ValidY,
                AppVersion = addDeviceResponseContract.AppVersion,
                IsMoving = addDeviceResponseContract.IsMoving,
                FallStatus = addDeviceResponseContract.FallStatus,
                Battery = addDeviceResponseContract.Battery,
                DeviceTypeId = addDeviceResponseContract.DeviceTypeId,
                DeviceType = addDeviceResponseContract.DeviceType,
                Position = addDeviceResponseContract.Position,
                Geofence = addDeviceResponseContract.Geofence,
                GeofenceRange = addDeviceResponseContract.GeofenceRange,
                Login = addDeviceResponseContract.Login,
            };
        }
    }
}