Example #1
0
        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);
        }