public static TMSParentReviews Get(System.Int64 prReviewsId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentReviews instance; instance = new TMSParentReviews(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentReviews_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, prReviewsId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSParentReviews ID:" + prReviewsId.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSParentReviews[] Search(System.Int64?prReviewsId, System.Int64?prLoginId, System.Int64?prSenderId, System.Int64?prReceivedId, System.Int64?prReplyId, System.Int64?prReviewCount, System.String prReviewType, System.String prReviewTitle, System.String prReviewSubject, System.String prDescription, System.String prReviewText, System.String prReviewRemarks, System.Int32?prReadStatus, System.DateTime?prSendDate, System.DateTime?prDate, System.Int32?prStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentReviews_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, prReviewsId, prLoginId, prSenderId, prReceivedId, prReplyId, prReviewCount, prReviewType, prReviewTitle, prReviewSubject, prDescription, prReviewText, prReviewRemarks, prReadStatus, prSendDate, prDate, prStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSParentReviews.MapFrom(ds)); }
public static TMSParentReviews[] MapFrom(DataSet ds) { List <TMSParentReviews> objects; // Initialise Collection. objects = new List <TMSParentReviews>(); // 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_ParentReviews] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_ParentReviews] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentReviews instance = new TMSParentReviews(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSParentReviews[] MapFrom(DataSet ds) { List<TMSParentReviews> objects; // Initialise Collection. objects = new List<TMSParentReviews>(); // 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_ParentReviews] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_ParentReviews] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSParentReviews instance = new TMSParentReviews(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSParentReviews Get(System.Int64 prReviewsId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSParentReviews instance; instance = new TMSParentReviews(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSParentReviews_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, prReviewsId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSParentReviews ID:" + prReviewsId.ToString()+ " from Database."); // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }