protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); var isstaticip = DDStaticIP.SelectedItem.Text; var hostname = txtHostname.Text.Trim(); var Ipaddress = txtIpaddress.Text.Trim(); // DNS installation validation if (isstaticip == "--SELECT--") { this.ShowErrorMessage("Please confirm if server has static IP Address"); return; } if (isstaticip == "False") { this.ShowErrorMessage("DNS Server should have static IP Address"); return; } if (string.IsNullOrWhiteSpace(hostname)) { this.ShowErrorMessage("Please enter Hostname."); return; } if (string.IsNullOrWhiteSpace(Ipaddress)) { this.ShowErrorMessage("Please enter IP Address."); return; } try { //Call PSI file creater Method: CreatePSIFile(isstaticip, hostname, Ipaddress); if (0 == EditDnsinstallationId) { var clientUser = new Dnsinstallation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, Staticip = isstaticip, Hostname = hostname, Ipaddress = Ipaddress }; DnsinstallationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); DDStaticIP.SelectedItem.Text= DropdownDefaultText; txtHostname.Text = string.Empty; txtIpaddress.Text = string.Empty; } else { var Dnsinstallation = DnsinstallationService.Retrieve(EditDnsinstallationId); Dnsinstallation.Staticip = isstaticip; Dnsinstallation.Hostname = hostname; Dnsinstallation.Ipaddress = Ipaddress; DnsinstallationService.Update(Dnsinstallation); 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(Dnsinstallation entity) { this.Service.Delete(entity); }