Ejemplo n.º 1
0
    protected void btnAddSelected_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorizationOrManagedGroup(Authorizations.UpdateGroup, Group.Id);
        var list = new List <Models.GroupMunki>();

        foreach (GridViewRow row in gvManifestTemplates.Rows)
        {
            var cb = (CheckBox)row.FindControl("chkSelector");
            if (cb == null || !cb.Checked)
            {
                continue;
            }
            var dataKey = gvManifestTemplates.DataKeys[row.RowIndex];
            if (dataKey == null)
            {
                continue;
            }
            var template = new Models.GroupMunki
            {
                GroupId         = Group.Id,
                MunkiTemplateId = Convert.ToInt32(dataKey.Value)
            };
            list.Add(template);
        }

        BLL.GroupMunki.DeleteMunkiTemplates(Group.Id);
        if (list.Count > 0)
        {
            EndUserMessage = BLL.GroupMunki.AddMunkiTemplates(list)
            ? "Successfully Updated Munki Templates"
            : "Could Not Update Munki Templates";
        }
    }
Ejemplo n.º 2
0
    protected void btnAddSelected_OnClick(object sender, EventArgs e)
    {
        RequiresAuthorizationOrManagedGroup(Authorizations.UpdateGroup, Group.Id);
        var list = new List<Models.GroupMunki>();
        foreach (GridViewRow row in gvManifestTemplates.Rows)
        {
            var cb = (CheckBox)row.FindControl("chkSelector");
            if (cb == null || !cb.Checked) continue;
            var dataKey = gvManifestTemplates.DataKeys[row.RowIndex];
            if (dataKey == null) continue;
            var template = new Models.GroupMunki
            {
                GroupId = Group.Id,
                MunkiTemplateId = Convert.ToInt32(dataKey.Value)
            };
            list.Add(template);

        }

        BLL.GroupMunki.DeleteMunkiTemplates(Group.Id);
        if(list.Count > 0)
        {
            EndUserMessage = BLL.GroupMunki.AddMunkiTemplates(list)
            ? "Successfully Updated Munki Templates"
            : "Could Not Update Munki Templates";
        }
    }