Ejemplo n.º 1
0
        public QueryResult QueryProductAttachmentList(ProductAttachmentQueryFilter request)
        {
            if (request == null)
            {
                throw new BizException(ResouceManager.GetMessageString("IM.ProductAttachment", "RequestIsNull"));
            }
            int totalCount;
            var data = ObjectFactory <IProductAttachmentQueryDA> .Instance.QueryProductAttachment(request, out totalCount);

            var source = new QueryResult {
                Data = data, TotalCount = totalCount
            };

            return(source);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Queries the product attachment.
        /// </summary>
        /// <param name="queryCriteria">The query criteria.</param>
        /// <returns></returns>
        public static QueryResult <ProductAttachmentQueryBasicInfo> QueryProductAttachment(ProductAttachmentQueryFilter queryCriteria)
        {
            int totalCount = 0;
            QueryResult <ProductAttachmentQueryBasicInfo> result = new QueryResult <ProductAttachmentQueryBasicInfo>();

            List <ProductAttachmentQueryBasicInfo> list =
                ProductAttachmentDA.QueryProductAttachment(queryCriteria, out totalCount);

            result.ResultList = list;
            result.PageInfo   = new PageInfo
            {
                PageIndex  = queryCriteria.PageIndex,
                PageSize   = queryCriteria.PageSize,
                TotalCount = totalCount,
            };

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询商品附件
        /// </summary>
        /// <returns></returns>
        public virtual DataTable QueryProductAttachment(ProductAttachmentQueryFilter queryCriteria, out int totalCount)
        {
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryProductAttachment");
            var pagingInfo = new PagingInfoEntity
            {
                SortField     = queryCriteria.PagingInfo.SortBy,
                StartRowIndex = queryCriteria.PagingInfo.PageIndex * queryCriteria.PagingInfo.PageSize,
                MaximumRows   = queryCriteria.PagingInfo.PageSize
            };

            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, "P.ProductSysNo DESC"))
            {
                if (!String.IsNullOrEmpty(queryCriteria.ProductID))
                {
                    dataCommand.AddInputParameter("@ProductID", DbType.String, queryCriteria.ProductID);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.ProductID",
                                                                 DbType.String, "@ProductID",
                                                                 QueryConditionOperatorType.Equal,
                                                                 queryCriteria.ProductID);
                }
                if (!String.IsNullOrEmpty(queryCriteria.ProductName))
                {
                    dataCommand.AddInputParameter("@ProductName", DbType.String, queryCriteria.ProductName);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.ProductName",
                                                                 DbType.String, "@ProductName",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.ProductName);
                }
                if (!String.IsNullOrEmpty(queryCriteria.AttachmentID))
                {
                    dataCommand.AddInputParameter("@AttachmentID", DbType.String, queryCriteria.AttachmentID);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.AttachmentSysNo",
                                                                 DbType.String, "@AttachmentID",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.AttachmentID);
                }
                if (!String.IsNullOrEmpty(queryCriteria.AttachmentName))
                {
                    dataCommand.AddInputParameter("@AttachmentName", DbType.String, queryCriteria.AttachmentName);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.AttachmentName",
                                                                 DbType.String, "@AttachmentName",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.AttachmentName);
                }
                if (!String.IsNullOrEmpty(queryCriteria.EditUser))
                {
                    dataCommand.AddInputParameter("@EditUser", DbType.String, queryCriteria.EditUser);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.InUser",
                                                                 DbType.String, "@EditUser",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.EditUser);
                }
                //sqlBuilder.ConditionConstructor.AddBetweenCondition(QueryConditionRelationType.AND, "P.InDate", DbType.DateTime, "@InDate", QueryConditionOperatorType.LessThanOrEqual, QueryConditionOperatorType.MoreThanOrEqual, queryCriteria.InDateEnd, queryCriteria.InDateStart);
                if (queryCriteria.InDateStart != null)
                {
                    sqlBuilder.ConditionConstructor.AddCondition(
                        QueryConditionRelationType.AND,
                        "P.InDate",
                        DbType.DateTime,
                        "@InDateStart",
                        QueryConditionOperatorType.MoreThanOrEqual,
                        queryCriteria.InDateStart
                        );
                }
                if (queryCriteria.InDateEnd != null)
                {
                    sqlBuilder.ConditionConstructor.AddCondition(
                        QueryConditionRelationType.AND,
                        "P.InDate",
                        DbType.DateTime,
                        "@InDateEnd",
                        QueryConditionOperatorType.LessThan,
                        queryCriteria.InDateEnd
                        );
                }


                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                EnumColumnList enumList = new EnumColumnList();
                enumList.Add("ProductStatus", typeof(ECCentral.BizEntity.IM.ProductStatus));

                DataTable dt = dataCommand.ExecuteDataTable(enumList);
                totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));
                return(dt);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 查询商品附件
        /// </summary>
        /// <returns></returns>
        public static List <ProductAttachmentQueryBasicInfo> QueryProductAttachment(ProductAttachmentQueryFilter queryCriteria, out int totalCount)
        {
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryProductAttachment");
            var pagingInfo = new PagingInfoEntity
            {
                StartRowIndex = queryCriteria.PageIndex * queryCriteria.PageSize,
                MaximumRows   = queryCriteria.PageSize,
                SortField     = queryCriteria.SortFields,
            };

            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, string.IsNullOrEmpty(pagingInfo.SortField) ? pagingInfo.SortField : "P.ProductSysNo DESC"))
            {
                if (!String.IsNullOrEmpty(queryCriteria.ProductID))
                {
                    dataCommand.AddInputParameter("@ProductID", DbType.String, queryCriteria.ProductID);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.ProductID",
                                                                 DbType.String, "@ProductID",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.ProductID);
                }
                if (!String.IsNullOrEmpty(queryCriteria.ProductName))
                {
                    dataCommand.AddInputParameter("@ProductName", DbType.String, queryCriteria.ProductName);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.ProductName",
                                                                 DbType.String, "@ProductName",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.ProductName);
                }
                if (!String.IsNullOrEmpty(queryCriteria.AttachmentID))
                {
                    dataCommand.AddInputParameter("@AttachmentID", DbType.String, queryCriteria.AttachmentID);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.AttachmentSysNo",
                                                                 DbType.String, "@AttachmentID",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.AttachmentID);
                }
                if (!String.IsNullOrEmpty(queryCriteria.AttachmentName))
                {
                    dataCommand.AddInputParameter("@AttachmentName", DbType.String, queryCriteria.AttachmentName);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.AttachmentName",
                                                                 DbType.String, "@AttachmentName",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.AttachmentName);
                }
                if (!String.IsNullOrEmpty(queryCriteria.EditUser))
                {
                    dataCommand.AddInputParameter("@EditUser", DbType.String, queryCriteria.EditUser);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "P.InUser",
                                                                 DbType.String, "@EditUser",
                                                                 QueryConditionOperatorType.Like,
                                                                 queryCriteria.EditUser);
                }
                //sqlBuilder.ConditionConstructor.AddBetweenCondition(QueryConditionRelationType.AND, "P.InDate", DbType.DateTime, "@InDate", QueryConditionOperatorType.LessThanOrEqual, QueryConditionOperatorType.MoreThanOrEqual, queryCriteria.InDateEnd, queryCriteria.InDateStart);
                if (queryCriteria.InDateStart != null)
                {
                    sqlBuilder.ConditionConstructor.AddCondition(
                        QueryConditionRelationType.AND,
                        "P.InDate",
                        DbType.DateTime,
                        "@InDateStart",
                        QueryConditionOperatorType.MoreThanOrEqual,
                        queryCriteria.InDateStart
                        );
                }
                if (queryCriteria.InDateEnd != null)
                {
                    sqlBuilder.ConditionConstructor.AddCondition(
                        QueryConditionRelationType.AND,
                        "P.InDate",
                        DbType.DateTime,
                        "@InDateEnd",
                        QueryConditionOperatorType.LessThanOrEqual,
                        queryCriteria.InDateEnd
                        );
                }
                if (queryCriteria.SellerSysNo.HasValue)
                {
                    dataCommand.AddInputParameter("@SellerSysNo", DbType.String, queryCriteria.SellerSysNo);
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "PP.MerchantSysNo",
                                                                 DbType.String, "@SellerSysNo",
                                                                 QueryConditionOperatorType.Equal,
                                                                 queryCriteria.SellerSysNo);
                }

                dataCommand.CommandText = sqlBuilder.BuildQuerySql();

                List <ProductAttachmentQueryBasicInfo> list = dataCommand.ExecuteEntityList <ProductAttachmentQueryBasicInfo>();

                totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));

                return(list);
            }
        }