public virtual void Delete(Addingrodc entity)
 {
     this.Service.Delete(entity);
 }
        protected void ButtonClick(object sender, EventArgs e)
        {
            this.HideLabels();
            var Hostname = txtHostname.Text.Trim();
            var Ipaddress = txtIpaddress.Text.Trim();
            var AllowpraName = txtAllowpraccount.Text.Trim();
            var delegatedadminacc = txtDelegatedacc.Text.Trim();
            var DenypraName = txtdenypraccount.Text.Trim();
            var DomainName = txtdomainname.Text.Trim();
            var SiteName = txtSitename.Text.Trim();
            var dbpath = txtdbpath.Text.Trim();
            var logpath = txtlogpath.Text.Trim();
            var sysvolpath = txtsysvol.Text.Trim();

            // RODC parameter 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(AllowpraName))
            {
                this.ShowErrorMessage("Please enter account that is allowed to replicate Password.");
                return;
            }

            if (string.IsNullOrWhiteSpace(delegatedadminacc))
            {
                this.ShowErrorMessage("Please enter admin account that can be delegated control.");
                return;
            }

            if (string.IsNullOrWhiteSpace(DenypraName))
            {
                this.ShowErrorMessage("Please enter account that is denied to replicate Password.");
                return;
            }

            if (string.IsNullOrWhiteSpace(DomainName))
            {
                this.ShowErrorMessage("Please enter Domain name");
                return;
            }

            if (string.IsNullOrWhiteSpace(SiteName))
            {
                this.ShowErrorMessage("Please enter Site name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(dbpath))
            {
                this.ShowErrorMessage("Please enter Database path.");
                return;
            }

            if (string.IsNullOrWhiteSpace(sysvolpath))
            {
                this.ShowErrorMessage("Please enter System volume path.");
                return;
            }

            if (string.IsNullOrWhiteSpace(logpath))
            {
                this.ShowErrorMessage("Please enter Log path.");
                return;
            }

            try
            {
                //Call PSI file creater Method:
                CreatePSIFile(Hostname, Ipaddress, AllowpraName, delegatedadminacc, DenypraName, DomainName, SiteName, dbpath, sysvolpath, logpath);

                if (0 == EditRODCId)
                {
                    var clientUser = new Addingrodc()
                    {
                        CreatedBy = Context.User.Identity.Name,
                        CreatedDate = DateTimeHelper.Now,
                        Hostname = Hostname,
                        Ipaddress = Ipaddress,
                        Allowreplicationaccount = AllowpraName,
                        Delegatedadminiaccount = delegatedadminacc,
                        Denyreplicationaccount = DenypraName,
                        DomainName= DomainName,
                        SiteName = SiteName,
                        Databasepath=dbpath,
                        Sysvolpath=sysvolpath,
                        Logpath=logpath

                    };

                    AddingrodcService.Create(clientUser);
                    ShowSuccessMessage("Script Generated. Click to download.");
                    txtHostname.Text = string.Empty;
                    txtIpaddress.Text = string.Empty;
                    txtAllowpraccount.Text = string.Empty;
                    txtDelegatedacc.Text = string.Empty;
                    txtdenypraccount.Text = string.Empty;
                    txtdomainname.Text = string.Empty;
                    txtSitename.Text = string.Empty;
                    txtdbpath.Text = string.Empty;
                    txtsysvol.Text = string.Empty;
                    txtlogpath.Text = string.Empty;

                }
                else
                {
                    var RODCcreation = AddingrodcService.Retrieve(EditRODCId);
                    RODCcreation.Hostname = Hostname;
                    RODCcreation.Ipaddress = Ipaddress;
                    RODCcreation.Allowreplicationaccount = AllowpraName;
                    RODCcreation.Denyreplicationaccount = DenypraName;
                    RODCcreation.Delegatedadminiaccount = delegatedadminacc;
                    RODCcreation.DomainName = DomainName;
                    RODCcreation.SiteName = SiteName;
                    RODCcreation.Databasepath = dbpath;
                    RODCcreation.Logpath = logpath;
                    RODCcreation.Sysvolpath = sysvolpath;

                    AddingrodcService.Update(RODCcreation);
                    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);
            }
        }