Ejemplo n.º 1
0
    protected void buttonUpdate_OnClick(object sender, EventArgs e)
    {
        if (CloneDeployUser.UserGroupId != -1)
        {
            EndUserMessage = "Cannot Update. This User's Image Management Is Controlled By A Group";
            return;
        }

        var list = new List <Models.UserImageManagement>();

        foreach (GridViewRow row in gvImages.Rows)
        {
            var cb = (CheckBox)row.FindControl("chkSelector");
            if (cb == null || !cb.Checked)
            {
                continue;
            }
            var dataKey = gvImages.DataKeys[row.RowIndex];
            if (dataKey == null)
            {
                continue;
            }
            var userImageManagement = new Models.UserImageManagement
            {
                UserId  = CloneDeployUser.Id,
                ImageId = Convert.ToInt32(dataKey.Value)
            };
            list.Add(userImageManagement);
        }

        BLL.UserImageManagement.DeleteUserImageManagements(CloneDeployUser.Id);
        EndUserMessage = BLL.UserImageManagement.AddUserImageManagements(list)
            ? "Successfully Updated Image Management"
            : "Could Not Update Image Management";
    }
Ejemplo n.º 2
0
    protected void buttonUpdate_OnClick(object sender, EventArgs e)
    {
        if (CloneDeployUser.UserGroupId != -1)
        {
            EndUserMessage = "Cannot Update. This User's Image Management Is Controlled By A Group";
            return;
        }

        var list = new List<Models.UserImageManagement>();
        foreach (GridViewRow row in gvImages.Rows)
        {
            var cb = (CheckBox)row.FindControl("chkSelector");
            if (cb == null || !cb.Checked) continue;
            var dataKey = gvImages.DataKeys[row.RowIndex];
            if (dataKey == null) continue;
            var userImageManagement = new Models.UserImageManagement
            {
                UserId = CloneDeployUser.Id,
                ImageId = Convert.ToInt32(dataKey.Value)
            };
            list.Add(userImageManagement);

        }

        BLL.UserImageManagement.DeleteUserImageManagements(CloneDeployUser.Id);
        EndUserMessage = BLL.UserImageManagement.AddUserImageManagements(list)
            ? "Successfully Updated Image Management"
            : "Could Not Update Image Management";
    }