Exemple #1
0
        /// <summary>
        /// 查询邮件短信模板
        /// </summary>
        /// <param name="filter">查询条件</param>
        /// <returns></returns>
        public static QueryResult<EmailAndSMSTemplates> QueryEmailAndSMSTemplates(EmailAndSMSTemplatesQueryFilter filter)
        {
            QueryResult<EmailAndSMSTemplates> result = new QueryResult<EmailAndSMSTemplates>();
            result.ServicePageIndex = filter.ServicePageIndex;
            result.PageSize = filter.PageSize;

            PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
            CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryEmailAndSMSTemplates");
            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC"))
            {
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
                    "@Status1", QueryConditionOperatorType.NotEqual, CommonStatus.Deleted);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32,
                    "@SysNo", QueryConditionOperatorType.Equal, filter.SysNo);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Category", DbType.String,
                    "@Category", QueryConditionOperatorType.Like, filter.Category);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Templates", DbType.String,
                    "@Templates", QueryConditionOperatorType.Like, filter.Templates);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
                    "@Status", QueryConditionOperatorType.Equal, filter.Status);

                cmd.CommandText = sqlBuilder.BuildQuerySql();
                result.ResultList = cmd.ExecuteEntityList<EmailAndSMSTemplates>();
                result.TotalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));

                return result;
            }
        }
Exemple #2
0
 public void TestMethodQueryEmailAndSMSTemplates()
 {
     EmailAndSMSTemplatesQueryFilter filter = new EmailAndSMSTemplatesQueryFilter()
     {
         PageIndex = 1,
         PageSize = 10,
         Category = "SMS",
         Templates = "您",
         Status = CommonStatus.Valid,
         SysNo = 1001
     };
     var data = InfoTemplatesMgtService.Instance.QueryEmailAndSMSTemplates(filter);
 }