protected void buttonUpdate_OnClick(object sender, EventArgs e) { RequiresAuthorization(Authorizations.UpdateGlobal); var updateCount = 0; foreach (GridViewRow row in gvCatalogs.Rows) { var enabled = (CheckBox)row.FindControl("chkSelector"); if (enabled == null) { continue; } if (!enabled.Checked) { continue; } var dataKey = gvCatalogs.DataKeys[row.RowIndex]; if (dataKey == null) { continue; } var catalog = new Models.MunkiManifestCatalog() { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id, }; var txtPriority = row.FindControl("txtPriority") as TextBox; if (txtPriority != null) { if (!string.IsNullOrEmpty(txtPriority.Text)) { catalog.Priority = Convert.ToInt32(txtPriority.Text); } } if (BLL.MunkiCatalog.AddCatalogToTemplate(catalog)) { updateCount++; } } if (updateCount > 0) { EndUserMessage = "Successfully Updated Catalogs"; ManifestTemplate.ChangesApplied = 0; BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate); } else { EndUserMessage = "Could Not Update Catalogs"; } PopulateGrid(); }
protected void buttonUpdate_OnClick(object sender, EventArgs e) { RequiresAuthorization(Authorizations.UpdateGlobal); var updateCount = 0; foreach (GridViewRow row in gvCatalogs.Rows) { var enabled = (CheckBox)row.FindControl("chkSelector"); if (enabled == null) continue; if (!enabled.Checked) continue; var dataKey = gvCatalogs.DataKeys[row.RowIndex]; if (dataKey == null) continue; var catalog = new Models.MunkiManifestCatalog() { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id, }; var txtPriority = row.FindControl("txtPriority") as TextBox; if (txtPriority != null) if (!string.IsNullOrEmpty(txtPriority.Text)) catalog.Priority = Convert.ToInt32(txtPriority.Text); if (BLL.MunkiCatalog.AddCatalogToTemplate(catalog)) updateCount++; } if (updateCount > 0) { EndUserMessage = "Successfully Updated Catalogs"; ManifestTemplate.ChangesApplied = 0; BLL.MunkiManifestTemplate.UpdateManifest(ManifestTemplate); } else { EndUserMessage = "Could Not Update Catalogs"; } PopulateGrid(); }