public void ExportExcelForCouponsCodeList(CouponCodeQueryFilterViewModel queryFilter, ColumnSet[] columns) { string relativeUrl = "/MKTService/Coupons/CouponCode/Query"; CouponCodeQueryFilter filter = queryFilter.ConvertVM <CouponCodeQueryFilterViewModel, CouponCodeQueryFilter>(); restClient.ExportFile(relativeUrl, filter, columns); }
public ActionResult AjaxCouponCodeQuery() { CouponCodeQueryFilter filter = BuildQueryFilterEntity <CouponCodeQueryFilter>(); filter.MerchantSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo; var result = CouponService.QueryCouponCodeList(filter); return(AjaxGridJson(result)); }
public virtual QueryResult QueryCouponCode(CouponCodeQueryFilter request) { int totalCount; var dataTable = ObjectFactory <ICouponsQueryDA> .Instance.QueryCouponCode(request, out totalCount).Tables[0]; return(new QueryResult() { Data = dataTable, TotalCount = totalCount }); }
public void QueryCouponCode(CouponCodeQueryFilterViewModel requestVM, EventHandler <RestClientEventArgs <dynamic> > callback) { string relativeUrl = "/MKTService/Coupons/CouponCode/Query"; CouponCodeQueryFilter filter = requestVM.ConvertVM <CouponCodeQueryFilterViewModel, CouponCodeQueryFilter>(); restClient.QueryDynamicData(relativeUrl, filter, (obj, args) => { if (args.FaultsHandle()) { return; } callback(obj, args); }); }
public DataSet QueryCouponCode(CouponCodeQueryFilter filter, out int totalCount) { PagingInfoEntity pagingEntity = new PagingInfoEntity(); pagingEntity.SortField = filter.PageInfo.SortBy; pagingEntity.MaximumRows = filter.PageInfo.PageSize; pagingEntity.StartRowIndex = filter.PageInfo.PageIndex * filter.PageInfo.PageSize; var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryCouponCode"); using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, "SysNo ASC")) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CouponSysNo", DbType.Int32, "@CouponSysNo", QueryConditionOperatorType.Equal, filter.CouponSysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CouponCode", DbType.String, "@CouponCode", QueryConditionOperatorType.Equal, filter.CouponCode); sqlBuilder.ConditionConstructor.AddBetweenCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32, "@SysNo", QueryConditionOperatorType.MoreThanOrEqual, QueryConditionOperatorType.LessThanOrEqual, filter.CodeSysNoFrom, filter.CodeSysNoTo); sqlBuilder.ConditionConstructor.AddBetweenCondition(QueryConditionRelationType.AND, "InDate", DbType.DateTime, "@InDate", QueryConditionOperatorType.MoreThanOrEqual, QueryConditionOperatorType.LessThan, filter.InDateFrom, filter.InDateTo != null ? filter.InDateTo.Value.AddDays(1) : filter.InDateTo); if (filter.EndDateTo.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "BeginDate", DbType.DateTime, "@BeginDate", QueryConditionOperatorType.LessThan, filter.EndDateTo.Value.AddDays(1)); } if (filter.BeginDateFrom.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "EndDate", DbType.DateTime, "@EndDate", QueryConditionOperatorType.MoreThanOrEqual, filter.BeginDateFrom); } cmd.CommandText = sqlBuilder.BuildQuerySql(); var ds = cmd.ExecuteDataSet(); totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); return(ds); } }
public static QueryResult <CouponCode> QueryCouponCodeList(CouponCodeQueryFilter queryFilter) { return(CouponDA.QueryCouponCodeList(queryFilter)); }
public static QueryResult <CouponCode> QueryCouponCodeList(CouponCodeQueryFilter queryFilter) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("QueryCouponCode"); using (var sqlBuilder = new DynamicQuerySqlBuilder(command.CommandText, command, queryFilter, string.IsNullOrEmpty(queryFilter.SortFields) ? "c.SysNo ASC" : queryFilter.SortFields)) { //Set SQL WHERE Condition: if (queryFilter.CouponSysNo.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.CouponSysNo", DbType.Int32, "@CouponSysNo", QueryConditionOperatorType.Equal, queryFilter.CouponSysNo); } if (!string.IsNullOrWhiteSpace(queryFilter.CouponCode)) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.CouponCode", DbType.String, "@CouponCode", QueryConditionOperatorType.Like, queryFilter.CouponCode); } if (queryFilter.InDateFrom.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.InDate", DbType.DateTime, "@InDateFrom", QueryConditionOperatorType.MoreThanOrEqual, queryFilter.InDateFrom.Value.Date); } if (queryFilter.InDateTo.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.InDate", DbType.DateTime, "@InDateTo", QueryConditionOperatorType.LessThan, queryFilter.InDateTo.Value.Date.AddDays(1)); } if (queryFilter.BeginDateFrom.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.BeginDate", DbType.DateTime, "@BeginDateFrom", QueryConditionOperatorType.MoreThanOrEqual, queryFilter.BeginDateFrom.Value.Date); } if (queryFilter.BeginDateTo.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.BeginDate", DbType.DateTime, "@BeginDateTo", QueryConditionOperatorType.LessThan, queryFilter.BeginDateTo.Value.Date.AddDays(1)); } if (queryFilter.EndDateFrom.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.EndDate", DbType.DateTime, "@EndDateFrom", QueryConditionOperatorType.MoreThanOrEqual, queryFilter.EndDateFrom.Value.Date); } if (queryFilter.EndDateTo.HasValue) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "c.EndDate", DbType.DateTime, "@EndDateTo", QueryConditionOperatorType.LessThan, queryFilter.EndDateTo.Value.Date.AddDays(1)); } command.CommandText = sqlBuilder.BuildQuerySql(); List <CouponCode> resultList = command.ExecuteEntityList <CouponCode>(); int totalCount = Convert.ToInt32(command.GetParameterValue("@TotalCount")); return(new QueryResult <CouponCode>() { PageInfo = new PageInfo() { PageIndex = queryFilter.PageIndex, PageSize = queryFilter.PageSize, TotalCount = totalCount, SortBy = queryFilter.SortFields }, ResultList = resultList }); } }