private void RemoveAllBtn_Click(object sender, RoutedEventArgs e) { _SelectedColCollection.Clear(); if (_SelectedColCollection.Count <= 11 && isExpanded == true) { SelectedColsStackPanel.Width -= 16; isExpanded = false; } /***********Validate Control***********/ Validate(); /**************************************/ /*****Update Cross Tabulation and Tabulation**********/ MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); if (parent != null) { ResultViewControl rvc = (ResultViewControl)parent; rvc.UpdateCrossTabulationTabCntrl(mainWindow); rvc.UpdateTabulationTabCntrl(mainWindow); } /**************************************/ }
private void lstSelectedCol_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var col = ((FrameworkElement)e.OriginalSource).DataContext as Column; if (col != null) { _SelectedColCollection.Remove(col); } if (_SelectedColCollection.Count <= 11 && isExpanded == true) { SelectedColsStackPanel.Width -= 16; isExpanded = false; } /***********Validate Control***********/ Validate(); /**************************************/ /*****Update Cross Tabulation**********/ MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); if (parent != null) { ResultViewControl rvc = (ResultViewControl)parent; rvc.UpdateCrossTabulationTabCntrl(mainWindow); rvc.UpdateTabulationTabCntrl(mainWindow); } /**************************************/ }
private void lstToSelecteColFrom_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var col = ((FrameworkElement)e.OriginalSource).DataContext as Column; if (col != null) { IEnumerable <Column> columns = _SelectedColCollection.Where(x => x.Name == col.Name && x.AliasName == col.AliasName); if (columns.Count() == 0) { IEnumerable <Column> columnsWithSameAlias = _SelectedColCollection.Where(x => x.AliasName == col.AliasName); if (columnsWithSameAlias.Count() == 0) { _SelectedColCollection.Add(col); } else { MessageBox.Show("Duplicate Alias"); } } else { MessageBox.Show("Duplicate Column"); } this.lstToSelecteColFrom.SelectedIndex = -1; } if (_SelectedColCollection.Count > 11 && isExpanded == false) { SelectedColsStackPanel.Width += 16; isExpanded = true; } /***********Validate Control***********/ Validate(); /**************************************/ /*****Update Cross Tabulation**********/ MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); if (parent != null) { ResultViewControl rvc = (ResultViewControl)parent; rvc.UpdateCrossTabulationTabCntrl(mainWindow); rvc.UpdateTabulationTabCntrl(mainWindow); } }
private void btnRemove_Click(object sender, RoutedEventArgs e) { if (this._SelectedColCollection.Count == 0) { this.lblErrorMessage.Content = "Please select column(s)"; } int count = this.lstSelectedCol.SelectedItems.Count; for (int i = 0; i < count; i++) { Column col = (Column)this.lstSelectedCol.SelectedItems[0]; _SelectedColCollection.Remove(col); } this.lstToSelecteColFrom.SelectedIndex = -1; this.lstSelectedCol.SelectedIndex = -1; if (_SelectedColCollection.Count <= 11 && isExpanded == true) { SelectedColsStackPanel.Width -= 16; isExpanded = false; } /***********Validate Control***********/ Validate(); /**************************************/ /*****Update Cross Tabulation**********/ MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); if (parent != null) { ResultViewControl rvc = (ResultViewControl)parent; rvc.UpdateCrossTabulationTabCntrl(mainWindow); rvc.UpdateTabulationTabCntrl(mainWindow); } /**************************************/ }
private void btnAdd_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < this.lstToSelecteColFrom.SelectedItems.Count; i++) { Column col = (Column)this.lstToSelecteColFrom.SelectedItems[i]; //check if alias already exist IEnumerable <Column> columnsWithSameAlias = _SelectedColCollection.Where(x => x.AliasName == col.AliasName); if (columnsWithSameAlias.Count() == 0) { //check if column alreadyexist IEnumerable <Column> columns = _SelectedColCollection.Where(x => x.Name == col.Name & x.AliasName == col.AliasName); if (columns.Count() == 0) { _SelectedColCollection.Add(col); } else { System.Media.SystemSounds.Beep.Play(); } } else { System.Media.SystemSounds.Beep.Play(); } } if (this.lstToSelecteColFrom.SelectedIndex == -1) { Column computedCol = new Column(); computedCol.Name = ComputedColExpTxtBox.Text; computedCol.AliasName = ""; if (ComputedColFormatComboBox.SelectedValue.ToString() != "Select One") { computedCol.Format = ComputedColFormatComboBox.SelectedValue.ToString(); } else { computedCol.Format = "NO"; } 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); } else { System.Media.SystemSounds.Beep.Play(); } } else { System.Media.SystemSounds.Beep.Play(); } } } } if (_SelectedColCollection.Count > 11 && isExpanded == false) { SelectedColsStackPanel.Width += 16; isExpanded = true; } this.lstToSelecteColFrom.SelectedIndex = -1; this.lstSelectedCol.SelectedIndex = -1; if (this._SelectedColCollection.Count > 0) { this.lblErrorMessage.Content = ""; } /***********Validate Control***********/ Validate(); /**************************************/ /************Update query**************/ //UpdateXmlQuery(); /**************************************/ /*****Update Cross Tabulation**********/ MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); if (parent != null) { ResultViewControl rvc = (ResultViewControl)parent; rvc.UpdateCrossTabulationTabCntrl(mainWindow); rvc.UpdateTabulationTabCntrl(mainWindow); } /**************************************/ /*****************To Enable Save***********/ //FromTabStackPanelControl fromTabStackPanelCntrl = new FromTabStackPanelControl(); //DependencyObject parent = fromTabStackPanelCntrl.GetRVC(this.lstSelectedCol); //if (parent != null) //{ // ResultViewControl rvc = (ResultViewControl)parent; // string directoryPath = rvc.result.directoryPath; // //MainWindow mainWindow = (MainWindow)GetTopLevelControl(this.lstSelectedCol); // //SelectQueryBuilder queryBuilder = mainWindow.LoadSelectQueryBuilderNew(rvc); // //MainGirdViewControl mainGridView1 = new MainGirdViewControl(queryBuilder, mainWindow.CurrentDatabaseName); // //rvc.result = mainGridView1.result; // rvc.result.isModified = true; // rvc.result.isNew = false; // rvc.result.directoryPath = directoryPath; //} /********************************************/ }