Example #1
0
    protected void ButtonConfirm_Click(object sender, EventArgs e)
    {
        RequiresAuthorization(Authorizations.UpdateAdmin);

        List <Models.Setting> listSettings = new List <Models.Setting>
        {
            new Models.Setting
            {
                Name  = "Clobber Enabled",
                Value = chkClobber.Checked ? "1" : "0",
                Id    = Setting.GetSetting("Clobber Enabled").Id
            },
            new Models.Setting
            {
                Name  = "Clobber Prompt Computer Name",
                Value = chkPromptName.Checked ? "1" : "0",
                Id    = Setting.GetSetting("Clobber Prompt Computer Name").Id
            },
            new Models.Setting
            {
                Name  = "Clobber ProfileId",
                Value = ddlImageProfile.SelectedValue,
                Id    = Setting.GetSetting("Clobber ProfileId").Id
            },
        };

        var result = Setting.UpdateSetting(listSettings);

        if (result)
        {
            if (Settings.ClobberEnabled == "1")
            {
                var  imageProfile  = BLL.ImageProfile.ReadProfile(Convert.ToInt32(Settings.ClobberProfileId));
                bool promptForName = Settings.ClobberPromptComputerName == "1";

                var bootMenuResult = new BLL.Workflows.ClobberBootMenu(imageProfile, promptForName).CreatePxeBootFiles();
                if (bootMenuResult)
                {
                    EndUserMessage = "Successfully Enabled Clobber Mode";
                }
            }
            else
            {
                var proxyDhcp = Settings.ProxyDhcp;
                if (proxyDhcp == "Yes")
                {
                    CreateProxyMenu();
                }
                else
                {
                    CreateStandardMenu();
                }
                EndUserMessage = "Successfully Disabled Clobber Mode";
            }
        }
        else
        {
            EndUserMessage = "Could Not Update Settings";
        }
    }
Example #2
0
    protected void ButtonConfirm_Click(object sender, EventArgs e)
    {
        RequiresAuthorization(Authorizations.UpdateAdmin);

        List<Models.Setting> listSettings = new List<Models.Setting>
        {
            new Models.Setting
            {
                Name = "Clobber Enabled",
                Value = chkClobber.Checked ? "1" : "0",
                Id = Setting.GetSetting("Clobber Enabled").Id
            },
            new Models.Setting
            {
                Name = "Clobber Prompt Computer Name",
                Value = chkPromptName.Checked ? "1" : "0",
                Id = Setting.GetSetting("Clobber Prompt Computer Name").Id
            },
            new Models.Setting
            {
                Name = "Clobber ProfileId",
                Value = ddlImageProfile.SelectedValue,
                Id = Setting.GetSetting("Clobber ProfileId").Id
            },
        };

        var result = Setting.UpdateSetting(listSettings);
        if (result)
        {
            if (Settings.ClobberEnabled == "1")
            {
                var imageProfile = BLL.ImageProfile.ReadProfile(Convert.ToInt32(Settings.ClobberProfileId));
                bool promptForName = Settings.ClobberPromptComputerName == "1";

                var bootMenuResult = new BLL.Workflows.ClobberBootMenu(imageProfile, promptForName).CreatePxeBootFiles();
                if (bootMenuResult)
                    EndUserMessage = "Successfully Enabled Clobber Mode";
            }
            else
            {
                var proxyDhcp = Settings.ProxyDhcp;
                if (proxyDhcp == "Yes")
                {
                    CreateProxyMenu();
                }
                else
                {
                    CreateStandardMenu();
                }
                EndUserMessage = "Successfully Disabled Clobber Mode";
            }

        }
        else
        {
            EndUserMessage = "Could Not Update Settings";
        }
    }