protected virtual string GetTimeoutMonitorWorklistFilterString(YZRequest request, IYZDbProvider provider) { string filter = null; string searchType = request.GetString("SearchType", null); string searchBy = request.GetString("SearchBy", null); string processName = request.GetString("ProcessName", null); if (!String.IsNullOrEmpty(processName)) { filter = String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)); } if (!YZStringHelper.EquName(searchType, "AdvancedSearch")) { filter = provider.CombinCond(filter, "Progress >= 1"); } else { if (YZStringHelper.EquName(searchBy, "Progress")) { decimal minProgress = request.GetDecimal("minProgress"); decimal maxProgress = request.GetDecimal("maxProgress", -1); filter = provider.CombinCond(filter, String.Format("Progress >= {0}", minProgress)); if (maxProgress != -1) { filter = provider.CombinCond(filter, String.Format("Progress < {0}", maxProgress)); } } else { DateTime deadline = request.GetDateTime("Deadline"); filter = provider.CombinCond(filter, String.Format("TimeoutDeadline IS NOT NULL AND Progress < 10000 AND TimeoutDeadline <= {0}", provider.DateToQueryString(deadline))); } } return(filter); }
protected virtual string GetFilterStringHistoryTaskStep(YZRequest request, IYZDbProvider provider) { string filter = null; string status = request.GetString("status", null); if (YZStringHelper.EquName(status, TaskState.Running.ToString())) { string recipientUserAccount = request.GetString("RecipientUserAccount", null); if (!String.IsNullOrEmpty(recipientUserAccount)) { filter = provider.CombinCond(filter, String.Format("(FinishAt IS NULL AND (OwnerAccount=N'{0}' OR AgentAccount=N'{0}'))", provider.EncodeText(recipientUserAccount))); } } return(filter); }
protected virtual string GetFilterString(YZRequest request, IYZDbProvider provider) { string filter = null; string searchType = request.GetString("SearchType", null); string keyword = request.GetString("Kwd", null); string clienIPLike = null; string accountLike = null; string actionLike = null; string actParam1Like = null; string actParam2Like = null; string errLike = null; if (!String.IsNullOrEmpty(keyword)) { clienIPLike = String.Format("ClientIP LIKE(N'%{0}%')", provider.EncodeText(keyword)); accountLike = String.Format("UserAccount LIKE(N'%{0}%')", provider.EncodeText(keyword)); actionLike = String.Format("Action LIKE(N'%{0}%')", provider.EncodeText(keyword)); actParam1Like = String.Format("ActParam1 LIKE(N'%{0}%')", provider.EncodeText(keyword)); actParam2Like = String.Format("ActParam2 LIKE(N'%{0}%')", provider.EncodeText(keyword)); errLike = String.Format("Error LIKE(N'%{0}%')", provider.EncodeText(keyword)); } if (YZStringHelper.EquName(searchType, "AdvancedSearch")) { string account = request.GetString("Account", null); string action = request.GetString("Action", null); string result = request.GetString("Result", null); string clientIP = request.GetString("ClientIP", null); string keywordFilter = null; if (!String.IsNullOrEmpty(account)) { filter = provider.CombinCond(filter, String.Format("UserAccount=N'{0}'", provider.EncodeText(account))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, accountLike); } if (action != "all") { filter = provider.CombinCond(filter, String.Format("Action=N'{0}'", provider.EncodeText(action))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, actionLike); } if (result == YZJsonProperty.success) { filter = provider.CombinCond(filter, "Succeed=1"); } if (result == "Failed") { filter = provider.CombinCond(filter, "Succeed=0"); } if (!String.IsNullOrEmpty(clientIP)) { filter = provider.CombinCond(filter, String.Format("ClientIP=N'{0}'", provider.EncodeText(clientIP))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, clienIPLike); } if (!String.IsNullOrEmpty(keyword)) { keywordFilter = provider.CombinCondOR(keywordFilter, actParam1Like); keywordFilter = provider.CombinCondOR(keywordFilter, actParam2Like); keywordFilter = provider.CombinCondOR(keywordFilter, errLike); } filter = provider.CombinCond(filter, keywordFilter); } return(filter); }
protected virtual string GetFilterStringHistoryTaskTaskTable(YZRequest request, IYZDbProvider provider) { string filter = null; string serialNumLike = null; string processNameLike = null; string ownerAccountLike = null; string agentAccountLike = null; string descriptionLike = null; string taskidEqu = null; string keyword = request.GetString("Keyword", null); if (!String.IsNullOrEmpty(keyword)) { serialNumLike = String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(keyword)); processNameLike = String.Format("ProcessName LIKE(N'%{0}%')", provider.EncodeText(keyword)); ownerAccountLike = String.Format("OwnerAccount LIKE(N'%{0}%')", provider.EncodeText(keyword)); agentAccountLike = String.Format("AgentAccount LIKE(N'%{0}%')", provider.EncodeText(keyword)); descriptionLike = String.Format("Description LIKE(N'%{0}%')", provider.EncodeText(keyword)); if (YZStringHelper.IsNumber(keyword)) { taskidEqu = String.Format("TaskID={0}", keyword); } } string processName = request.GetString("processName", null); string status = request.GetString("status", null); string sn = request.GetString("sn", null); string keywordFilter = null; if (!String.IsNullOrEmpty(processName)) { filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike); } DateTime date1 = DateTime.MinValue; DateTime date2 = DateTime.MaxValue; date1 = request.GetDateTime("reqStart", DateTime.MinValue); date2 = request.GetDateTime("reqEnd", DateTime.MaxValue); if (date1 != DateTime.MinValue || date2 != DateTime.MaxValue) { filter = provider.CombinCond(filter, provider.GenPeriodCond("CreateAt", date1, date2)); } if (!String.IsNullOrEmpty(status)) { filter = provider.CombinCond(filter, String.Format("State=N'{0}'", status)); } if (!String.IsNullOrEmpty(sn)) { filter = provider.CombinCond(filter, String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(sn))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike); } keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike); keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike); keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu); keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike); filter = provider.CombinCond(filter, keywordFilter); return(filter); }
protected virtual string GetFilterStringWorklist(YZRequest request, IYZDbProvider provider) { string filter = null; string searchType = request.GetString("SearchType", null); string keyword = request.GetString("Kwd", null); string serialNumLike = null; string processNameLike = null; string ownerAccountLike = null; string agentAccountLike = null; string stepNameLike = null; string descriptionLike = null; string taskidEqu = null; string specProcessName = request.GetString("SpecProcessName", null); if (!String.IsNullOrEmpty(specProcessName)) { string[] processNames = specProcessName.Split(','); string processNameFilter = null; foreach (string processName in processNames) { if (String.IsNullOrEmpty(processName)) { continue; } processNameFilter = provider.CombinCondOR(processNameFilter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName))); } filter = provider.CombinCond(filter, processNameFilter); } if (!String.IsNullOrEmpty(keyword)) { serialNumLike = String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(keyword)); processNameLike = String.Format("ProcessName LIKE(N'%{0}%')", provider.EncodeText(keyword)); ownerAccountLike = String.Format("OwnerAccount LIKE(N'%{0}%')", provider.EncodeText(keyword)); agentAccountLike = String.Format("AgentAccount LIKE(N'%{0}%')", provider.EncodeText(keyword)); stepNameLike = String.Format("NodeName LIKE(N'%{0}%')", provider.EncodeText(keyword)); descriptionLike = String.Format("Description LIKE(N'%{0}%')", provider.EncodeText(keyword)); if (YZStringHelper.IsNumber(keyword)) { taskidEqu = String.Format("TaskID={0}", keyword); } } if (YZStringHelper.EquName(searchType, "AdvancedSearch")) { string processName = request.GetString("ProcessName", null); string postUserAccount = request.GetString("PostUserAccount", null); string periodType = request.GetString("PostDateType", "").ToLower(); string taskId = request.GetString("TaskID", null); string serialNum = request.GetString("SerialNum", null); string keywordFilter = null; if (!String.IsNullOrEmpty(processName)) { filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike); } if (!String.IsNullOrEmpty(postUserAccount)) { filter = provider.CombinCond(filter, String.Format("OwnerAccount=N'{0}' OR AgentAccount=N'{0}'", provider.EncodeText(postUserAccount))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike); keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike); } DateTime date1 = DateTime.MinValue; DateTime date2 = DateTime.MaxValue; if (periodType != "all") { date1 = request.GetDateTime("PostDate1", DateTime.MinValue); date2 = request.GetDateTime("PostDate2", DateTime.MinValue); } if (date1 != DateTime.MinValue) { filter = provider.CombinCond(filter, provider.GenPeriodCond("CreateAt", date1, date2)); } if (!String.IsNullOrEmpty(taskId) && YZStringHelper.IsNumber(taskId)) { filter = provider.CombinCond(filter, String.Format("TaskID={0}", taskId)); } else { keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu); } if (!String.IsNullOrEmpty(serialNum)) { filter = provider.CombinCond(filter, String.Format("SerialNum LIKE(N'{0}%')", provider.EncodeText(serialNum))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike); } keywordFilter = provider.CombinCondOR(keywordFilter, stepNameLike); keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike); filter = provider.CombinCond(filter, keywordFilter); } if (YZStringHelper.EquName(searchType, "QuickSearch")) { string processName = request.GetString("ProcessName", null); string keywordFilter = null; if (!String.IsNullOrEmpty(processName)) { filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName))); } else { keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike); } keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu); keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike); keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike); keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike); keywordFilter = provider.CombinCondOR(keywordFilter, stepNameLike); keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike); filter = provider.CombinCond(filter, keywordFilter); } return(filter); }