public static TMSArticleCommentDetails Get(System.Int64 acdCommentId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSArticleCommentDetails instance; instance = new TMSArticleCommentDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSArticleCommentDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, acdCommentId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSArticleCommentDetails ID:" + acdCommentId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSArticleCommentDetails[] Search(System.Int64?acdCommentId, System.Int64?acdArticleId, System.Int64?acdLoginId, System.String acdLoginType, System.String acdCommentText, System.String acdMessage, System.Int64?acdReplyId, System.String acdApprovedStatus, System.Int64?acdApproveById, System.String acdApproveByType, System.DateTime?acdDate, System.Int32?acdStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSArticleCommentDetails_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, acdCommentId, acdArticleId, acdLoginId, acdLoginType, acdCommentText, acdMessage, acdReplyId, acdApprovedStatus, acdApproveById, acdApproveByType, acdDate, acdStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSArticleCommentDetails.MapFrom(ds)); }
public static TMSArticleCommentDetails[] MapFrom(DataSet ds) { List <TMSArticleCommentDetails> objects; // Initialise Collection. objects = new List <TMSArticleCommentDetails>(); // Validation. if (ds == null) { throw new ApplicationException("Cannot map to dataset null."); } else if (ds.Tables[TABLE_NAME].Rows.Count == 0) { return(objects.ToArray()); } if (ds.Tables[TABLE_NAME] == null) { throw new ApplicationException("Cannot find table [dbo].[TMS_ArticleCommentDetails] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_ArticleCommentDetails] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSArticleCommentDetails instance = new TMSArticleCommentDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSArticleCommentDetails[] MapFrom(DataSet ds) { List<TMSArticleCommentDetails> objects; // Initialise Collection. objects = new List<TMSArticleCommentDetails>(); // Validation. if (ds == null) throw new ApplicationException("Cannot map to dataset null."); else if (ds.Tables[TABLE_NAME].Rows.Count == 0) return objects.ToArray(); if (ds.Tables[TABLE_NAME] == null) throw new ApplicationException("Cannot find table [dbo].[TMS_ArticleCommentDetails] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_ArticleCommentDetails] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSArticleCommentDetails instance = new TMSArticleCommentDetails(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSArticleCommentDetails Get(System.Int64 acdCommentId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSArticleCommentDetails instance; instance = new TMSArticleCommentDetails(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSArticleCommentDetails_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, acdCommentId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSArticleCommentDetails ID:" + acdCommentId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }