public WindowSecondary(Session session, PivotGridControlModified control = null, bool isWhRestExistsCheckErrorDoc = false) { InitializeComponent(); #region Initialize _session = session; _closeWithoutCheck = false; ThemeManager.SetThemeName(this, "DeepBlue"); WindowState = WindowState.Maximized; _session.GetDocument().DocProjected += DbDocProjected; // ??? Closing += WindowSecondaryClosing; _pivotGridControl2.CellClickAction += PivotGridControl2CellClickModified; Title = _session.GetTitle(); #endregion #region Initialize PivotGrid Control _pivotGridControl2.DataSource = _session.GetTableData(Table.TableSecSource); _pivotGridControl2.HiddenFieldList += PivotGridControl2HiddenFieldList; _pivotGridControl2.FieldFilterChanged += _pivotGridControl2FieldFilterChanged; List<Column> columns; try { columns = _session.GetTableColumns(Table.TableSecSource); } catch (AssortmentException ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; } _pivotGridControl2.InitializeControl(columns, FormTypes.Secondary); if (isWhRestExistsCheckErrorDoc) { _pivotGridControl2.Fields["LOC"].Area = FieldArea.ColumnArea; _pivotGridControl2.Fields["LOC"].Visible = true; _pivotGridControl2.Fields["ITEM"].Area = FieldArea.RowArea; _pivotGridControl2.Fields["ITEM"].Visible = true; _pivotGridControl2.Fields["MEASURE_STATUS_NEW"].Area = FieldArea.DataArea; _pivotGridControl2.Fields["MEASURE_STATUS_NEW"].Visible = true; _pivotGridControl2.SetFiltersForWhRestExistsCheckErrorDoc(); } if (control == null) _pivotGridControl2.SetLayout(_session.GetDocument().PivotLayout); else _pivotGridControl2.CopyLayout(control); _pivotGridControl2.ShowRowTotals = false; _pivotGridControl2.ShowColumnTotals = false; #endregion }
public WindowCheck(Session session, CheckTypes checkType) { InitializeComponent(); #region Initialize _session = session; _db = session.GetDbManager(); _checkType = checkType; listBoxCheck.MouseDoubleClick += ListBoxCheckMouseDoubleClick; listBoxCheck.SelectionChanged += ListBoxCheckSelectionChanged; buttonCancel.Click += ButtonCancelClick; buttonSubmit.Click += ButtonSubmitClick; _session.GetDocument().DocProjected += DbDocProjected; _checkList = new List<Check>(); try { _checkList.AddRange(_session.GetDocument().GetCheckList(_checkType)); } catch (AssortmentDBException e) { MessageBox.Show(e.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning); } listBoxCheck.ItemsSource = _checkList; #endregion #region Initialize Background Worker _worker = new BackgroundWorker(); _worker.DoWork += WorkerDoWork; _worker.RunWorkerCompleted += WorkerRunWorkerCompleted; _worker.ProgressChanged += WorkerProgressChanged; #endregion if (_checkList.Count == 0) return; _checkList[0].Status = CheckStatuses.Executing; _nCheck = 0; if (!_worker.IsBusy) _worker.RunWorkerAsync(); else { MessageBox.Show("Проверки уже запущены", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public WindowBase(Session session) { InitializeComponent(); #region Initialize _session = session; WindowState = WindowState.Maximized; //ThemeManager.SetThemeName(this, "Office2007Blue"); //ThemeManager.SetThemeName(this, "Office2007Black"); //ThemeManager.SetThemeName(this, "LightGray"); ThemeManager.SetThemeName(this, "DeepBlue"); _session.GetDocument().DocProjected += DbDocProjected; // ??? Closing += WindowBaseClosing; #endregion #region Initialize Background Worker _worker = new BackgroundWorker(); _worker.DoWork += WorkerDoWork; _worker.RunWorkerCompleted += WorkerRunWorkerCompleted; _worker.ProgressChanged += WorkerProgressChanged; #endregion #region Initialize PivotGrid Control _pivotGridControl1.DataSource = _session.GetTableData(Table.TableBaseSource); _pivotGridControl1.HiddenFieldList += PivotGridControl1HiddenFieldList; List<Column> columns; try { columns = _session.GetTableColumns(Table.TableSecSource); } catch (AssortmentException ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; } _pivotGridControl1.InitializeControl(columns, FormTypes.Base); _pivotGridControl1.Fields["LOC"].Area = FieldArea.ColumnArea; _pivotGridControl1.Fields["LOC"].Visible = true; _pivotGridControl1.Fields["ITEM"].Area = FieldArea.RowArea; _pivotGridControl1.Fields["ITEM"].Visible = true; _pivotGridControl1.Fields["MEASURE_STATUS_NEW"].Area = FieldArea.DataArea; _pivotGridControl1.Fields["MEASURE_STATUS_NEW"].Visible = true; _pivotGridControl1.ShowRowTotals = false; _pivotGridControl1.ShowColumnTotals = false; #endregion }
public WindowRowOriented(Session session, PivotGridControl pivotGridControl1) { InitializeComponent(); #region Initialize _session = session; _closeWithoutCheck = false; _db = _session.GetDbManager(); _doc = _session.GetDocument(); //ThemeManager.SetThemeName(this, "Office2007Silver"); ThemeManager.SetThemeName(this, "DeepBlue"); WindowState = WindowState.Maximized; Closing += WindowSecondaryClosing; _doc.DocProjected += DbDocProjected; var desc = _doc.Description; Title = "Документ: " + (desc ?? "не создан") + " (" + _doc.Id + ", " + DocTypes.Description(_doc.DocType) + ")"; //Title = "Документ: " + (desc.Equals("") ? "не создан" : desc) + " (" + _doc.Id + ", " + (_doc.DocType == DocTypes.Operative ? "Оперативный" : "Обычный") + ")"; try { _db.FillDataTableCustom(Table.TableSupplier.Name, Table.TableSupplier.SelectClause, Table.TableSupplier.KeyFields, false); } catch (AssortmentException ex) { MessageBox.Show(Table.TableSupplier + ": " + ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; } /* if (_db.FillDataTableCustom(Table.TableSupplier.Name, Table.TableSupplier.SelectClause, Table.TableSupplier.KeyFields, false) == false) { MessageBox.Show("Ошибка при формировании источника: " + _db.Error, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } */ #endregion #region Initialize PivotGrid Control try { _db.FillDataTableCustom(Table.TableRowSource); } catch (AssortmentException ex) { MessageBox.Show(Table.TableRowSource + ": " + ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; } /* if (_db.FillDataTableCustom(Table.TableRowSource) == false) { MessageBox.Show("Ошибка при формировании источника: " + _db.Error, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } */ _pivotGridControl2.DataSource = _db.DataTableGet(Table.TableRowSource.Name).DefaultView; _pivotGridControl2.HiddenFieldList += PivotGridControl2HiddenFieldList; var dimensions = _db.GetTableDefinition(Table.TableRowSource.DBName); if (dimensions == null) { MessageBox.Show("Список измерений для данной таблицы пуст", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } else { _pivotGridControl2.InitializeControl(dimensions, _db); } _pivotGridControl2.InitializeLayout(pivotGridControl1); _pivotGridControl2.ShowRowTotals = false; _pivotGridControl2.ShowColumnTotals = false; _pivotGridControl2.ShowColumnGrandTotals = false; _pivotGridControl2.ShowRowGrandTotals = false; _pivotGridControl2.CellClickInputData += PivotGridControl2CellClickInputData; _pivotGridControl2.BestFit(); #endregion }