public virtual void Delete(VirtualSwitchCreation entity) { this.Service.Delete(entity); }
protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); var switchName = txtSwitchName.Text.Trim(); var adapter = txtAdapter.Text.Trim(); var allowManagementOs = DDAllowManagementOs.SelectedItem.Text; // Switch Name validation if (string.IsNullOrWhiteSpace(switchName)) { this.ShowErrorMessage("Please enter switch name."); return; } if (string.IsNullOrWhiteSpace(adapter)) { this.ShowErrorMessage("Please enter adapter."); return; } if (allowManagementOs == "--SELECT--") { this.ShowErrorMessage("Please select an option for management OS."); return; } try { //Call PSI file creater Method: CreatePSIFile(switchName, adapter, allowManagementOs); if (0 == EditVirtualSwitchCreationId) { var clientUser = new VirtualSwitchCreation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, AllowManagementOs = allowManagementOs, PhysicalAdapter = adapter, SwitchName = switchName }; VirtualSwitchCreationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); txtAdapter.Text = string.Empty; DDAllowManagementOs.SelectedItem.Text = string.Empty; txtSwitchName.Text = string.Empty; } else { var virtualSwitchCreation = VirtualSwitchCreationService.Retrieve(EditVirtualSwitchCreationId); virtualSwitchCreation.AllowManagementOs = allowManagementOs; virtualSwitchCreation.SwitchName = switchName; virtualSwitchCreation.PhysicalAdapter = adapter; VirtualSwitchCreationService.Update(virtualSwitchCreation); 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); } }