Ejemplo n.º 1
0
        private IFilter CreateFilter(CV_PM_ALT_LOGQueryParam qp)
        {
            ArgumentValidator.CheckForNullArgument(qp, "CV_PM_ALT_LOGQueryParam");

            AndFilter      af = new AndFilter();
            MatchingFilter mf = new MatchingFilter();

            if (!qp.IsDefaultValue("AlertAlias"))
            {
                mf.AddMatching("AlertAlias", qp.AlertAlias);
            }

            if (!qp.IsDefaultValue("LogTitle"))
            {
                mf.AddLike("LogTitle", qp.LogTitle);
            }

            if (!qp.IsDefaultValue("LogContent"))
            {
                mf.AddLike("LogContent", qp.LogContent);
            }

            if (!qp.IsDefaultValue("RespondedBy"))
            {
                mf.AddMatching("RespondedBy", qp.RespondedBy);
            }

            if (!qp.IsDefaultValue("IsClosed"))
            {
                mf.AddMatching("IsClosed", qp.IsClosed.Value);
            }

            if (!qp.IsDefaultValue("Z_RespondedOnBegin"))
            {
                mf.AddGreatEqualThan("RespondedOn", qp.Z_RespondedOnBegin.Value);
            }

            if (!qp.IsDefaultValue("Z_RespondedOnEnd"))
            {
                mf.AddLessEqualThan("RespondedOn", qp.Z_RespondedOnEnd.Value);
            }

            af.AddFilter(mf);

            return(af);
        }
Ejemplo n.º 2
0
        public IList <CV_PM_ALT_BASE> GetEntities(CV_PM_ALT_BASE entity)
        {
            long totalRecords = 0;
            IList <CV_PM_ALT_BASE> entities = null;

            try
            {
                AndFilter      af = new AndFilter();
                MatchingFilter mf = new MatchingFilter();
                if (!string.IsNullOrEmpty(entity.Category))
                {
                    mf.AddLike("Category", entity.Category);
                }

                if (!string.IsNullOrEmpty(entity.AlertName))
                {
                    mf.AddLike("AlertName", entity.AlertName);
                }
                if (!string.IsNullOrEmpty(entity.AlertAlias))
                {
                    mf.AddLike("AlertAlias", entity.AlertAlias);
                }
                if (!string.IsNullOrEmpty(entity.AlertDesc))
                {
                    mf.AddLike("AlertDesc", entity.AlertDesc);
                }
                if (!string.IsNullOrEmpty(entity.AlertContent))
                {
                    mf.AddLike("AlertContent", entity.AlertContent);
                }
                if (entity.AlertType.HasValue && entity.AlertType != 0)
                {
                    mf.AddMatching("AlertType", entity.AlertType);
                }
                if (!string.IsNullOrEmpty(entity.Format))
                {
                    mf.AddMatching("Format", entity.Format);
                }
                if (!string.IsNullOrEmpty(entity.AlertObject))
                {
                    mf.AddMatching("AlertObject", entity.AlertObject);
                }
                if (!string.IsNullOrEmpty(entity.PreProcedure))
                {
                    mf.AddMatching("PreProcedure", entity.PreProcedure);
                }
                if (!string.IsNullOrEmpty(entity.PostProcedure))
                {
                    mf.AddMatching("PostProcedure", entity.PostProcedure);
                }
                if (entity.AlertInterval.HasValue && entity.AlertInterval != 0)
                {
                    mf.AddMatching("AlertInterval", entity.Category);
                }
                if (!string.IsNullOrEmpty(entity.AlertTimePoints))
                {
                    mf.AddMatching("AlertTimePoints", entity.AlertTimePoints);
                }
                //if (entity.LastAlertedTime.HasValue)
                //{
                //    mf.AddMatching("LastAlertedTime", entity.LastAlertedTime);
                //}
                if (entity.IsActive.HasValue)
                {
                    mf.AddMatching("IsActive", entity.IsActive);
                }
                if (entity.RowDeleted.HasValue)
                {
                    mf.AddMatching("RowDeleted", entity.RowDeleted);
                }
                if (!string.IsNullOrEmpty(entity.CreatedBy))
                {
                    mf.AddMatching("CreatedBy", entity.CreatedBy);
                }
                //if (entity.CreatedOn.HasValue)
                //{
                //    mf.AddMatching("CreatedOn", entity.CreatedOn);
                //}
                if (!string.IsNullOrEmpty(entity.ModifiedBy))
                {
                    mf.AddMatching("ModifiedBy", entity.ModifiedBy);
                }
                //if (entity.ModifiedOn.HasValue)
                //{
                //    mf.AddMatching("ModifiedOn", entity.ModifiedOn);
                //}

                af.AddFilter(mf);

                Sort sort = new Sort();
                sort.OrderBy("AlertName", Sort.Direction.ASC);

                entities = _CV_PM_ALT_BASEDAO.Find(0, -1, af, sort, out totalRecords);
            }
            catch (Exception ex)
            {
                ExceptionPolicy.HandleException(ex, ExceptionPolicy.BusinessLogicDefaultPolicy);
            }

            return(entities);
        }