예제 #1
0
 ///<summary>CurrentValues must be set first.  Then, this applies the values to the parameter to create the outputValue.  The currentValues is usually just a single value.  The only time there will be multiple values is for an Enum or QueryText.  For example, if a user selects multiple items from a listbox for this parameter, then each item is connected by an OR.  The entire OutputValue is surrounded by parentheses.</summary>
 public void FillOutputValue()
 {
     outputValue = "(";
     if (currentValues.Count == 0)        //if there are no values
     {
         outputValue += "1";              //display a 1 (true) to effectively exclude this snippet
     }
     for (int i = 0; i < currentValues.Count; i++)
     {
         if (i > 0)
         {
             outputValue += " OR ";
         }
         if (valueType == ParamValueType.Boolean)
         {
             if ((bool)currentValues[i])
             {
                 outputValue += snippet;                      //snippet will show. There is no ? substitution
             }
             else
             {
                 outputValue += "1";                      //instead of the snippet, a 1 will show
             }
         }
         else if (valueType == ParamValueType.Date)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PDate((DateTime)currentValues[i], false));
         }
         else if (valueType == ParamValueType.Enum)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PInt((int)currentValues[i]));
         }
         else if (valueType == ParamValueType.Integer)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PInt((int)currentValues[i]));
         }
         else if (valueType == ParamValueType.String)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PString((string)currentValues[i]));
         }
         else if (valueType == ParamValueType.Number)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PDouble((double)currentValues[i]));
         }
         else if (valueType == ParamValueType.QueryData)
         {
             outputValue += Regex.Replace(snippet, @"\?", POut.PString((string)currentValues[i]));
         }
     }
     outputValue += ")";
     //MessageBox.Show(outputValue);
 }