/// <summary> /// /// </summary> /// <param name="c">A ComputerAndItsGroups object to copy data from.</param> /// <param name="allowedGroupIds">If non-null, this collection of group IDs will be used to filter the computer's group list. Pass in a collection of the user's group IDs.</param> public ResultComputerAndItsGroups(ComputerAndItsGroups c, IEnumerable <int> allowedGroupIds) { ID = c.Computer.ID; Name = c.Computer.Name; Groups = c.Groups .Where(g => allowedGroupIds == null || allowedGroupIds.Contains(g.ID)) .Select(g => new ResultGroupSummary(g)) .ToArray(); LastDisconnect = c.Computer.LastDisconnect; HostConnectHandle handle = HostConnect.GetOnlineComputer(ID); if (handle != null) { Uptime = (long)(DateTime.UtcNow - handle.ConnectTime).TotalMilliseconds; } }
public AdminResultComputer(ComputerAndItsGroups c) : base(c, null) { CommentByAdmin = c.Computer.CommentByAdmin; }