/// <summary> /// Create a new RequestApplicationType object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="requestId">Initial value of the RequestId property.</param> /// <param name="applicationTypeId">Initial value of the ApplicationTypeId property.</param> public static RequestApplicationType CreateRequestApplicationType(global::System.Int32 id, global::System.Int32 requestId, global::System.Int32 applicationTypeId) { RequestApplicationType requestApplicationType = new RequestApplicationType(); requestApplicationType.Id = id; requestApplicationType.RequestId = requestId; requestApplicationType.ApplicationTypeId = applicationTypeId; return requestApplicationType; }
/// <summary> /// Deprecated Method for adding a new object to the RequestApplicationTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRequestApplicationTypes(RequestApplicationType requestApplicationType) { base.AddObject("RequestApplicationTypes", requestApplicationType); }
public Request CreateRequest(string businessService, string applicationName, int[] applicationTypeId, string netBIOSName, string dnsName, int locationId, int serverTypeId, int? bladeChassisId, string bladeSwitchLocation, bool? bladeTeaming, int operatingSystemId, string notes, int? oldRequestId) { BladeChassis bladeChassis = null; if (serverTypeId == (int)ServerTypes.Blades) { bladeChassis = CreateBladeChassis(bladeSwitchLocation, bladeTeaming.Value); } var server = new Server { ServerTypeId = serverTypeId, LocationId = locationId, BladeChassi = bladeChassis }; var vir = new Virtualization { OperatingSystemId = operatingSystemId, NetBIOSName = netBIOSName, DNSName = dnsName, Server = server }; var oldRequest = oldRequestId.HasValue ? GetRequestById(oldRequestId.Value) : null; var user = GetCurrentUser(); var owner = (oldRequest != null) ? oldRequest.Owner : user; var request = new Request { Owner = owner, User = user, BusinessService = businessService, ApplicationName = applicationName, Virtualization = vir, SubmissionDate = System.DateTime.Now, OldRequestId = oldRequestId, Notes = notes }; if(oldRequest != null) { request.OriginalRequest = oldRequest.OriginalRequest; } else { //request.OriginalRequest = request; } if (oldRequest != null && user.Id != owner.Id) { var inheritedPorts = oldRequest.RequestPorts.Where(x => x.Port.UserId != user.Id); foreach (var port in inheritedPorts) { var requestPort = new RequestPort { Request = request, Port = port.Port }; db.RequestPorts.AddObject(requestPort); } } for (int i = 0; i < applicationTypeId.Length; i++) { var appType = new RequestApplicationType { ApplicationTypeId = applicationTypeId[i], Request = request }; } db.Requests.AddObject(request); return request; }