public bool HasPermission(string userType) { if (PermittedUsers.Count == 0) { return(true); } return(PermittedUsers.Any(pu => { return pu.Equals(userType, StringComparison.CurrentCultureIgnoreCase); })); }
/// <summary> /// הבאת פרטי העמותה על פי קוד /// </summary> public void GetAssociationByCodeAmuta() { DbService db = new DbService(); DataSet DS = new DataSet(); //Voluntary_association A = new Voluntary_association(); string sql1 = "select * from association " + "where association_code= @code"; string sql2 = @" SELECT dbo.users.user_id,dbo.users.first_name, dbo.users.last_name,dbo.users.active FROM dbo.association_access LEFT JOIN dbo.users ON dbo.association_access.user_id = dbo.users.user_id WHERE(dbo.association_access.association_code = @code )"; string sql3 = @" SELECT dbo.tags.tag_code, dbo.tags.tag_desc FROM dbo.tag_of_association INNER JOIN dbo.tags ON dbo.tag_of_association.tag_code = dbo.tags.tag_code WHERE (dbo.tag_of_association.association_code = @code)"; SqlParameter parCode = new SqlParameter("@code", Association_Code); DS = db.GetDataSetByQuery(sql1 + sql2 + sql3, CommandType.Text, parCode); //מילוי פרטים foreach (DataRow row in DS.Tables[0].Rows) { Association_Code = row[0].ToString(); Association_Name = row[1].ToString(); Association_Desc = row[2].ToString(); Association_Account = row[3].ToString(); Association_WebSite = row[4].ToString(); Association_Image = row[5].ToString(); Association_Year = row[6].ToString(); } //מילוי רשימת מורשי גישה foreach (DataRow row in DS.Tables[1].Rows) { UserT permitted = new UserT(row[0].ToString(), row[1].ToString(), row[2].ToString(), bool.Parse(row[3].ToString())); List <Voluntary_association> temp_li = permitted.GetUserAssociations(); permitted.Address = temp_li.Count.ToString(); //שימוש חד פעמי בשדה כתובת להעברת מס' לדף הטמל PermittedUsers.Add(permitted); } //מילוי רשימת תגיות foreach (DataRow row in DS.Tables[2].Rows) { Association_Tag tag = new Association_Tag(int.Parse(row[0].ToString()), row[1].ToString()); Association_Tags.Add(tag); } }