1) MOdified resource DAO, added method to return shared resources only and a companion method to

rg2023 [2003-05-08 02:02:08]
1) MOdified resource DAO, added method to return shared resources only and a companion method to
return recalled resources only
Filename
discus2/csharpsrc/PSL.TotalRecall/AssemblyInfo.cs
discus2/csharpsrc/PSL.TotalRecall/Constants.cs
discus2/csharpsrc/PSL.TotalRecall/PSL.TotalRecall.suo
discus2/csharpsrc/PSL.TotalRecall/RecommendationResponseCtxMsg.cs
discus2/csharpsrc/PSL.TotalRecall/ResourceCtxMsg.cs
discus2/csharpsrc/PSL.TotalRecall/ResourceDAO.cs
diff --git a/discus2/csharpsrc/PSL.TotalRecall/AssemblyInfo.cs b/discus2/csharpsrc/PSL.TotalRecall/AssemblyInfo.cs
index 5575963..1fd2d9e 100644
--- a/discus2/csharpsrc/PSL.TotalRecall/AssemblyInfo.cs
+++ b/discus2/csharpsrc/PSL.TotalRecall/AssemblyInfo.cs
@@ -27,6 +27,7 @@ using System.Runtime.CompilerServices;
 // by using the '*' as shown below:

 [assembly: AssemblyVersion("1.0.1213.21946")]
+// [assembly: AssemblyVersion("1.0.1214.21900")] will be final version number for sem

 //
 // In order to sign your assembly you must specify a key to use. Refer to the
diff --git a/discus2/csharpsrc/PSL.TotalRecall/Constants.cs b/discus2/csharpsrc/PSL.TotalRecall/Constants.cs
index 7466fd6..9c4dd75 100644
--- a/discus2/csharpsrc/PSL.TotalRecall/Constants.cs
+++ b/discus2/csharpsrc/PSL.TotalRecall/Constants.cs
@@ -8,7 +8,6 @@ namespace PSL.TotalRecall
 	public abstract class Constants
 	{
 		public const string DBConnect = "DSN=TotalRecall;UID=TotalRecallUser;PWD=[32totalRecall67;WSID=HERITAGE0;DATABASE=TotalRecall";
-		public const string ME = "Me";
 		public const string DEFAULT_CERT_PSWD = "discus";

 		// Database table names
diff --git a/discus2/csharpsrc/PSL.TotalRecall/PSL.TotalRecall.suo b/discus2/csharpsrc/PSL.TotalRecall/PSL.TotalRecall.suo
index 62d1a08..713ddbd 100644
Binary files a/discus2/csharpsrc/PSL.TotalRecall/PSL.TotalRecall.suo and b/discus2/csharpsrc/PSL.TotalRecall/PSL.TotalRecall.suo differ
diff --git a/discus2/csharpsrc/PSL.TotalRecall/RecommendationResponseCtxMsg.cs b/discus2/csharpsrc/PSL.TotalRecall/RecommendationResponseCtxMsg.cs
index c90ecdf..bf34471 100644
--- a/discus2/csharpsrc/PSL.TotalRecall/RecommendationResponseCtxMsg.cs
+++ b/discus2/csharpsrc/PSL.TotalRecall/RecommendationResponseCtxMsg.cs
@@ -73,7 +73,9 @@ namespace PSL.TotalRecall
 			{
 				if( value == null )
 					return;
+
 				this.m_resourceMsg = value;
+				this.m_resourceMsg.MeetingID = this.MeetingID;
 			}
 		}
 	}
diff --git a/discus2/csharpsrc/PSL.TotalRecall/ResourceCtxMsg.cs b/discus2/csharpsrc/PSL.TotalRecall/ResourceCtxMsg.cs
index 7b7c604..546bb9f 100644
--- a/discus2/csharpsrc/PSL.TotalRecall/ResourceCtxMsg.cs
+++ b/discus2/csharpsrc/PSL.TotalRecall/ResourceCtxMsg.cs
@@ -14,6 +14,24 @@ namespace PSL.TotalRecall
 		private string m_strNewName = "";
 		private string m_strNewUrl = "";

+		public ResourceCtxMsg( ResourceMsg resMsg )
+		{
+			if( resMsg == null )
+				throw new ArgumentNullException( "resMsg", "Invalid resource message" );
+
+			this.MeetingID = resMsg.MeetingID;
+			this.Sender = resMsg.Sender;
+			this.SenderUrl = resMsg.SenderUrl;
+			this.m_strMessageID = resMsg.MessageID;
+
+
+			IEnumerator it = resMsg.m_lstResources.GetEnumerator();
+			while( it.MoveNext() )
+			{
+				this.m_lstResID.Add( ((Resource) it.Current).ID );
+			}
+		}
+
 		public ResourceCtxMsg()
 		{
 		}
diff --git a/discus2/csharpsrc/PSL.TotalRecall/ResourceDAO.cs b/discus2/csharpsrc/PSL.TotalRecall/ResourceDAO.cs
index 232b19a..b69d983 100644
--- a/discus2/csharpsrc/PSL.TotalRecall/ResourceDAO.cs
+++ b/discus2/csharpsrc/PSL.TotalRecall/ResourceDAO.cs
@@ -39,9 +39,9 @@ namespace PSL.TotalRecall
 					lstResources.Add( res );
 				}
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				Console.WriteLine("Error in GetAllResources(): " + e);
+				// Console.WriteLine("Error in GetAllResources(): " + e);
 			}
 			finally
 			{
@@ -51,7 +51,146 @@ namespace PSL.TotalRecall

 			return lstResources;
 		}
+
+		public ArrayList GetSharedResources( string strMeetingID )
+		{
+			// Quick error checks
+			if( strMeetingID == null || strMeetingID.Length == 0 )
+				throw new ArgumentException( "Invalid meeting ID", "strMeetingID" );
+
+			ArrayList lstResources = new ArrayList();
+			OdbcDataReader dr = null;
+
+			try
+			{
+				StringBuilder strQueryBuilder = new StringBuilder();
+				strQueryBuilder.Append( " SELECT " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_OWNER );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_STATE );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_URL );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_NAME );
+				strQueryBuilder.Append( " FROM " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME );
+				strQueryBuilder.Append( " WHERE " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.MTG_ID );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( "'" + QueryService.MakeQuotesafe( strMeetingID ) + "'" );
+				strQueryBuilder.Append( " AND " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( " AND " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_STATE );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( "'" + QueryService.MakeQuotesafe( enuResourceState.Shared.ToString() ) + "'" );
+
+				dr =  QueryService.ExecuteReader( this.DBConnect, strQueryBuilder.ToString() );
+
+				if( dr == null )
+					throw new Exception( "Null data reader returned from query" );

+				// Scroll thru list returned
+				while( dr.Read() )
+				{
+					Resource res = new Resource();
+					res.ID = (string) dr[Constants.RES_ID];
+					res.Name = (string) dr[Constants.RES_NAME];
+					res.Url = (string) dr[Constants.RES_URL];
+					string strOwner = (string) dr[Constants.RES_OWNER];
+
+					MeetingResource mtgRes =  new MeetingResource( res, strMeetingID, strOwner );
+					mtgRes.State = (enuResourceState) enuResourceState.Parse( typeof(enuResourceState), (string) dr[Constants.RES_STATE], true );
+					lstResources.Add( mtgRes );
+				}
+			}
+			catch( Exception /*e*/ )
+			{
+			}
+			finally
+			{
+				if( dr != null )
+					dr.Close();
+			}
+
+			return lstResources;
+		}
+
+		public ArrayList GetRecalledResources( string strMeetingID )
+		{
+			// Quick error checks
+			if( strMeetingID == null || strMeetingID.Length == 0 )
+				throw new ArgumentException( "Invalid meeting ID", "strMeetingID" );
+
+			ArrayList lstResources = new ArrayList();
+			OdbcDataReader dr = null;
+
+			try
+			{
+				StringBuilder strQueryBuilder = new StringBuilder();
+				strQueryBuilder.Append( " SELECT " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_OWNER );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_STATE );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_URL );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_NAME );
+				strQueryBuilder.Append( " FROM " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME );
+				strQueryBuilder.Append( "," );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME );
+				strQueryBuilder.Append( " WHERE " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.MTG_ID );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( "'" + QueryService.MakeQuotesafe( strMeetingID ) + "'" );
+				strQueryBuilder.Append( " AND " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( Constants.RESOURCES_TABLENAME + "." + Constants.RES_ID );
+				strQueryBuilder.Append( " AND " );
+				strQueryBuilder.Append( Constants.MEETING_RESOURCES_TABLENAME + "." + Constants.RES_STATE );
+				strQueryBuilder.Append( "=" );
+				strQueryBuilder.Append( "'" + QueryService.MakeQuotesafe( enuResourceState.Recalled.ToString() ) + "'" );
+
+				dr =  QueryService.ExecuteReader( this.DBConnect, strQueryBuilder.ToString() );
+
+				if( dr == null )
+					throw new Exception( "Null data reader returned from query" );
+
+				// Scroll thru list returned
+				while( dr.Read() )
+				{
+					Resource res = new Resource();
+					res.ID = (string) dr[Constants.RES_ID];
+					res.Name = (string) dr[Constants.RES_NAME];
+					res.Url = (string) dr[Constants.RES_URL];
+					string strOwner = (string) dr[Constants.RES_OWNER];
+
+					MeetingResource mtgRes =  new MeetingResource( res, strMeetingID, strOwner );
+					mtgRes.State = (enuResourceState) enuResourceState.Parse( typeof(enuResourceState), (string) dr[Constants.RES_STATE], true );
+					lstResources.Add( mtgRes );
+				}
+			}
+			catch( Exception /*e*/ )
+			{
+			}
+			finally
+			{
+				if( dr != null )
+					dr.Close();
+			}
+
+			return lstResources;
+		}

 		public ArrayList GetMeetingResources( string strMeetingID )
 		{
@@ -96,12 +235,14 @@ namespace PSL.TotalRecall
 				// Scroll thru list returned
 				while( dr.Read() )
 				{
-					MeetingResource mtgRes =  new MeetingResource();
-					mtgRes.ID = (string) dr[Constants.RES_ID];
-					mtgRes.Name = (string) dr[Constants.RES_NAME];
-					mtgRes.Owner = (string) dr[Constants.RES_OWNER];
+					Resource res = new Resource();
+					res.ID = (string) dr[Constants.RES_ID];
+					res.Name = (string) dr[Constants.RES_NAME];
+					res.Url = (string) dr[Constants.RES_URL];
+					string strOwner = (string) dr[Constants.RES_OWNER];
+
+					MeetingResource mtgRes =  new MeetingResource( res, strMeetingID, strOwner );
 					mtgRes.State = (enuResourceState) enuResourceState.Parse( typeof(enuResourceState), (string) dr[Constants.RES_STATE], true );
-					mtgRes.Url = (string) dr[Constants.RES_URL];
 					lstResources.Add( mtgRes );
 				}
 			}
@@ -322,9 +463,9 @@ namespace PSL.TotalRecall
 					categories.Add( cat );
 				}
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				Console.WriteLine("Exception in GetResourceCategories(): " + e);
+				// Console.WriteLine("Exception in GetResourceCategories(): " + e);
 			}
 			finally
 			{