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); }
public PgAttributeM(PgAtM.IPgAttributesVM source, PgM.PgFieldM field, object value = null) { if (source == null) { throw new ArgumentNullException("source"); } if (field == null) { throw new ArgumentNullException("field"); } _source = source; _field = field; _value = value; if ((Field as PgM.PgFieldM).RefTable != null) { _variants = new ObservableCollection <PgAttributeVariantM>(); } }