public override System.Data.DataSet GetProductConsultationsAndReplys(ProductConsultationAndReplyQuery query, out int total) { System.Data.Common.DbCommand storedProcCommand = this.database.GetStoredProcCommand("ac_Member_ConsultationsAndReplys_Get"); this.database.AddInParameter(storedProcCommand, "PageIndex", System.Data.DbType.Int32, query.PageIndex); this.database.AddInParameter(storedProcCommand, "PageSize", System.Data.DbType.Int32, query.PageSize); this.database.AddInParameter(storedProcCommand, "IsCount", System.Data.DbType.Boolean, query.IsCount); this.database.AddInParameter(storedProcCommand, "sqlPopulate", System.Data.DbType.String, CommentData.BuildConsultationAndReplyQuery(query)); this.database.AddOutParameter(storedProcCommand, "Total", System.Data.DbType.Int32, 4); System.Data.DataSet dataSet = this.database.ExecuteDataSet(storedProcCommand); dataSet.Relations.Add("ConsultationReplys", dataSet.Tables[0].Columns["ConsultationId"], dataSet.Tables[1].Columns["ConsultationId"], false); total = (int)this.database.GetParameterValue(storedProcCommand, "Total"); return(dataSet); }
public override DbQueryResult GetFavorites(int userId, string tags, Pagination page) { DbQueryResult dbQueryResult = new DbQueryResult(); System.Data.Common.DbCommand storedProcCommand = this.database.GetStoredProcCommand("ac_Member_Favorites_Get"); this.database.AddInParameter(storedProcCommand, "PageIndex", System.Data.DbType.Int32, page.PageIndex); this.database.AddInParameter(storedProcCommand, "PageSize", System.Data.DbType.Int32, page.PageSize); this.database.AddInParameter(storedProcCommand, "IsCount", System.Data.DbType.Boolean, page.IsCount); Member member = HiContext.Current.User as Member; this.database.AddInParameter(storedProcCommand, "GradeId", System.Data.DbType.Int32, member.GradeId); this.database.AddInParameter(storedProcCommand, "SqlPopulate", System.Data.DbType.String, CommentData.BuildFavoriteQuery(userId, tags)); this.database.AddOutParameter(storedProcCommand, "TotalFavorites", System.Data.DbType.Int32, 4); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(storedProcCommand)) { dbQueryResult.Data = DataHelper.ConverDataReaderToDataTable(dataReader); if (page.IsCount && dataReader.NextResult()) { dataReader.Read(); dbQueryResult.TotalRecords = dataReader.GetInt32(0); } } return(dbQueryResult); }