Example #1
0
		public AccessGroupRightsDetails Details(int GroupID, int TranTypeID)
		{
			try
			{
				AllowedRights rights = new AllowedRights();				
				rights = GetReadWrite(GroupID,TranTypeID);
 			
				AccessGroupRightsDetails Details = new AccessGroupRightsDetails();
	
				Details.GroupID = GroupID;
				Details.TranTypeID = TranTypeID;
				Details.Read = rights.Read;
				Details.Write = rights.Write; 

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #2
0
		public AccessRightsDetails Details(Int64 UID, Int16 TranTypeID)
		{
			try
			{
				AllowedRights rights = new AllowedRights();				
				rights = GetReadWrite(UID,TranTypeID);
 			
				AccessRightsDetails Details = new AccessRightsDetails();
	
				Details.UID = UID;
				Details.TranTypeID = TranTypeID;
				Details.Read = rights.Read;
				Details.Write = rights.Write; 

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Example #3
0
		public AllowedRights GetReadWrite(int GroupID,int TranTypeID)
		{
			try
			{
				string SQL ="SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
							"FROM sysAccessGroupRights " +
							"WHERE GroupID = @GroupID AND TranTypeID = @TranTypeID";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				cmd.Parameters.AddWithValue("@GroupID", GroupID);
				cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				AllowedRights rights = new AllowedRights();

				while (myReader.Read())
				{
					rights.Read = myReader.GetBoolean("Read");
					rights.Write  = myReader.GetBoolean("Write");
				}
			
				myReader.Close();

				return rights;

			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}		
		}
Example #4
0
		public AllowedRights GetReadWrite(Int64 UID,int TranTypeID)
		{
			try
			{
				string SQL ="SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
                                "FROM sysAccessRights a INNER JOIN sysAccessTypes b ON a.TranTypeID = b.TypeID " +
							"WHERE UID = @UID AND TranTypeID = @TranTypeID AND Enabled=1 ";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                cmd.Parameters.AddWithValue("@UID", UID);
				cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

                System.Data.DataTable dt = new System.Data.DataTable("tblAccess");
                base.MySqlDataAdapterFill(cmd, dt);
				
				AllowedRights rights = new AllowedRights();

				foreach(System.Data.DataRow dr in dt.Rows)
				{
                    rights.Read = Convert.ToBoolean(Int16.Parse(dr["Read"].ToString()));
                    rights.Write = Convert.ToBoolean(Int16.Parse(dr["Write"].ToString()));
				}

				return rights;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}		
		}