public virtual void Delete(Scopecreation 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 Csvfile = txtCsvfilename.Text.Trim(); // Switch Name validation if (string.IsNullOrWhiteSpace(Hostname)) { this.ShowErrorMessage("Please enter Host name."); return; } if (string.IsNullOrWhiteSpace(Ipaddress)) { this.ShowErrorMessage("Please enter IP Address."); return; } if (string.IsNullOrWhiteSpace(Csvfile)) { this.ShowErrorMessage("Please enter CSV file path."); return; } try { //Call PSI file creater Method: CreatePSIFile(Hostname, Ipaddress, Csvfile); if (0 == EditScopeCreationId) { var clientUser = new Scopecreation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, Hostname = Hostname, Ipaddress = Ipaddress, Csvfilename = Csvfile }; ScopeCreationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); txtHostname.Text = string.Empty; txtIPAddress.Text = string.Empty; txtCsvfilename.Text = string.Empty; } else { var Scopecreation = ScopeCreationService.Retrieve(EditScopeCreationId); Scopecreation.Hostname = Hostname; Scopecreation.Ipaddress = Ipaddress; Scopecreation.Csvfilename = Csvfile; ScopeCreationService.Update(Scopecreation); 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); } }