コード例 #1
0
 public PgActionM(PgDataRepositoryVM source, int id, string name, string visible_name, bool table_data, bool operation)
 {
     _source       = source;
     _id           = id;
     _name         = name;
     _name_visible = visible_name;
     _operation    = operation;
     _table_data   = table_data;
 }
コード例 #2
0
        public PgSearchTableM(PgDataRepositoryVM source, int idtable)
        {
            _source = source;
            var tableList = from PgTableBaseM table in source.Tables where table.Id == idtable select table;

            if (tableList.Count() == 1)
            {
                _table = tableList.ElementAt(0);
            }
        }
コード例 #3
0
        public PgAttributesVM(AbsM.ITableBaseM table, object idObject, bool isReadOnly = false, bool isDebug = false, String wkt = null)
        {
            var pgTable = table as PgM.PgTableBaseM;

            if (pgTable == null)
            {
                throw new ArgumentNullException("Нет ссылки на таблицу");
            }
            else if (pgTable.PrimaryKeyField == null)
            {
                throw new ArgumentNullException("В таблице нет первичного ключа");
            }

            _isDebug = isDebug;
            _connect = ((PgVM.PgDataRepositoryVM)pgTable.Source).Connect;
            _table   = pgTable;
            _source  = pgTable.Source as PgVM.PgDataRepositoryVM;

            // Проверка прав на объект с атрибутами
            if (isReadOnly || pgTable.IsReadOnly || !pgTable.CanWrite)
            {
                _isReadOnly = true;
            }

            _attributesListVM = new PgAtVM.PgAttributesListVM(this, idObject);
            if (_table.FileInfo != null)
            {
                _filesVM = new PgAtVM.PgAttributeFilesVM(this);
            }
            if (_table.IsMapStyle && idObject != null)
            {
                _styleVM = new PgAttributesStyleVM(this);
            }
            if (_table.Type == AbsM.ETableType.MapLayer || _table.Type == AbsM.ETableType.View)
            {
                //_pgGeometryVM = new PgAttributesGeomVM(this, wkt);
                _pgGeometryVM = new PgAttributesGeomVM(_table.Id, wkt, false, (int?)_attributesListVM.PkAttribute.Value, (_table.Source as PgVM.PgDataRepositoryVM).Connect);
            }
            Title = String.Format("Объект: [id: {0}]; Таблица: \"{1}\"; Источник: \"{3}@{4}:{5} ({6})\"; Тип: \"{2}\"",
                                  idObject ?? "null",
                                  _table.Text,
                                  _table.Source.Type,
                                  _source.Connect.Database,
                                  _source.Connect.Host,
                                  _source.Connect.Port,
                                  _source.CurrentUser.NameFull);
        }
コード例 #4
0
        /// <summary>
        /// ViewModel для окна списка объектов
        /// </summary>
        /// <param name="table">Таблица с объектами</param>
        /// <param name="filter">Фильтр который нужно применить для данного окна</param>
        /// <param name="id">Перейти к нужному объекту</param>
        /// <param name="toSelected"> Открыть окно для выбора объекта</param>
        /// <param name="isDebug"> Debug режим </param>
        public PgTableViewVM(AbsM.ITableBaseM table, FilterRelationModel filter = null, object id = null, bool toSelected = false, bool isDebug = false)
        {
            var pgTable = table as PgM.PgTableBaseM;

            if (pgTable == null)
            {
                throw new ArgumentNullException("table");
            }
            _table      = pgTable;
            _isReadOnly = _table.IsReadOnly;
            _source     = pgTable.Source as PgVM.PgDataRepositoryVM;
            _connect    = Source.Connect;
            _sysScheme  = "sys_scheme";
            _isDebug    = isDebug;
            Title       = String.Format("Таблица: \"{0}\"; Источник: \"{2}@{3}:{4} ({5})\"; Тип: \"{1}\"",
                                        pgTable.Text,
                                        _source.Type,
                                        _source.Connect.Database,
                                        _source.Connect.Host,
                                        _source.Connect.Port,
                                        _source.CurrentUser.NameFull);

            _columns  = new ObservableCollection <HeaderValue>();
            sqlSelect = GetSQL();

            _filterVM = new PgTableView.PgTableViewFilterVM(this, filter);

            if (id != null)
            {
                int?page = GetPageInTable(id);
                if (page != null)
                {
                    PageCurrent = page;
                }
            }
            GetColumns();
            Reload();
            if (id != null)
            {
                CurrentRowView = GetRow(id);
            }
            _toSelected = toSelected;

            _source.EventUpdateAttribute += _source_EventUpdateAttribute;
            this.PropertyChanged         += PgTableViewVM_PropertyChanged;
        }
コード例 #5
0
 public PgFullTextSearchVM(PgDataRepositoryVM source)
 {
     Title   = Properties.Resources.PgFullSearch_Title;
     _source = source;
     FillTables();
 }
コード例 #6
0
 public PgActionRightM(PgUserM user, PgDataRepositoryVM source)
 {
     User    = user;
     _source = source;
 }
コード例 #7
0
 public PgSearchTableM(PgTableBaseM pgTable)
 {
     _source = pgTable.Source as PgDataRepositoryVM;
     _table  = pgTable;
 }