public RequestFormViewModel(Request request, User user, IEnumerable<ApplicationType> applicationTypes, IEnumerable<Location> locations, IEnumerable<ServerType> serverTypes, IEnumerable<PortType> portTypes, IEnumerable<IPRequestForm.Models.OperatingSystem> operatingSystems, RequestFormViews requestFormView) { this.RequestFormView = requestFormView; this.OperatingSystems = operatingSystems; this.PortTypes = portTypes; this.ServerTypes = serverTypes; this.Locations = locations; this.ApplicationTypes = applicationTypes; RequestFormView = requestFormView; RequestUser = request.User; this.RequestOwner = request.Owner; RequestId = request.Id; Date = request.SubmissionDate; BusinessService = request.BusinessService; ApplicationName = request.ApplicationName; RequestApplicationTypes = request.RequestApplicationTypes.Select(i => i.ApplicationType); NetBIOSName = request.Virtualization.NetBIOSName; DNSName = request.Virtualization.DNSName; Notes = request.Notes; Deleted = request.Deleted; DeletedDate = request.DeleteDate; ServerLocation = request.Virtualization.Server.Location; ServerType = request.Virtualization.Server.ServerType; ServerTypeName = (ServerTypes)request.Virtualization.Server.ServerType.Id; if (ServerTypeName == IPRequestForm.ViewModels.ServerTypes.Blades) { RackChassisPort = request.Virtualization.Server.BladeChassi.RackChassisPort; NICTeaming = request.Virtualization.Server.BladeChassi.NICTeaming; } this.OperatingSystem = request.Virtualization.OperatingSystem; //ShowPolicies = (!Roles.IsUserInRole("Users") || request.UserId == user.Id); ShowPolicies = true; var reqs = request.RequestPorts.AsQueryable(); if (user.Id != request.OwnerId & !Roles.IsUserInRole("Security") & !Roles.IsUserInRole("Communication")) { reqs = reqs.Where(x => x.Port.UserId == user.Id); } Policies = reqs.Select(i => new Policy { Id = i.Port.Id, IPAddress = CommonFunctions.IPDotted(i.Port.IP.Address), SubnetMaskBits = i.Port.SubnetMaskId != null ? (int?)BitConverter.ToUInt32(i.Port.SubnetMask.Address.Reverse().ToArray(), 0).BitsSetCountNaive() : null, PortType = i.Port.PortType, StartPortNumber = i.Port.StartPortNumber, EndPortNumber = i.Port.EndPortNumber, PortDirection = (PortDirections)i.Port.PortDirection.Id, StartDate = i.Port.StartDate, EndDate = i.Port.EndDate }); }
public RequestFormViewModel(IEnumerable<ApplicationType> applicationTypes, IEnumerable<Location> locations, IEnumerable<ServerType> serverTypes, IEnumerable<PortType> portTypes, IEnumerable<IPRequestForm.Models.OperatingSystem> operatingSystems, RequestFormViews requestFormView) { this.RequestFormView = requestFormView; this.OperatingSystems = operatingSystems; this.PortTypes = portTypes; this.ServerTypes = serverTypes; this.Locations = locations; this.ApplicationTypes = applicationTypes; this.ShowPolicies = true; }
public RequestFormViewModel(Request request, User user, RequestFormViews requestFormView) : this(request, user, null, null, null, null, null, requestFormView) { }