protected void renderActionButtons() { int userId = Convert.ToInt32(Session["id"]); // Check current user exists in the list of partner or not int partnerIndex = arrPartnerId.FindIndex(u => u == userId); // Get owner id int ownerId = TasksBLL.getOwnerByTaskId(task.ID); if (partnerIndex != -1) { isPartner = true; } else { isPartner = false; } if (Convert.ToInt32(Session["id"].ToString()) == ownerId) { isOwner = true; isPartner = false; } else { isOwner = false; } }
protected void loadDisEnInput() { if (!Session["role"].Equals("admin") && !isOwner && !isPartner) { title.Enabled = false; startDate.Enabled = false; endDate.Enabled = false; status.Disabled = true; privateScope.Enabled = false; foreach (GridViewRow row in usersGridView.Rows) { var checkbox = (CheckBox)row.FindControl("checkbox"); if (!checkbox.Checked) { checkbox.Enabled = false; } else { checkbox.Style.Add("pointer-events", "none"); } } } else { // Get owner id int ownerId = TasksBLL.getOwnerByTaskId(task.ID); foreach (GridViewRow row in usersGridView.Rows) { var checkbox = (CheckBox)row.FindControl("checkbox"); if (checkbox.Checked && Convert.ToInt32(row.Cells[1].Text) == ownerId) { checkbox.Style.Add("pointer-events", "none"); } } } }