protected void ButtonClick(object sender, EventArgs e) { this.HideLabels(); var Hostname = Txthostname.Text.Trim(); var Ipaddress = txtipaddress.Text.Trim(); var Databasepath = txtdbpath.Text.Trim(); var Domainmode = DDdomainmode.SelectedItem.Text; var Domainname = txtdomainname.Text.Trim(); var Domainnetbiosname = txtnetbios.Text.Trim(); var Forestmode = DDforestmode.SelectedItem.Text; var Logpath = txtlogpath.Text.Trim(); var Sysvolpath = txtsysvol.Text.Trim(); var safemodeadminpwd = txtsafemodepwd.Text.Trim(); // AD Forest parameters 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(Databasepath)) { this.ShowErrorMessage("Please enter Database Path."); return; } if (string.IsNullOrWhiteSpace(Domainname)) { this.ShowErrorMessage("Please enter Domain name."); return; } if (string.IsNullOrWhiteSpace(Domainnetbiosname)) { this.ShowErrorMessage("Please enter Domain Netbios name."); return; } if (string.IsNullOrWhiteSpace(Logpath)) { this.ShowErrorMessage("Please enter Log Path."); return; } if (string.IsNullOrWhiteSpace(Sysvolpath)) { this.ShowErrorMessage("Please enter system volume path."); return; } if (Domainmode == "--SELECT--") { this.ShowErrorMessage("Please select domain mode."); return; } if (Forestmode == "--SELECT--") { this.ShowErrorMessage("Please select AD Forest mode."); return; } if (string.IsNullOrWhiteSpace(safemodeadminpwd)) { this.ShowErrorMessage("Please enter Safemode administrator password."); return; } try { //Call PSI file creater Method: CreatePSIFile(Hostname, Ipaddress, Databasepath, Domainname, Domainnetbiosname, Logpath, Sysvolpath, safemodeadminpwd, Domainmode, Forestmode); if (0 == EditADForestCreationId) { var clientUser = new Forestcreation() { CreatedBy = Context.User.Identity.Name, CreatedDate = DateTimeHelper.Now, Hostname=Hostname, Ipaddress=Ipaddress, Databasepath=Databasepath, Domainname=Domainname, Domainmode=Domainmode, Domainnetbiosname=Domainnetbiosname, Forestmode=Forestmode, Logpath=Logpath, Sysvolpath=Sysvolpath }; ForestCreationService.Create(clientUser); ShowSuccessMessage("Script Generated. Click to download."); Txthostname.Text = string.Empty; txtipaddress.Text = string.Empty; txtdbpath.Text = string.Empty; txtdomainname.Text = string.Empty; DDdomainmode.SelectedItem.Text = DropdownDefaultText; txtnetbios.Text = string.Empty; DDforestmode.SelectedItem.Text = DropdownDefaultText; txtlogpath.Text = string.Empty; txtsysvol.Text = string.Empty; txtsafemodepwd.Text = string.Empty; } else { var ForestCreation = ForestCreationService.Retrieve(EditADForestCreationId); ForestCreation.Hostname = Hostname; ForestCreation.Ipaddress = Ipaddress; ForestCreation.Databasepath = Databasepath; ForestCreation.Domainname = Domainname; ForestCreation.Domainmode = Domainmode; ForestCreation.Domainnetbiosname = Domainnetbiosname; ForestCreation.Forestmode = Forestmode; ForestCreation.Logpath = Logpath; ForestCreation.Sysvolpath = Sysvolpath; ForestCreationService.Update(ForestCreation); 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(Forestcreation entity) { this.Service.Delete(entity); }