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