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 managedUpdate = new Models.MunkiManifestManagedUpdate { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id, }; var condition = (TextBox)row.FindControl("txtCondition"); managedUpdate.Condition = condition.Text; if (BLL.MunkiManagedUpdate.AddManagedUpdateToTemplate(managedUpdate)) { updateCount++; } } if (updateCount > 0) { EndUserMessage = "Successfully Updated Managed Updates"; ManifestTemplate.ChangesApplied = 0; BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate); } else { EndUserMessage = "Could Not Update Managed Updates"; } 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 managedUpdate = new Models.MunkiManifestManagedUpdate { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id, }; var condition = (TextBox)row.FindControl("txtCondition"); managedUpdate.Condition = condition.Text; if (BLL.MunkiManagedUpdate.AddManagedUpdateToTemplate(managedUpdate)) updateCount++; } if (updateCount > 0) { EndUserMessage = "Successfully Updated Managed Updates"; ManifestTemplate.ChangesApplied = 0; BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate); } else { EndUserMessage = "Could Not Update Managed Updates"; } PopulateGrid(); }