protected void buttonUpdate_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorization(Authorizations.UpdateGlobal);

        var updateCount = 0;
        foreach (GridViewRow row in gvPkgInfos.Rows)
        {
            var enabled = (CheckBox)row.FindControl("chkSelector");
            if (enabled == null) continue;
            if (!enabled.Checked) continue;

            var dataKey = gvPkgInfos.DataKeys[row.RowIndex];
            if (dataKey == null) continue;

            var managedUninstall = new Models.MunkiManifestManagedUnInstall()
            {
                Name = dataKey.Value.ToString(),
                ManifestTemplateId = ManifestTemplate.Id,
            };

            var cbUseVersion = (CheckBox)row.FindControl("chkUseVersion");
            if (cbUseVersion.Checked)
            {
                managedUninstall.Version = row.Cells[2].Text;
                managedUninstall.IncludeVersion = 1;
            }

            var condition = (TextBox)row.FindControl("txtCondition");
            managedUninstall.Condition = condition.Text;
            if (BLL.MunkiManagedUninstall.AddManagedUnInstallToTemplate(managedUninstall)) updateCount++;
        }

        if (updateCount > 0)
        {
            EndUserMessage = "Successfully Updated Managed Uninstalls";
            ManifestTemplate.ChangesApplied = 0;
            BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate);
        }
        else
        {
            EndUserMessage = "Could Not Update Managed Uninstalls";
        }

        PopulateGrid();
    }
    protected void buttonUpdate_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorization(Authorizations.UpdateGlobal);

        var updateCount = 0;

        foreach (GridViewRow row in gvPkgInfos.Rows)
        {
            var enabled = (CheckBox)row.FindControl("chkSelector");
            if (enabled == null)
            {
                continue;
            }
            if (!enabled.Checked)
            {
                continue;
            }

            var dataKey = gvPkgInfos.DataKeys[row.RowIndex];
            if (dataKey == null)
            {
                continue;
            }

            var managedUninstall = new Models.MunkiManifestManagedUnInstall()
            {
                Name = dataKey.Value.ToString(),
                ManifestTemplateId = ManifestTemplate.Id,
            };



            var cbUseVersion = (CheckBox)row.FindControl("chkUseVersion");
            if (cbUseVersion.Checked)
            {
                managedUninstall.Version        = row.Cells[2].Text;
                managedUninstall.IncludeVersion = 1;
            }

            var condition = (TextBox)row.FindControl("txtCondition");
            managedUninstall.Condition = condition.Text;
            if (BLL.MunkiManagedUninstall.AddManagedUnInstallToTemplate(managedUninstall))
            {
                updateCount++;
            }
        }


        if (updateCount > 0)
        {
            EndUserMessage = "Successfully Updated Managed Uninstalls";
            ManifestTemplate.ChangesApplied = 0;
            BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate);
        }
        else
        {
            EndUserMessage = "Could Not Update Managed Uninstalls";
        }



        PopulateGrid();
    }