protected void buttonUpdate_OnClick(object sender, EventArgs e) { if (chkEnabled.Checked) { if (GetSetting(SettingStrings.ProxyDhcp) == "No") { EndUserMessage = "Proxy DHCP Mode Must Be Enabled To Use Proxy Reservations"; return; } } //Cluster Issue if (ddlBootFile.Text.Contains("winpe")) { if (!Call.FilesystemApi.BootSdiExists()) { EndUserMessage = "Cannot Use WinPE. You Have Not Updated Your tftpboot Folder With CloneDeployPE Builder"; return; } } Call.ComputerApi.ToggleProxyReservation(Computer.Id, chkEnabled.Checked); var reservation = new ComputerProxyReservationEntity(); reservation.ComputerId = Computer.Id; reservation.NextServer = txtTftp.Text; reservation.BootFile = ddlBootFile.Text; Call.ComputerProxyReservationApi.Post(reservation); EndUserMessage = "Successfully Updated Computer Reservation"; }
public ActionResultDTO Post(ComputerProxyReservationEntity computerProxyReservation) { var result = _computerProxyReservationServices.UpdateComputerProxyReservation(computerProxyReservation); if (result == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(result); }
public ActionResultDTO Post(ComputerProxyReservationEntity tObject) { Request.Method = Method.POST; Request.AddJsonBody(tObject); Request.Resource = string.Format("api/{0}/Post/", Resource); var response = _apiRequest.Execute <ActionResultDTO>(Request); if (response.Id == 0) { response.Success = false; } return(response); }
public ActionResultDTO UpdateComputerProxyReservation(ComputerProxyReservationEntity computerProxyReservation) { if (_uow.ComputerProxyRepository.Exists(x => x.ComputerId == computerProxyReservation.ComputerId)) { computerProxyReservation.Id = _uow.ComputerProxyRepository.GetFirstOrDefault( x => x.ComputerId == computerProxyReservation.ComputerId).Id; _uow.ComputerProxyRepository.Update(computerProxyReservation, computerProxyReservation.Id); } else { _uow.ComputerProxyRepository.Insert(computerProxyReservation); } _uow.Save(); var actionResult = new ActionResultDTO(); actionResult.Success = true; actionResult.Id = computerProxyReservation.Id; return(actionResult); }
public void UpdateComputerProperties(GroupPropertyEntity groupProperty) { if (groupProperty == null) { return; } var groupImageClassifications = new List <GroupImageClassificationEntity>(); if (Convert.ToBoolean(groupProperty.ImageClassificationsEnabled)) { groupImageClassifications = new GroupServices().GetGroupImageClassifications(groupProperty.GroupId); } foreach (var computer in new GroupServices().GetGroupMembersWithImages(groupProperty.GroupId)) { if (Convert.ToBoolean(groupProperty.ImageEnabled)) { computer.ImageId = groupProperty.ImageId; } if (Convert.ToBoolean(groupProperty.ImageProfileEnabled)) { computer.ImageProfileId = groupProperty.ImageProfileId; } if (Convert.ToBoolean(groupProperty.DescriptionEnabled)) { computer.Description = groupProperty.Description; } if (Convert.ToBoolean(groupProperty.SiteEnabled)) { computer.SiteId = groupProperty.SiteId; } if (Convert.ToBoolean(groupProperty.BuildingEnabled)) { computer.BuildingId = groupProperty.BuildingId; } if (Convert.ToBoolean(groupProperty.RoomEnabled)) { computer.RoomId = groupProperty.RoomId; } if (Convert.ToBoolean(groupProperty.CustomAttribute1Enabled)) { computer.CustomAttribute1 = groupProperty.CustomAttribute1; } if (Convert.ToBoolean(groupProperty.CustomAttribute2Enabled)) { computer.CustomAttribute2 = groupProperty.CustomAttribute2; } if (Convert.ToBoolean(groupProperty.CustomAttribute3Enabled)) { computer.CustomAttribute3 = groupProperty.CustomAttribute3; } if (Convert.ToBoolean(groupProperty.CustomAttribute4Enabled)) { computer.CustomAttribute4 = groupProperty.CustomAttribute4; } if (Convert.ToBoolean(groupProperty.CustomAttribute5Enabled)) { computer.CustomAttribute5 = groupProperty.CustomAttribute5; } if (Convert.ToBoolean(groupProperty.ProxyEnabledEnabled)) { computer.ProxyReservation = groupProperty.ProxyEnabled; } if (Convert.ToBoolean(groupProperty.ClusterGroupEnabled)) { computer.ClusterGroupId = groupProperty.ClusterGroupId; } if (Convert.ToBoolean(groupProperty.AlternateServerIpEnabled)) { computer.AlternateServerIpId = groupProperty.AlternateServerIpId; } if (Convert.ToBoolean(groupProperty.ImageClassificationsEnabled)) { var computerImageClassifications = new List <ComputerImageClassificationEntity>(); if (new ComputerServices().DeleteComputerImageClassifications(computer.Id)) { foreach (var imageClass in groupImageClassifications) { computerImageClassifications.Add( new ComputerImageClassificationEntity { ComputerId = computer.Id, ImageClassificationId = imageClass.ImageClassificationId }); } } new ComputerImageClassificationServices().AddClassifications(computerImageClassifications); } var computerServices = new ComputerServices(); computerServices.UpdateComputer(computer); if (Convert.ToBoolean(groupProperty.TftpServerEnabled) || Convert.ToBoolean(groupProperty.BootFileEnabled)) { var proxyServices = new ComputerProxyReservationServices(); var computerProxy = computerServices.GetComputerProxyReservation(computer.Id); if (computerProxy == null) { computerProxy = new ComputerProxyReservationEntity(); computerProxy.ComputerId = computer.Id; } if (Convert.ToBoolean(groupProperty.TftpServerEnabled)) { computerProxy.NextServer = groupProperty.TftpServer; } if (Convert.ToBoolean(groupProperty.BootFileEnabled)) { computerProxy.BootFile = groupProperty.BootFile; } proxyServices.UpdateComputerProxyReservation(computerProxy); } } }