Example #1
0
 public Script Copy(string appendix)
 {
     return new Script()
     {
         ActionsComment = ActionsComment,
         ActionsFireSequentially = ActionsFireSequentially,
         ActionsIfFalse = ActionsIfFalse.Select(a => a.Copy(appendix)).ToArray(),
         ActionsIfTrue = ActionsIfTrue.Select(a => a.Copy(appendix)).ToArray(),
         ActiveInEasy = ActiveInEasy,
         ActiveInHard = ActiveInHard,
         ActiveInMedium = ActiveInMedium,
         Comment = Comment,
         ConditionsComment = ConditionsComment,
         DeactivateUponSuccess = DeactivateUponSuccess,
         EvaluationInterval = EvaluationInterval,
         EvaluationIntervalType = EvaluationIntervalType,
         IsActive = IsActive,
         IsSubroutine = IsSubroutine,
         LoopActions = LoopActions,
         LoopCount = LoopCount,
         Name = Name + appendix,
         OrConditions = OrConditions.Select(c => c.Copy(appendix)).ToArray(),
         SequentialTargetName = SequentialTargetName, // TODO: appendix?
         SequentialTargetType = SequentialTargetType,
         Unknown = Unknown,
         Unknown2 = Unknown2,
         Unknown3 = Unknown3,
         UsesEvaluationIntervalType = UsesEvaluationIntervalType,
     };
 }
Example #2
0
        public Where <TDto, TProperty, TTable> OrWhere <TProperty>(string columnName)
        {
            var orWhere = new Where <TDto, TProperty, TTable>(TableImpl, Parameters, columnName);

            OrConditions.Add(orWhere);
            return(orWhere);
        }
 public void WhereOrCondition(string WhereClauseContent, Guid?GuidParameter)
 {
     if (GuidParameter == Guid.Empty || GuidParameter == null)
     {
         return;
     }
     OrConditions.Add(" " + WhereClauseContent + " ");
 }
 public void WhereOrCondition(string WhereClauseContent, string StringParameter)
 {
     if (string.IsNullOrEmpty(StringParameter))
     {
         return;
     }
     OrConditions.Add(" " + WhereClauseContent + " ");
 }
 public void WhereOrCondition(string WhereClauseContent, double?DoubleParameter)
 {
     if (DoubleParameter == null)
     {
         return;
     }
     OrConditions.Add(" " + WhereClauseContent + " ");
 }
 public void WhereOrCondition(string WhereClauseContent, int?IntParameter)
 {
     if (IntParameter == null)
     {
         return;
     }
     OrConditions.Add(" " + WhereClauseContent + " ");
 }
Example #7
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
     });
 }
Example #8
0
        public Where <TDto, TProperty, TTable> OrWhere <TProperty>(Expression <Func <TDto, TProperty> > columnExpression, string colPrefix = null)
        {
            var columnName = SpryExpression.GetColumnName(columnExpression);

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

            OrConditions.Add(orWhere);
            return(orWhere);
        }
Example #9
0
 public override int GetSize(bool includingHeader)
 {
     return(base.GetSize(includingHeader)
            + 2
            + Comment.Length
            + 2
            + ConditionComment.Length
            + 2
            + ActionComment.Length
            + 4 * 1
            + 4
            + OrConditions.Sum(o => o.GetSize(true))
            + ActionsIfTrue.Sum(a => a.GetSize(true))
            + ActionsIfFalse.Sum(a => a.GetSize(true)));
 }
Example #10
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);
        }
Example #11
0
 public void WhereOrCondition(string WhereClauseContent)
 {
     OrConditions.Add(" " + WhereClauseContent + " ");
 }