Пример #1
0
        public static CommandLogDTO Convert(CommandLog from)
        {
            CommandLogDTO res = new CommandLogDTO();

            res.Id         = from.Id;
            res.Name       = from.Name;
            res.Sent       = from.Sent;
            res.Timestamp  = from.Timestamp;
            res.TokenDTO   = TokenDTO.Convert(from.Token);
            res.CommandDTO = CommandDTO.Convert(from.Command);
            return(res);
        }
        public CommandParameterDTO[] Params { get; set; } //not possible to do with lower case.
        public static CommandDTO Convert(Command from)
        {
            CommandDTO res = new CommandDTO();
            res.Id = from.Id;
            res.Name = from.Name;
            res.Text = from.Text;

            int size = new Random().Next(1,3);
            res.Params = new Random().Next() % 3 == 0 ? null : new CommandParameterDTO[size];
            if (res.Params != null)
            {
                for (int i = 0; i < size; i++)
                    res.Params[i] = new CommandParameterDTO();
            }
            return res;            
        }
Пример #3
0
        }                                                 //not possible to do with lower case.
        public static CommandDTO Convert(Command from)
        {
            CommandDTO res = new CommandDTO();

            res.Id   = from.Id;
            res.Name = from.Name;
            res.Text = from.Text;

            int size = new Random().Next(1, 3);

            res.Params = new Random().Next() % 3 == 0 ? null : new CommandParameterDTO[size];
            if (res.Params != null)
            {
                for (int i = 0; i < size; i++)
                {
                    res.Params[i] = new CommandParameterDTO();
                }
            }
            return(res);
        }
Пример #4
0
        public static DeviceDTO Convert(Device from)
        {
            DeviceDTO res = new DeviceDTO();

            res.Id      = from.Id;
            res.Name    = from.Name;
            res.Working = from.Working;

            res.Datas = new List <DataDTO>();
            foreach (Data d in from.Data)
            {
                res.Datas.Add(DataDTO.Convert(d));
            }

            res.Commands = new List <CommandDTO>();
            foreach (Command c in from.Command)
            {
                res.Commands.Add(CommandDTO.Convert(c));
            }

            return(res);
        }