コード例 #1
0
        public DatabaseObjectsUsingAttributesHelper(DatabaseObjects objDatabaseObjects)
        {
            if (objDatabaseObjects == null)
                throw new ArgumentNullException();

            pobjDatabaseObjects = objDatabaseObjects;

            object[] objAttributes = objDatabaseObjects.GetType().GetCustomAttributes(true);

            if (objAttributes != null)
            {
                foreach (Attribute objAttribute in objAttributes)
                {
                    if (objAttribute is DistinctFieldAttribute)
                        pobjDistinctField = (DistinctFieldAttribute) objAttribute;
                    else if (objAttribute is KeyFieldAttribute)
                        pobjKeyField = (KeyFieldAttribute) objAttribute;
                    else if (objAttribute is OrderByFieldAttribute)
                        pobjOrderByAttributes.Add((OrderByFieldAttribute) objAttribute);
                    else if (objAttribute is SubsetAttribute)
                        pobjSubset = (SubsetAttribute) objAttribute;
                    else if (objAttribute is TableAttribute)
                        pobjTable = (TableAttribute) objAttribute;
                    else if (objAttribute is TableJoinAttribute)
                        pobjTableJoins.Add((TableJoinAttribute) objAttribute);
                    else if (objAttribute is ItemInstanceAttribute)
                        pobjItemInstance = (ItemInstanceAttribute) objAttribute;
                }
            }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _intId  = Convert.ToInt32(Request.QueryString["id"]);
     _strSite = string.Empty;
     try
     {
         //_intId = 146; //here is the hard code value and it will be replace by querystring
         if (!Page.IsPostBack)
         {
             //It calls the Single Ton Connection
             _clsData = new DatabaseObjects();
             //fills the data in the dropdown
             FillData(_clsData, drpStatus, _spGetImportStatus);
             FillData(_clsData, drpServerType, _spGetImportServerType);
             FillData(_clsData, drpEnv, _spGetImportEnv);
             //fill the existing data in the page
             _dsAgRecords = ExistingRecords(_dsAgRecords);
             txtComment.Text = _strComment;
             calander.Value = _strDate;
         }
     }
     catch (Exception exp)
     {
         _strError = "Error : " + exp.Message;
     }
     //Response.End();
 }
コード例 #3
0
        public static void ConstructTableObjectFromPostRequest(JSONTable jt, ref BaseTable bt, ref int pageIndex, ref int pageSize, ref int totalRows,
                                                               ref SqlFilter whereFilter, ref BaseFilter join, ref OrderBy orderBy)
        {
            pageIndex = jt.PageIndex;
            pageSize  = jt.PageSize;
            totalRows = jt.TotalRows;

            bt = (BaseTable)DatabaseObjects.GetTableObject(jt.TableName);

            ColumnList selCols = new ColumnList();

            foreach (JTableSelectColumn col in jt.JSelectColumns)
            {
                selCols.Add(bt.TableDefinition.ColumnList.GetByCodeName(col.ColumnName), true);
            }

            bt.SelectedColumns.Clear();
            bt.SelectedColumns.AddRange(selCols);

            if ((jt.JOrderByList != null))
            {
                foreach (JOrderBy jOrderBy in jt.JOrderByList)
                {
                    orderBy = new OrderBy(true, false);
                    orderBy.Add(bt.TableDefinition.ColumnList.GetByCodeName(jOrderBy.ColumnName), OrderByItem.ToOrderDir(jOrderBy.OrderDirection));
                }
            }

            if (jt.JWhereClause != null && jt.JWhereClause.Trim() != "")
            {
                whereFilter = new SqlFilter(jt.JWhereClause);
            }
        }
コード例 #4
0
        private void ExecuteFilter()
        {
            lock (gawd)
            {
                IEnumerable <DBObjectViewModel> filteredList;
                if (string.IsNullOrWhiteSpace(ResultsFilter))
                {
                    // if there's no filter, just use the plain ol' list
                    filteredList = actualList;
                }
                else
                {
                    var pred = DBObjectSearch.BuildPredicateFromSearchText(ResultsFilter);

                    filteredList = from item in actualList
                                   where pred.Invoke(item)
                                   select item;
                }
                foreach (var found in filteredList)
                {
                    DatabaseObjects.Add(found);
                }
                Execute.OnUIThread(() =>
                {
                    DatabaseObjects.Clear();
                    DatabaseObjects.AddRange(filteredList);
                });
            }
        }
コード例 #5
0
        /// <summary>
        /// </summary>
        /// <param name="itemInstanceTypeToCreate">The type of DatabaseObjects.DatabaseObject to create.</param>
        /// <param name="databaseObjects">Parameter that is passed to the constructor of the DatabaseObject to create. If there is a default constructor then this argument is not used.</param>
        public static IDatabaseObject CreateItemInstance(Type itemInstanceTypeToCreate, DatabaseObjects databaseObjects)
        {
            object objObjectInstance = null;

            foreach (ConstructorInfo objConstructor in itemInstanceTypeToCreate.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
            {
                ParameterInfo[] objConstructorParameters = objConstructor.GetParameters();
                if (objConstructorParameters.Length == 0)
                {
                    objObjectInstance = objConstructor.Invoke(null);
                    break;
                }
                else if (objConstructorParameters.Length == 1 && (objConstructorParameters[0].ParameterType.IsSubclassOf(typeof(DatabaseObjects)) || objConstructorParameters[0].ParameterType.Equals(typeof(DatabaseObjects))))
                {
                    objObjectInstance = objConstructor.Invoke(new[] {databaseObjects});
                    break;
                }
            }

            if (objObjectInstance == null)
                throw new Exceptions.DatabaseObjectsException("An empty constructor or constructor with argument DatabaseObjects.DatabaseObjects (or subclass) could not be found for type '" + itemInstanceTypeToCreate.FullName + "'. This type has been specified by the ItemInstanceAttribute for the type '" + databaseObjects.GetType().FullName + "' or as the T argument.");
            else if (!(objObjectInstance is IDatabaseObject))
                throw new Exceptions.DatabaseObjectsException("'" + itemInstanceTypeToCreate.FullName + "' does not implement IDatabaseObject or inherit from DatabaseObject. Type was specified for use by the ItemInstanceAttribute on the type '" + databaseObjects.GetType().FullName + "'");
            else
                return (IDatabaseObject)objObjectInstance;
        }
コード例 #6
0
        public static void ConstructRecordObjectFromPostSaveRequest(JSONRecord jr, ref PrimaryKeyRecord rec)
        {
            PrimaryKeyTable t = (PrimaryKeyTable)DatabaseObjects.GetTableObject(jr.TableName);

            t.ResetSelectedColumns();

            rec = new PrimaryKeyRecord(t);
            rec.IsExistsInDatabase = jr.IsExistsInDatabase;

            if ((jr.JRecordValues != null))
            {
                foreach (JRecordValue jRecordValue in jr.JRecordValues)
                {
                    BaseColumn bc = t.TableDefinition.ColumnList.GetByCodeName(jRecordValue.ColumnName);
                    if (!bc.IsValuesReadOnly)
                    {
                        rec.Parse(jRecordValue.ColumnValue, bc);
                    }
                    else if (t.TableDefinition.IsPrimaryKeyElement(bc))
                    {
                        KeyValue kv = new KeyValue();
                        kv.AddElement(jRecordValue.ColumnName, jRecordValue.ColumnValue.ToString());
                        rec.PrimaryKeyValue = kv;
                    }
                }
            }
        }
コード例 #7
0
        /// --------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new DatabaseObject with the parent collection that this object is
        /// associated with and the lock controller to be used with this object.
        /// </summary>
        /// --------------------------------------------------------------------------------
        protected DatabaseObjectLockable(DatabaseObjects objParent, DatabaseObjectLockController objLockController)
            : base(objParent)
        {
            if (objLockController == null)
                throw new ArgumentNullException();

            pobjLockController = objLockController;
        }
コード例 #8
0
        /// <summary>
        /// This method takes a keyValue and a Column and returns an evaluated value of DFKA formula.
        /// </summary>
        public static string GetDFKA(String keyValue, BaseColumn col, String formatPattern)
        {
            if (keyValue == null)
            {
                return(null);
            }
            ForeignKey fkColumn = AreasTable.Instance.TableDefinition.GetExpandableNonCompositeForeignKey(col);

            if (fkColumn == null)
            {
                return(null);
            }
            String _DFKA = fkColumn.PrimaryKeyDisplayColumns;

            if (_DFKA.Trim().StartsWith("="))
            {
                String          tableName = fkColumn.PrimaryKeyTableDefinition.TableCodeName;
                PrimaryKeyTable t         = (PrimaryKeyTable)DatabaseObjects.GetTableObject(tableName);
                BaseRecord      rec       = null;

                if (t != null)
                {
                    try
                    {
                        rec = (BaseRecord)t.GetRecordData(keyValue, false);
                    }
                    catch
                    {
                        rec = null;
                    }
                }
                if (rec == null)
                {
                    return("");
                }

                // if the formula is in the format of "= <Primary table>.<Field name>, then pull out the data from the rec object instead of doing formula evaluation
                string tableCodeName = fkColumn.PrimaryKeyTableDefinition.TableCodeName;
                string column        = _DFKA.Trim('=').Trim();
                if (column.StartsWith(tableCodeName + ".", StringComparison.InvariantCultureIgnoreCase))
                {
                    column = column.Substring(tableCodeName.Length + 1);
                }

                foreach (BaseColumn c in fkColumn.PrimaryKeyTableDefinition.Columns)
                {
                    if (column == c.CodeName)
                    {
                        return(rec.Format(c));
                    }
                }
                return(EvaluateFormula(_DFKA, rec, null, tableName));
            }
            else
            {
                return(null);
            }
        }
コード例 #9
0
 public ViewColumnInfoExtractUICollection(ColumnInfo c, ViewType viewType, IFilter filter = null) : this()
 {
     DatabaseObjects.Add(c);
     if (filter != null)
     {
         DatabaseObjects.Add(filter);
     }
     ViewType = viewType;
 }
コード例 #10
0
 public ViewColumnExtractCollection(ExtractionInformation ei, ViewType viewType, IContainer container) : this()
 {
     DatabaseObjects.Add(ei);
     if (container != null)
     {
         DatabaseObjects.Add(container);
     }
     ViewType = viewType;
 }
コード例 #11
0
 public ViewColumnExtractCollection(ExtractionInformation ei, ViewType viewType, IFilter filter = null) : this()
 {
     DatabaseObjects.Add(ei);
     if (filter != null)
     {
         DatabaseObjects.Add(filter);
     }
     ViewType = viewType;
 }
コード例 #12
0
        public override void GetDatabaseObjects()
        {
            DatabaseObjectsFactory <Destination> factory = new DatabaseObjectsFactory <Destination>();
            string collectionName = CollectionsNames.DestinationsCollection;
            DatabaseObjects <Destination> objects = factory.GetDatabaseObjects(collectionName);

            collection = objects.Collection;
            database   = objects.Database;
        }
コード例 #13
0
        public override void GetDatabaseObjects()
        {
            DatabaseObjectsFactory <Arrangement> factory = new DatabaseObjectsFactory <Arrangement>();
            string collectionName = CollectionsNames.ArrangementsCollection;
            DatabaseObjects <Arrangement> objects = factory.GetDatabaseObjects(collectionName);

            collection = objects.Collection;
            database   = objects.Database;
        }
コード例 #14
0
        public override void GetDatabaseObjects()
        {
            DatabaseObjectsFactory <Hotel> factory = new DatabaseObjectsFactory <Hotel>();
            string collectionName           = CollectionsNames.HotelsCollection;
            DatabaseObjects <Hotel> objects = factory.GetDatabaseObjects(collectionName);

            collection = objects.Collection;
            database   = objects.Database;
        }
コード例 #15
0
 public FilterGraphObjectCollection(AggregateConfiguration graph, ConcreteFilter filter) : this()
 {
     if (graph.IsCohortIdentificationAggregate)
     {
         throw new ArgumentException("Graph '" + graph + "' is a Cohort Identification Aggregate, this is not allowed.  Aggregat must be a graph aggregate");
     }
     DatabaseObjects.Add(graph);
     DatabaseObjects.Add(filter);
 }
コード例 #16
0
        public override void GetDatabaseObjects()
        {
            DatabaseObjectsFactory <Customer> factory = new DatabaseObjectsFactory <Customer>();
            string collectionName = CollectionsNames.CustomersCollection;
            DatabaseObjects <Customer> objects = factory.GetDatabaseObjects(collectionName);

            collection = objects.Collection;
            database   = objects.Database;
        }
コード例 #17
0
        public void RemoveCatalogue(Catalogue catalogue)
        {
            if (catalogue == null)
            {
                throw new ArgumentException("Catalogue must not be null", "catalogue");
            }

            DatabaseObjects.Remove(catalogue);
        }
コード例 #18
0
        public void SetSingleCatalogueMode(Catalogue catalogue)
        {
            if (catalogue == null)
            {
                throw new ArgumentException("Catalogue must not be null to turn on SingleCatalogue mode", "catalogue");
            }

            DatabaseObjects.Clear();
            DatabaseObjects.Add(catalogue);
        }
コード例 #19
0
        public ViewTableInfoExtractUICollection(ITableInfo t, ViewType viewType, IFilter filter = null)
            : this()
        {
            DatabaseObjects.Add(t);

            if (filter != null)
            {
                DatabaseObjects.Add(filter);
            }
            ViewType = viewType;
        }
コード例 #20
0
 public BaseClasses.Data.BaseTable GetTable()
 {
     try
     {
         return(DatabaseObjects.GetTableObject(this.TableName));
     }
     catch (System.Exception)
     {
         return(DatabaseObjects.GetTableObject(this.TableName));
     }
 }
コード例 #21
0
        /// <summary>
        /// Overload that does the operation on a container with (WhereExtractionIdentifiersIn - the only permissable option)
        /// </summary>
        /// <param name="container"></param>
        /// <param name="graph"></param>
        public CohortSummaryAggregateGraphObjectCollection(CohortAggregateContainer container, AggregateConfiguration graph)
            : this()
        {
            if (graph.IsCohortIdentificationAggregate)
            {
                throw new ArgumentException("Parameter graph was AggregateConfiguration '" + graph + "' which is a Cohort Aggregate (not allowed)", "graph");
            }

            DatabaseObjects.Add(container);
            DatabaseObjects.Add(graph);
            Adjustment = CohortSummaryAdjustment.WhereExtractionIdentifiersIn;
        }
コード例 #22
0
        public static void ConstructRecordObjectFromPostDeleteRequest(JSONRecord jr, ref PrimaryKeyTable pk, ref List <KeyValue> kvList)
        {
            pk = (PrimaryKeyTable)DatabaseObjects.GetTableObject(jr.TableName);

            if ((jr.JRecordValues != null))
            {
                foreach (JRecordValue jRecordValue in jr.JRecordValues)
                {
                    KeyValue kv = new KeyValue();
                    kv.AddElement(jRecordValue.ColumnName, jRecordValue.ColumnValue.ToString());
                    kvList.Add(kv);
                }
            }
        }
コード例 #23
0
        /// <summary>
        /// Use this constructor at runtime
        /// </summary>
        /// <param name="cohort"></param>
        /// <param name="graph"></param>
        /// <param name="adjustment"></param>
        public CohortSummaryAggregateGraphObjectCollection(AggregateConfiguration cohort, AggregateConfiguration graph, CohortSummaryAdjustment adjustment) : this()
        {
            if (!cohort.IsCohortIdentificationAggregate)
            {
                throw new ArgumentException("Parameter cohort was AggregateConfiguration '" + cohort + "' which is not a Cohort Aggregate (not allowed)", "cohort");
            }
            if (graph.IsCohortIdentificationAggregate)
            {
                throw new ArgumentException("Parameter graph was AggregateConfiguration '" + graph + "' which is a Cohort Aggregate (not allowed)", "graph");
            }

            DatabaseObjects.Add(cohort);
            DatabaseObjects.Add(graph);
            Adjustment = adjustment;
        }
コード例 #24
0
        public static SelectItem ConstructSelectItemFromPostRequest(JDataSourceSelectItem jsonSItem)
        {
            SelectItem sItem = null;

            if (!string.IsNullOrEmpty(jsonSItem.ColumnName) && !string.IsNullOrEmpty(jsonSItem.TableName))
            {
                BaseTable table = DatabaseObjects.GetTableObject(jsonSItem.TableName);
                sItem = new SelectItem(table.TableDefinition.ColumnList.GetByCodeName(jsonSItem.ColumnName), table, jsonSItem.Distinct, jsonSItem.AsClause, jsonSItem.TableAlias);
            }
            else if (!string.IsNullOrEmpty(jsonSItem.ItemType) && !string.IsNullOrEmpty(jsonSItem.TableName))
            {
                if (!string.IsNullOrEmpty(jsonSItem.AsClause))
                {
                    if (!string.IsNullOrEmpty(jsonSItem.TableAlias))
                    {
                        sItem = new SelectItem(BaseClasses.Data.SelectItem.ItemTypeDefinition.GetItemType(jsonSItem.ItemType), DatabaseObjects.GetTableObject(jsonSItem.TableName), jsonSItem.AsClause, jsonSItem.TableAlias);
                    }
                    else
                    {
                        sItem = new SelectItem(BaseClasses.Data.SelectItem.ItemTypeDefinition.GetItemType(jsonSItem.ItemType), DatabaseObjects.GetTableObject(jsonSItem.TableName), jsonSItem.AsClause);
                    }
                }
                else
                {
                    sItem = new SelectItem(BaseClasses.Data.SelectItem.ItemTypeDefinition.GetItemType(jsonSItem.ItemType), DatabaseObjects.GetTableObject(jsonSItem.TableName));
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(jsonSItem.Operation))
                {
                    if ((jsonSItem.LeftItem != null) && (jsonSItem.RightItem == null))
                    {
                        sItem = new SelectItem(jsonSItem.Operation, ConstructSelectItemFromPostRequest(jsonSItem.LeftItem), jsonSItem.AsClause);
                    }
                    else if ((jsonSItem.LeftItem != null) && (jsonSItem.RightItem != null))
                    {
                        sItem = new SelectItem(jsonSItem.Operation, ConstructSelectItemFromPostRequest(jsonSItem.LeftItem), ConstructSelectItemFromPostRequest(jsonSItem.RightItem), jsonSItem.AsClause);
                    }
                }
            }

            return(sItem);
        }
コード例 #25
0
        public void RevertIfMatchedInCollectionObjects(DatabaseEntity oTriggeringRefresh, out bool shouldClose)
        {
            shouldClose = false;

            var matchingObject = DatabaseObjects.SingleOrDefault(o => o.Equals(oTriggeringRefresh)) as IRevertable;

            //matched object in our collection
            if (matchingObject != null)
            {
                if (matchingObject.Exists())
                {
                    matchingObject.RevertToDatabaseState();
                }
                else
                {
                    shouldClose = true;//object doesn't exist anymore so close control
                }
            }
        }
コード例 #26
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        _clsData = new DatabaseObjects();

        string[] _strData = new string[4] { drpStatus.SelectedItem.Value ,
                                            drpServerType.SelectedItem.Value,
                                            txtComment.Text.Trim(), calander.Value };
        //updating the data
        try
        {
            UpdatingData(_strData);
            _strError = "Record Updated Successfully";
            _dsAgRecords = ExistingRecords(_dsAgRecords);
        }
        catch (Exception exp)
        {
            _strError = "Error : " + exp.Message;
        }
        GC.Collect();
    }
コード例 #27
0
        public static void ConstructDataSourceObjectFromPostRequest(JSONDataSource jsonDS, ref SqlBuilderColumnSelection requestedCols, ref SqlBuilderColumnSelection workingSelCols,
                                                                    ref SqlBuilderColumnSelection distinctSelCols, ref OrderBy orderBy, ref KeylessVirtualTable table)
        {
            DataSource ds = new DataSource();

            ds.Initialize(jsonDS.Name, DatabaseObjects.GetTableObject(jsonDS.Table), jsonDS.PageSize, jsonDS.PageIndex, jsonDS.GenerateTotal);

            if ((jsonDS.JSelectItems != null))
            {
                foreach (JDataSourceSelectItem jsonSItem in jsonDS.JSelectItems)
                {
                    ds.AddSelectItem(ConstructSelectItemFromPostRequest(jsonSItem));
                }
            }

            requestedCols   = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);
            workingSelCols  = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);
            distinctSelCols = new SqlBuilderColumnSelection(jsonDS.ExpandForeignKeyColumns, jsonDS.IsDistinct);

            List <BaseColumn> columnsList = null;

            if (jsonDS.isTotalRecordArray)
            {
                columnsList = ds.CreateColumnSelectionsForTotal(ref requestedCols, ref workingSelCols, ref distinctSelCols);
            }
            else
            {
                columnsList = ds.CreateColumnSelections(ref requestedCols, ref workingSelCols, ref distinctSelCols);
            }
            table = ds.CreateVirtualTable(columnsList.ToArray());

            if ((jsonDS.JOrderByList != null))
            {
                foreach (JOrderBy jsonOrderBy in jsonDS.JOrderByList)
                {
                    ds.AddAggregateOrderBy(jsonOrderBy.ColumnName, OrderByItem.ToOrderDir(jsonOrderBy.OrderDirection));
                }
            }
            ds.UpdateOrderBy(columnsList);
            orderBy = ds.OrderBy;
        }
コード例 #28
0
 protected void ExportData()
 {
     if (string.IsNullOrEmpty(this.TableId))
     {
         return;
     }
     try
     {
         PrimaryKeyTable t   = (PrimaryKeyTable)DatabaseObjects.GetTableObject(this.TableId);
         BaseRecord      rec = (BaseRecord)t.GetRecordData(this.RecordId, false);
         if ((this.ImagePercentSize != 100.0 && !(this.ImagePercentSize == 0.0)) || !((this.ImageHeight == 0) || (this.ImageWidth == 0)))
         {
             //To display image with shrinking according to user specified height/width or ImagePercentSize
             ColumnValue fieldData  = MiscUtils.GetData(rec, t.TableDefinition.ColumnList.GetByAnyName(this.FieldId));
             byte[]      binaryData = MiscUtils.GetBinaryData(t.TableDefinition.ColumnList.GetByAnyName(this.FieldId), fieldData);
             if (binaryData == null || binaryData.Length == 0)
             {
                 MiscUtils.RegisterJScriptAlert(this, "No Content", "Field " + this.FieldId + " does not contain any binary data.", false, true);
                 return;
             }
             byte[] thumbNailSizeImage = GetThumbNailSizeImage(binaryData);
             string filName            = MiscUtils.GetFileNameWithExtension(t.TableDefinition.ColumnList.GetByAnyName(this.FieldId), binaryData, null);
             MiscUtils.SendToWriteResponse(this.Response, thumbNailSizeImage, filName, t.TableDefinition.ColumnList.GetByAnyName(this.FieldId), fieldData, this.Offset);
         }
         else
         {
             //Calling ExportFieldData method without image shrinking.
             if (!MiscUtils.ExportFieldData(this.Response, rec, t.TableDefinition.ColumnList.GetByAnyName(this.FieldId), this.FileName, this.Offset))
             {
                 MiscUtils.RegisterJScriptAlert(this, "No Content", "Field " + this.FieldId + " does not contain any binary data.", false, true);
                 return;
             }
         }
     }
     catch
     {
     }
 }
コード例 #29
0
        protected override bool Run(object parameters)
        {
            try
            {
                DatabaseConnection connection = (DatabaseConnection)parameters;

                DatabaseObjects dbObjects = DatabaseValidation.Validate(connection.MasterDatabase, connection.ChildDatabase, false, true);

                foreach (DatabaseObject dbObject in dbObjects)
                {
                    if (ValidationError != null)
                    {
                        if (dbObject.ObjectParameter1 == "REPLICATE$HASH")
                        {
                            continue;
                        }

                        ValidationError(this, new SchemaValidationArgs(dbObject.ObjectType.ToString(),
                                                                       dbObject.ObjectName, dbObject.ObjectParameter1, dbObject.Status.ToString(),
                                                                       dbObject.SQL, dbObject.ExistsWithDifferentName));
                    }
                }
            }
            catch
            {
                return(false);
            }
            finally
            {
                if (ValidationComplete != null)
                {
                    ValidationComplete(this, EventArgs.Empty);
                }
            }

            return(false);
        }
コード例 #30
0
        private void ExecuteRefreshCommand()
        {
            this.refreshIsRunning  = true;
            LoadingDatabaseObjects = true;

            DatabaseObjects.Clear();
            DatabaseObjects.Add(new SimpleNodeViewModel("Retrieving information..."));

            Task.Factory.StartNew <ObservableCollection <NodeViewModel> >(GetDatabaseObjectsAsync)
            .ContinueWith((previousTask) =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    DatabaseObjects.Clear();
                    foreach (NodeViewModel dbObject in previousTask.Result)
                    {
                        DatabaseObjects.Add(dbObject);
                    }

                    this.refreshIsRunning  = false;
                    LoadingDatabaseObjects = false;
                });
            });
        }
コード例 #31
0
 /// <summary>
 /// Initializes a new DatabaseObject with the parent collection that this object is
 /// associated with and the lock controller to be used with this object.
 /// </summary>
 protected DatabaseObjectUsingAttributesLockable(DatabaseObjects objParent, DatabaseObjectLockController objLockController)
     : base(objParent, objLockController)
 {
 }
コード例 #32
0
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new DatabaseObject with the parent collection that this object is
 /// associated with.
 /// </summary>
 /// --------------------------------------------------------------------------------
 protected DatabaseObjectUsingAttributes(DatabaseObjects objParentCollection)
     : base(objParentCollection)
 {
 }
コード例 #33
0
 public IFilter GetFilterIfAny()
 {
     return((IFilter)DatabaseObjects.SingleOrDefault(o => o is IFilter));
 }
コード例 #34
0
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes the class with the collection that the object is contained within.
 /// </summary>
 /// <param name="objCollection">
 /// The collection that contains the referenced object. The collection's
 /// MyBase.Object function is called to load the object.
 /// </param>
 /// --------------------------------------------------------------------------------
 public ObjectReference(DatabaseObjects objCollection)
     : this(objCollection.ParentDatabase, objCollection)
 {
 }
コード例 #35
0
 public object GetDataObject()
 {
     return(DatabaseObjects.Single(o => o is ColumnInfo || o is TableInfo));
 }
 public ViewCohortIdentificationConfigurationSqlCollection(CohortIdentificationConfiguration config) : this()
 {
     DatabaseObjects.Add(config);
 }
コード例 #37
0
 public ViewAggregateExtractUICollection(AggregateConfiguration config) : this()
 {
     DatabaseObjects.Add(config);
 }
コード例 #38
0
ファイル: Parser.cs プロジェクト: vladimirantos/RDB_Project
        public void Parse(BlockingCollection <string> input, BlockingCollection <DatabaseObjects> output)
        {
            try
            {
                List <Device>      devices      = new List <Device>();
                List <Measurement> measurements = new List <Measurement>();
                List <MType>       mTypes       = new List <MType>();
                List <Point>       points       = new List <Point>();

                //  IEnumerator<string> enumerator = input.GetConsumingEnumerable().GetEnumerator();
                DatabaseObjects databaseObjects = new DatabaseObjects();
                foreach (string s in input.GetConsumingEnumerable())
                {
                    string   line  = s;
                    string[] items = line.Split(';');

                    Device      device      = new Device();
                    MType       mType       = new MType();
                    Measurement measurement = new Measurement();
                    Point       point       = new Point();

                    device.serialNumber = items[9];

                    device.accuracy    = float.Parse(items[10], CultureInfo.InvariantCulture);
                    device.description = items[11];

                    if (!_existingDevices.ContainsKey(device.serialNumber))
                    {
                        _existingDevices.Add(device.serialNumber, device.description);
                        devices.Add(device);
                    }


                    mType.idType = int.Parse(items[12]);
                    mType.name   = items[13];
                    if (!_existingMTypes.ContainsKey(mType.idType))
                    {
                        mTypes.Add(mType);
                        _existingMTypes.Add(mType.idType, mType.name);
                    }

                    measurement.idMeasurement      = _idMeasurement;
                    measurement.serialNumberDevice = device.serialNumber;
                    measurement.idMtype            = mType.idType;
                    measurement.description        = "";
                    measurement.unit = items[1];
                    measurement.date = timestampToDateTime(items[0]);
                    measurements.Add(measurement);

                    point.id_point      = int.Parse(items[2]);
                    point.idMeasurement = measurement.idMeasurement;
                    point.id_point      = measurement.idMeasurement;
                    point.x             = Math.Round(float.Parse(items[3], CultureInfo.InvariantCulture), 2);
                    point.y             = Math.Round(float.Parse(items[4], CultureInfo.InvariantCulture), 2);
                    point.value1        = float.Parse(items[6], CultureInfo.InvariantCulture);
                    point.value2        = float.Parse(items[7], CultureInfo.InvariantCulture);
                    point.variance      = float.Parse(items[8], CultureInfo.InvariantCulture);
                    point.description   = items[5];
                    points.Add(point);

                    if (_idMeasurement % _bufferSize == 0)
                    {
                        databaseObjects.Devices      = new List <Device>(devices);
                        databaseObjects.MTypes       = new List <MType>(mTypes);
                        databaseObjects.Measurements = new List <Measurement>(measurements);
                        databaseObjects.Points       = new List <Point>(points);

                        devices      = new List <Device>();
                        mTypes       = new List <MType>();
                        measurements = new List <Measurement>();
                        points       = new List <Point>();
                        output.Add(databaseObjects);
                        databaseObjects = new DatabaseObjects();
                    }
                    _idMeasurement++;
                }
                if (measurements.Count > 0)
                {
                    databaseObjects.Devices      = new List <Device>(devices);
                    databaseObjects.MTypes       = new List <MType>(mTypes);
                    databaseObjects.Measurements = new List <Measurement>(measurements);
                    databaseObjects.Points       = new List <Point>(points);


                    devices      = new List <Device>();
                    mTypes       = new List <MType>();
                    measurements = new List <Measurement>();
                    points       = new List <Point>();
                    output.Add(databaseObjects);
                    databaseObjects = new DatabaseObjects();
                }
            }
            finally
            {
                output.CompleteAdding();
            }
        }
コード例 #39
0
 private void FillData(DatabaseObjects _clsData, DropDownList drp, string _spName)
 {
     drp.DataSource = _clsData.GetAgilixImportData(_spName);
     drp.DataBind();
 }