/// <summary> /// 根据搜索条件,推送计划Id列表,查询出模板变更记录列表【2】 /// </summary> /// <param name="pushPlanIds"></param> /// <param name="query"></param> /// <returns></returns> public static async Task <int> GetTemplateModifyLogCountWithIdsAndQueryInfo(List <int> pushPlanIds, TemplateLogQueryInfo query) { var stringBuilder = new StringBuilder(); var parameters = new List <SqlParameter>(); if (query == null) { query = new TemplateLogQueryInfo() { }; } stringBuilder.Append("SELECT count(1) from Tuhu_log..PushTemplateModifyLog WITH(NOLOCK) where 1=1 "); if (!pushPlanIds.Any()) { pushPlanIds.Add(0); } stringBuilder.Append($" and TemplateId in({string.Join(",", pushPlanIds)})"); if (!string.IsNullOrEmpty(query.ModifyUser)) { parameters.Add(new SqlParameter("@ModifyUser", query.ModifyUser)); stringBuilder.Append($" and [user] like '%' + @ModifyUser + '%'"); } if (query.ModifyStartTime.HasValue) { parameters.Add(new SqlParameter("@ModifyStartTime", query.ModifyStartTime.Value)); stringBuilder.Append($" and lastupdateDateTime>=@ModifyStartTime "); } if (query.ModifyEndTime.HasValue) { parameters.Add(new SqlParameter("@ModifyEndTime", query.ModifyEndTime.Value)); stringBuilder.Append($" and lastupdateDateTime<=@ModifyEndTime "); } var conn = ConfigurationManager.ConnectionStrings["Tuhu_log"].ConnectionString; if (SecurityHelp.IsBase64Formatted(conn)) { conn = SecurityHelp.DecryptAES(conn); } using (var dbHelper = new Tuhu.Component.Common.SqlDbHelper(conn)) { var result = await dbHelper.ExecuteScalarAsync(stringBuilder.ToString(), CommandType.Text, parameters.ToArray()); int count = 1; int.TryParse(result?.ToString(), out count); return(count); } }
public static async Task <int> CheckNavigationOrderAsync(int order, int pkid) { string sql = $"SELECT COUNT(1) FROM Tuhu_notification..MessageNavigationType WHERE [Order]={order} and pkid <>{pkid}"; var conn = ConfigurationManager.ConnectionStrings["Tuhu_log"].ConnectionString; if (SecurityHelp.IsBase64Formatted(conn)) { conn = SecurityHelp.DecryptAES(conn); } using (var dbHelper = new Tuhu.Component.Common.SqlDbHelper(conn)) { var cmd = new SqlCommand(sql); cmd.CommandType = CommandType.Text; var result = await dbHelper.ExecuteScalarAsync(sql); int count = 1; int.TryParse(result?.ToString(), out count); return(count); } }
public static async Task <bool> CheckMessageImageTextOrderAsync(int batchid, int order, int pkid) { string sql = $"SELECT count(1) FROM Tuhu_notification..MessageImageText WITH(NOLOCK) WHERE batchid={batchid} AND [Order]={order} AND pkid<>{pkid}"; var conn = ConfigurationManager.ConnectionStrings["Tuhu_log"].ConnectionString; if (SecurityHelp.IsBase64Formatted(conn)) { conn = SecurityHelp.DecryptAES(conn); } using (var dbHelper = new Tuhu.Component.Common.SqlDbHelper(conn)) { var cmd = new SqlCommand(sql); cmd.CommandType = CommandType.Text; var result = await dbHelper.ExecuteScalarAsync(sql); int count = 1; int.TryParse(result?.ToString(), out count); return(count >= 1); } }