コード例 #1
0
 public int CompareTo(object obj)
 {
     if (obj is ComputedColumn)
     {
         ComputedColumn sc2 = (ComputedColumn)obj;
         return(Name.CompareTo(sc2.Name));
     }
     else
     {
         throw new ArgumentException("Object is not a ComputedColumn");
     }
 }
コード例 #2
0
        private void AddCompCol_Click(object sender, RoutedEventArgs e)
        {
            ComputedColumn computedCol = new ComputedColumn();
            if (ComputedColExpTxtBox.Text != "")
            {
                computedCol.Name = ComputedColExpTxtBox.Text;
            }
            else
            {
                string functionName = ComputedColFunctionComboBox.SelectedItem.ToString();
                Function function = Functions.getFunction(functionName);
                List<Parameter> paramList = new List<Parameter>();

                int paramIndex = 0;
                foreach (Parameter param in function.Parameters)
                {
                    paramIndex++;
                    string value = getParamSelectedValue(paramIndex);
                    Parameter parameter = new Parameter(param.Name, value, param.Type);
                    paramList.Add(parameter);
                }
                computedCol.Parameters = paramList;

                computedCol.Name = functionName;
                computedCol.Type = ComputedColumn.FUNCTION;

                if (functionName == "CASE")
                {
                    for (int i = 1; i < Convert.ToInt32(totalCaseCondition); i++)
                    {
                        Label lblWhen = (Label)this.FindName("lblWhen" + Convert.ToString(i));
                        TextBox txtWhen = (TextBox)this.FindName("txtWhen" + Convert.ToString(i));

                        Label lblThen = (Label)this.FindName("lblThen" + Convert.ToString(i));
                        TextBox txtThen = (TextBox)this.FindName("txtThen" + Convert.ToString(i));

                        computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + lblWhen.Content.ToString();
                        computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + txtWhen.Text.ToString();

                        computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + lblThen.Content.ToString();
                        computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + txtThen.Text.ToString();
                    }
                    Label lblElse = (Label)this.FindName("lblElse");
                    TextBox txtElse = (TextBox)this.FindName("txtElse");

                    computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + lblElse.Content.ToString();
                    computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + txtElse.Text.ToString();

                    computedCol.Parameters[0].Value = computedCol.Parameters[0].Value + " " + "END)";
                }
                
                if (functionName == "IFNULL")
                {
                    computedCol.Parameters[1].Value = ComputedColifnullTxtBox.Text;
                }
                else
                {
                    computedCol.Parameters = paramList;
                }
            }
            computedCol.AliasName = ComputedColNameTxtBox.Text;
            if (ComputedColFormatComboBox.SelectedValue.ToString() != "Select One")
                computedCol.Format = ComputedColFormatComboBox.SelectedValue.ToString();

            if (computedCol != null)
            {
                if (computedCol.Name != System.String.Empty & computedCol.AliasName != System.String.Empty)
                {
                    IEnumerable<Column> columnsWithSameAlias = _SelectedColCollection.Where(x => x.AliasName == computedCol.AliasName);
                    if (columnsWithSameAlias.Count() == 0)
                    {
                        IEnumerable<Column> columns = _SelectedColCollection.Where(x => x.Name == computedCol.Name & x.AliasName == computedCol.AliasName);
                        if (columns.Count() == 0)
                        {
                            _SelectedColCollection.Add(computedCol);
                            ComputedColNameTxtBox.Text = "";
                            ComputedColExpTxtBox.Text = "";
                            ComputedColFormatComboBox.Text = "Select One";
                        }
                        else
                        {
                            System.Media.SystemSounds.Beep.Play();
                        }
                    }
                    else
                    {
                        System.Media.SystemSounds.Beep.Play();
                    }
                }
            }

            if (_SelectedColCollection.Count > 11 && isExpanded == false)
            {
                SelectedColsStackPanel.Width += 16;
                isExpanded = true;
            }
            ComputedColName1.Visibility = System.Windows.Visibility.Hidden;
            ComputedColName2.Visibility = System.Windows.Visibility.Hidden;
            ComputedColName3.Visibility = System.Windows.Visibility.Hidden;
            ComputedColName4.Visibility = System.Windows.Visibility.Hidden;
            ComputedColComboBox1.Visibility = System.Windows.Visibility.Hidden;
            ComputedColComboBox2.Visibility = System.Windows.Visibility.Hidden;
            ComputedColComboBox3.Visibility = System.Windows.Visibility.Hidden;
            ComputedColComboBox4.Visibility = System.Windows.Visibility.Hidden;
            ComputedColifnullTxtBox.Visibility = System.Windows.Visibility.Hidden;
            ComputedColComboBox1.Text = "";
            ComputedColComboBox2.Text = "";
            ComputedColComboBox3.Text = "";
            ComputedColComboBox4.Text = "";
            this.ComputedColFunctionComboBox.ItemsSource = Functions.getFunctionNames();
            this.ComputedColFunctionComboBox.SelectedIndex = -1;
            AddCaseCondition.Visibility = System.Windows.Visibility.Hidden;
            RemoveCaseCondition.Visibility = System.Windows.Visibility.Hidden;

        }
コード例 #3
0
ファイル: ComputedColumn.cs プロジェクト: mukeshdepani/ParaRD
        public bool Equals(ComputedColumn other)
        {

            return Name.Equals(other.Name);

        }
コード例 #4
0
 public bool Equals(ComputedColumn other)
 {
     return(Name.Equals(other.Name));
 }