public virtual void Delete(Dnsrecordcreation entity) { this.Service.Delete(entity); }
protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); bool returnResult = false; var Hostname = txtHostname.Text.Trim(); var Ipaddress = txtIpaddress.Text.Trim(); var Zonename = txtZonename.Text.Trim(); var Csvfilename = txtCsvfilename.Text.Trim(); // Switch Name validation if (string.IsNullOrWhiteSpace(Hostname)) { this.ShowErrorMessage("Please enter Hostname."); return; } if (string.IsNullOrWhiteSpace(Ipaddress)) { this.ShowErrorMessage("Please enter IP Address."); return; } if (string.IsNullOrWhiteSpace(Zonename)) { this.ShowErrorMessage("Please enter Zone Name."); return; } if (string.IsNullOrWhiteSpace(Csvfilename)) { this.ShowErrorMessage("Please enter Csv File Location."); return; } try { //Call PSI file creater Method: CreatePSIFile(Hostname, Ipaddress, Zonename, Csvfilename); if (0 == EditDnsrecordcreationId) { var clientUser = new Dnsrecordcreation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, Hostname = Hostname, Ipaddress = Ipaddress, Zonename = Zonename, Csvfilename = Csvfilename }; DnsrecordCreationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); txtHostname.Text = string.Empty; txtIpaddress.Text = string.Empty; txtZonename.Text = string.Empty; txtCsvfilename.Text = string.Empty; } else { var DnsrecordCreation = DnsrecordCreationService.Retrieve(EditDnsrecordcreationId); DnsrecordCreation.Hostname = Hostname; DnsrecordCreation.Ipaddress = Ipaddress; DnsrecordCreation.Zonename = Zonename; DnsrecordCreation.Csvfilename = Csvfilename; DnsrecordCreationService.Update(DnsrecordCreation); 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); } }