Пример #1
0
 public override System.Data.DataSet GetProductConsultationsAndReplys(ProductConsultationAndReplyQuery query, out int total)
 {
     System.Data.Common.DbCommand storedProcCommand = this.database.GetStoredProcCommand("ac_Underling_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, "DistributorUserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId);
     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);
 }
Пример #2
0
        public override DbQueryResult GetFavorites(int userId, string tags, Pagination page)
        {
            DbQueryResult dbQueryResult = new DbQueryResult();

            System.Data.Common.DbCommand storedProcCommand = this.database.GetStoredProcCommand("ac_Underling_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);
            this.database.AddInParameter(storedProcCommand, "DistributorUserId", System.Data.DbType.Int32, HiContext.Current.SiteSettings.UserId);
            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);
        }