Esempio n. 1
0
        /// <summary>
        /// Gets the count from database/template and update into DBMetadata Table
        /// </summary>
        public void GetNUpdateCounts()
        {
            string    AreaCount       = string.Empty;
            string    IndicatorCount  = string.Empty;
            string    IUSCount        = string.Empty;
            string    TimeperiodCount = string.Empty;
            string    SourceCount     = string.Empty;
            string    DataCount       = string.Empty;
            string    SearchString    = string.Empty;
            DataTable SourceTable;

            // Get NId from DBMetadata Table

            // Get area count
            AreaCount = this.DBConnection.ExecuteScalarSqlQuery(DIQueries.GetTableRecordsCount(this.DBQueries.TablesName.Area, string.Empty)).ToString();

            // Get Indicator count
            IndicatorCount = this.DBConnection.ExecuteScalarSqlQuery(DIQueries.GetTableRecordsCount(this.DBQueries.TablesName.Indicator, string.Empty)).ToString();
            // Get IUS count
            IUSCount = this.DBConnection.ExecuteScalarSqlQuery(DIQueries.GetTableRecordsCount(this.DBQueries.TablesName.IndicatorUnitSubgroup, string.Empty)).ToString();

            // Get timeperiod count
            TimeperiodCount = this.DBConnection.ExecuteScalarSqlQuery(DIQueries.GetTableRecordsCount(this.DBQueries.TablesName.TimePeriod, string.Empty)).ToString();

            // Get source count
            SearchString = IndicatorClassifications.ICParent_NId + ">0";
            SourceTable  = this.DBConnection.ExecuteDataTable(this.DBQueries.Source.GetSource(FilterFieldType.Search, SearchString, FieldSelection.NId, false));
            if (SourceTable.Rows.Count > 0)
            {
                SourceCount = Convert.ToString(SourceTable.Select().Length);
            }
            else
            {
                SourceCount = "0";
            }


            // Get data count
            DataCount = this.DBConnection.ExecuteScalarSqlQuery(DIQueries.GetTableRecordsCount(this.DBQueries.TablesName.Data, string.Empty)).ToString();

            this.UpdateCounts(-1, AreaCount, IndicatorCount, IUSCount, TimeperiodCount, SourceCount, DataCount);
        }