protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); bool returnResult = false; var Hostname = txtHostname.Text.Trim(); var Ipaddress = txtIPAddress.Text.Trim(); // Switch Name validation 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(Hostname, Ipaddress); if (0 == EditroleinstallationId) { var clientUser = new Roleinstallation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, IPAddress = Ipaddress, Hostname = Hostname }; RoleinstallationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); txtHostname.Text = string.Empty; txtIPAddress.Text = string.Empty; } else { var Roleinstallation = RoleinstallationService.Retrieve(EditroleinstallationId); Roleinstallation.Hostname = Hostname; Roleinstallation.IPAddress = Ipaddress; RoleinstallationService.Update(Roleinstallation); 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(Roleinstallation entity) { this.Service.Delete(entity); }