protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); var Isphysicalmachine = DDphysicalmachine.SelectedValue; var Isvtenabled = DDIsvtenabled.SelectedValue; var IPAddress = txtIPAddress.Text.Trim(); var Hostname = txtHostname.Text.Trim(); // HyperV paramaters validation validation if (Isphysicalmachine == "--SELECT--") { this.ShowErrorMessage("Please confirm if it is a Physical Host"); return; } if (Isphysicalmachine == "False") { this.ShowErrorMessage("Hyper-V can be installed only on Physical Machine"); return; } if (Isvtenabled == "--SELECT--") { this.ShowErrorMessage("Please confirm if virtualization technology is enabled"); return; } if (Isvtenabled == "False") { this.ShowErrorMessage("Hyper-V can be installed only if virtualization technology is enabled in BIOS"); return; } if (string.IsNullOrWhiteSpace(IPAddress)) { this.ShowErrorMessage("Please enter IP Address."); return; } if (string.IsNullOrWhiteSpace(Hostname)) { this.ShowErrorMessage("Please enter Hostname."); return; } try { //Call PSI file creater Method: CreatePSIFile(Isphysicalmachine, Isvtenabled, IPAddress, Hostname); if (0 == EditHypervinstallationId) { var clientUser = new Hypervinstallation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, Isphysicalmachine=Isphysicalmachine, Isvtenabled=Isvtenabled, IPAddress=IPAddress, Hostname=Hostname }; HypervinstallationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); DDIsvtenabled.SelectedItem.Text = DropdownDefaultText; DDphysicalmachine.SelectedItem.Text = DropdownDefaultText; txtHostname.Text = string.Empty; txtIPAddress.Text = string.Empty; } else { var Hypervinstallation = HypervinstallationService.Retrieve(EditHypervinstallationId); Hypervinstallation.Isphysicalmachine = Isphysicalmachine; Hypervinstallation.Isvtenabled = Isvtenabled; Hypervinstallation.IPAddress = IPAddress; Hypervinstallation.Hostname = Hostname; HypervinstallationService.Update(Hypervinstallation); ShowSuccessMessage("Script Generated. Click to download."); } } catch (Exception ex) { this.ShowErrorMessage( ex.Message.Contains( "An error occurred while updating the entries. See the inner exception for details.") ? "Duplicate Entry" : ex.Message); } }
public virtual void Delete(Hypervinstallation entity) { this.Service.Delete(entity); }