Esempio n. 1
0
        public Where <TDto, TProperty, TTable> AndWhere <TProperty>(string columnName)
        {
            var andWhere = new Where <TDto, TProperty, TTable>(TableImpl, Parameters, columnName);

            AndConditions.Add(andWhere);
            return(andWhere);
        }
Esempio n. 2
0
 public void WhereAndCondition(string WhereClauseContent, int?IntParameter)
 {
     if (IntParameter == null)
     {
         return;
     }
     AndConditions.Add(" " + WhereClauseContent + " ");
 }
Esempio n. 3
0
 public void WhereAndCondition(string WhereClauseContent, Guid?GuidParameter)
 {
     if (GuidParameter == Guid.Empty || GuidParameter == null)
     {
         return;
     }
     AndConditions.Add(" " + WhereClauseContent + " ");
 }
Esempio n. 4
0
 public void WhereAndCondition(string WhereClauseContent, string StringParameter)
 {
     if (string.IsNullOrEmpty(StringParameter))
     {
         return;
     }
     AndConditions.Add(" " + WhereClauseContent + " ");
 }
Esempio n. 5
0
 public void WhereAndCondition(string WhereClauseContent, double?DoubleParameter)
 {
     if (DoubleParameter == null)
     {
         return;
     }
     AndConditions.Add(" " + WhereClauseContent + " ");
 }
Esempio n. 6
0
 public PredicateProgramDto ToDto()
 {
     return(new PredicateProgramDto
     {
         AndConditions = AndConditions != null?AndConditions.Select(ParameterPredicate.ToDto).ToList() : null,
                             OrConditions = OrConditions != null?OrConditions.Select(ParameterPredicate.ToDto).ToList() : null,
                                                Condition = ParameterPredicate.ToDto(Condition),
                                                Program = Program.Name
     });
 }
Esempio n. 7
0
        public Where <TDto, TProperty, TTable> AndWhere <TProperty>(Expression <Func <TDto, TProperty> > columnExpression, string colPrefix = null)
        {
            var columnName = SpryExpression.GetColumnName(columnExpression);

            if (!string.IsNullOrWhiteSpace(colPrefix))
            {
                columnName = colPrefix + "." + columnName;
            }
            var andWhere = new Where <TDto, TProperty, TTable>(TableImpl, Parameters, columnName);

            AndConditions.Add(andWhere);
            return(andWhere);
        }
Esempio n. 8
0
        public string GetQuery()
        {
            if (!AndConditions.Any() && !OrConditions.Any())
            {
                return(InitialQuery + " " + WhereClause);
            }

            var IsFirst = true;

            WhereClause = new StringBuilder(" where ");

            // Add And Conditions
            if (AndConditions.Any())
            {
                foreach (var condition in AndConditions)
                {
                    if (!IsFirst)
                    {
                        WhereClause.Append(" and ");
                    }
                    WhereClause.Append(" " + condition + " ");
                    IsFirst = false;
                }
            }

            //Add Or Conditions
            if (OrConditions.Any())
            {
                foreach (var condition in OrConditions)
                {
                    if (!IsFirst)
                    {
                        WhereClause.Append(" or ");
                    }
                    WhereClause.Append(" " + condition + " ");
                    IsFirst = false;
                }
            }
            return(InitialQuery + " " + WhereClause + " " + GroupByClause + " " + HavingClause);
        }
Esempio n. 9
0
 public void WhereAndCondition(string WhereClauseContent)
 {
     AndConditions.Add(" " + WhereClauseContent + " ");
 }