//-- Check orgTextual_Data_value exists or not. If column exists then move textual & numeric values into their respective column.
        public static void SeparateTextualandNemericData(DIConnection dbConnection, DIQueries dbQueries)
        {
            string SqlQuery = string.Empty;
            try
            {
                if (ISColumnExists(dbConnection, Constants.Data.Orginal_Data_valueColumn, dbQueries.TablesName.Data))
                {

                    //--Update Textual value true if data value is not Numeric
                    SqlQuery = "UPDATE " + dbQueries.TablesName.Data + " SET " + Data.IsTextualData + " = 1 WHERE NOT ISNUMERIC(" + Data.DataValue + ")";
                    dbConnection.ExecuteNonQuery(SqlQuery);

                    //-- move orgData_Value values into Data_Value
                    SqlQuery = "UPDATE " + dbQueries.TablesName.Data + "	Set " + Constants.Data.Orginal_Data_valueColumn + "=" + Data.DataValue + " WHERE " + Data.IsTextualData + " = 0";
                    dbConnection.ExecuteNonQuery(SqlQuery);

                    //--move orgTextual_Data_value into Textual_Data_value if ISTextual is true
                    SqlQuery = "UPDATE " + dbQueries.TablesName.Data + " Set " + Constants.Data.Orginal_Textual_Data_valueColumn + " = " + Data.DataValue + " WHERE " + Data.IsTextualData + "<>0";
                    dbConnection.ExecuteNonQuery(SqlQuery);

                    //2. Remove Data_Value  column and rename orgTextual_Data_Value and orgData_Value to Textual_Data_Value and Data_value"
                    DIDataValueHelper.RemoveDataValueAndRenameOrgColumns(dbConnection, dbQueries);

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
    public RegistryService()
    {
        int DBNIdOut;

        if (this.Context.Request.QueryString["p"] != null && !string.IsNullOrEmpty(this.Context.Request.QueryString["p"]) &&
            int.TryParse(this.Context.Request.QueryString["p"], out DBNIdOut))
        {
            DBNId = DBNIdOut;
        }
        else
        {
            Global.GetAppSetting();
            DBNId = Convert.ToInt32(Global.GetDefaultDbNId());
        }

        if (Global.IsDSDUploadedFromAdmin(DBNId))
        {
            this.DIConnection = Global.GetDbConnection(this.Get_AssociatedDB_NId(DBNId.ToString()));
        }
        else
        {
            this.DIConnection = Global.GetDbConnection(DBNId);
        }

        this.DIQueries = new DIQueries(this.DIConnection.DIDataSetDefault(), this.DIConnection.DILanguageCodeDefault(this.DIConnection.DIDataSetDefault()));
    }
示例#3
0
        public static List<ArtefactInfo> Generate_Categorization(SDMXSchemaType schemaType, string agencyId, string language, Header header, string outputFolder, DIConnection DIConnection, DIQueries DIQueries,string IcType)
        {
            List<ArtefactInfo> RetVal;
            CategorizationUtility CategorizationUtility;

            RetVal = null;
            CategorizationUtility = null;

            try
            {
                CategorizationUtility = new CategorizationUtility(agencyId, language, header, outputFolder, DIConnection, DIQueries);
               // RetVal = CategorizationUtility.Generate_Artefact();
                RetVal = CategorizationUtility.Generate_CompleteArtefact(IcType);
                CategorizationUtility.Save_Artefacts(RetVal);
            }
            catch (Exception ex)
            {
                RetVal = null;
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
示例#4
0
        public static DIData CreateInstance(DIImportFileType importFileType, List<string> sourceFileNamesWPath,
            string tempFolderPath, DIConnection dbConnection, DIQueries dbQueries)
        {
            DIData RetVal = null;
            switch (importFileType)
            {
                case DIImportFileType.DataEntrySpreasheet:
                    break;
                case DIImportFileType.Database:
                    break;
                case DIImportFileType.Template:
                    break;
                case DIImportFileType.SDMXXml:
                    RetVal = new SDMX.SDMXXml(sourceFileNamesWPath, tempFolderPath, dbConnection, dbQueries);
                    break;
                default:
                    break;
            }

            if (RetVal != null)
            {
                RetVal.ImportFileType = importFileType;
            }
            return RetVal;
        }
 internal SummarySheetGenerator(bool isComparison,ref DIConnection dbConnection,ref DIConnection targetDBConnection,string targetFile,string sourceDB)
 {
     this.ForComparisonReport = isComparison;
     this.ReferenceDataBaseFile = sourceDB;
     this.RefDBConnection = dbConnection;
     this.TargetDBConnection = targetDBConnection;
 }
        internal ExportOnlineDatabase(UserSelection userSelection, DIConnection sourceDBConnection, DIQueries sourceDBQueries)
        {
            if (sourceDBConnection != null && userSelection != null)
            {
                this.UserSelection = userSelection;

                //--  Assign NIDs in userSelection.
                if (userSelection.ShowIUS)
                {
                    this.IUSNIDs = userSelection.IndicatorNIds;
                }
                else
                {
                    this.IndicatorNIDs = userSelection.IndicatorNIds;
                }

                this.AreaNIDs = userSelection.AreaNIds;
                this.TimePeriodNIDs = userSelection.TimePeriodNIds;
                this.SourceNIDs = userSelection.SourceNIds;
                this.ApplyMRD = userSelection.DataViewFilters.MostRecentData;

                this.SourceDBConnection = sourceDBConnection;
                this.SourceDBQueries = sourceDBQueries;         //new DIQueries(this.SourceDBConnection.DIDataSetDefault(), this.SourceDBConnection.DILanguageCodeDefault(this.SourceDBConnection.DIDataSetDefault()));
            }
        }
        internal CategorySchemeUtility(CategorySchemeTypes categorySchemeType, bool completeOrSummaryFlag, string agencyId, string language, Header header, string outputFolder, Dictionary<string, string> DictIndicator, Dictionary<string, string> DictIndicatorMapping, DIConnection DIConnection, DIQueries DIQueries)
            : base(agencyId, language, header, outputFolder)
        {
            this._categorySchemeType = categorySchemeType;
            this._completeOrSummaryFlag = completeOrSummaryFlag;
            this._diConnection = DIConnection;
            this._diQueries = DIQueries;

            if (string.IsNullOrEmpty(language))
            {
                this.Language = this._diQueries.LanguageCode.Substring(1);
                this._multiLanguageHandlingRequired = true;
            }
            else
            {
                if (this._diConnection.IsValidDILanguage(this._diQueries.DataPrefix, language))
                {
                    this.Language = language;
                    this._multiLanguageHandlingRequired = false;
                }
                else
                {
                    this.Language = this._diQueries.LanguageCode.Substring(1);
                    this._multiLanguageHandlingRequired = false;
                }
            }

            this._dictIndicator = DictIndicator;
            this._dictIndicatorMapping = DictIndicatorMapping;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="fileNameWPath"></param>
        public DI6ToDI5Converter(string fileNameWPath)
        {
            this.DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, fileNameWPath, string.Empty, string.Empty);
            this.DBQueries = new DIQueries(this.DBConnection.DIDataSetDefault(), this.DBConnection.DILanguageCodeDefault("UT_"));

            this.FilenameWPath = fileNameWPath;
        }
        /// <summary>
        /// Create and insert into TmpDI7SearchIndicators table
        /// </summary>
        /// <param name="dbConnection"></param>
        /// <param name="tableNames"></param>
        /// <param name="searchIndicators"></param>
        /// <param name="isSearchForQS"></param>
        public static void CreateTmpIndSearchTbl(DIConnection dbConnection, DITables tableNames, string searchIndicators, bool isSearchForQS)
        {
            StringBuilder SBQry = new StringBuilder();
            string StrQry = string.Empty;

            string SearchLanguage = string.Empty;

            try
            {
                CacheUtility.CreateSearchIndicatorsTable(dbConnection);

                if (!string.IsNullOrEmpty(searchIndicators))
                {
                    CacheUtility.GetSplittedList(dbConnection, searchIndicators, ",", true);

                    SBQry.Remove(0, SBQry.Length);
                    SBQry.Append("INSERT INTO " + QDSConstants.QDSTables.SearchIndicators.TableName);
                    SBQry.Append(" (" + QDSConstants.QDSTables.SearchIndicators.Columns.IndicatorNId + ")");
                    SBQry.Append(" SELECT Ind."+ Indicator.IndicatorNId +" As IndicatorNId FROM "+ tableNames.Indicator +" As Ind");
                    SBQry.Append(" INNER JOIN " + QDSConstants.QDSTables.SplittedList.TableName + " L");
                    SBQry.Append(" ON Ind." + Indicator.IndicatorNId + " = L." + QDSConstants.QDSTables.SplittedList.Columns.Value);
                    StrQry = SBQry.ToString();
                    dbConnection.ExecuteNonQuery(StrQry);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#10
0
    public string GetDataQueryResponseJSON(string dbNId, string language, string key)
    {
        string ResponseString;
        XmlDocument QueryDocument;

        ResponseString = string.Empty;
        QueryDocument = null;

        try
        {
            this.DIConnection = Global.GetDbConnection(Convert.ToInt32(dbNId));
            this.DIQueries = new DIQueries(this.DIConnection.DIDataSetDefault(), this.DIConnection.DILanguageCodeDefault(this.DIConnection.DIDataSetDefault()));

            QueryDocument = this.Get_Query(key, Constants.WSQueryStrings.ResponseFormatTypes.JSON, Constants.WSQueryStrings.SDMXFormatTypes.StructureSpecificTS, language);
            ResponseString = DATAUtility.Get_Data(QueryDocument, DataTypes.JSON, DIConnection, DIQueries);
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;
        }
        finally
        {
        }

        return ResponseString;
    }
示例#11
0
 public ElementMapper(DIConnection dbConnection, DIQueries dbQueries, Dictionary<TemplateMergeControlType, MergeTableInfo> mappedTables)
 {
     this.DBConnection = dbConnection;
     this.DBQueries = dbQueries;
     this.TemplateQueries = new MergeTemplateQueries(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode);
     this.MappedTables = mappedTables;
 }
        internal MetadataReportUtility(string agencyId, string language, Header header, DIConnection DIConnection, DIQueries DIQueries)
        {
            this._agencyId = agencyId;
            this._header = header;
            this._diConnection = DIConnection;
            this._diQueries = DIQueries;

            if (string.IsNullOrEmpty(language))
            {
                this._language = this._diQueries.LanguageCode.Substring(1);
                this._multiLanguageHandlingRequired = true;
            }
            else
            {
                if (this._diConnection.IsValidDILanguage(this._diQueries.DataPrefix, language))
                {
                    this._language = language;
                    this._multiLanguageHandlingRequired = false;
                }
                else
                {
                    this._language = this._diQueries.LanguageCode.Substring(1);
                    this._multiLanguageHandlingRequired = false;
                }
            }
        }
示例#13
0
        internal CodelistUtility(CodelistTypes codelistType, bool completeOrSummaryFlag, string agencyId, string language, Header header, string outputFolder, DIConnection DIConnection, DIQueries DIQueries)
            : base(agencyId, language, header, outputFolder)
        {
            this._codelistType = codelistType;
            this._completeOrSummaryFlag = completeOrSummaryFlag;
            this._diConnection = DIConnection;
            this._diQueries = DIQueries;

            if (string.IsNullOrEmpty(language))
            {
                this.Language = this._diQueries.LanguageCode.Substring(1);
                this._multiLanguageHandlingRequired = true;
            }
            else
            {
                if (this._diConnection.IsValidDILanguage(this._diQueries.DataPrefix, language))
                {
                    this.Language = language;
                    this._multiLanguageHandlingRequired = false;
                }
                else
                {
                    this.Language = this._diQueries.LanguageCode.Substring(1);
                    this._multiLanguageHandlingRequired = false;
                }
            }
        }
示例#14
0
        /// <summary>
        /// Rename Data_value and TextualValue column into OrgData_value and OrgTextualValue 
        /// and merge both column value into new column Data_Value
        /// </summary>
        /// <param name="dbConnection"></param>
        /// <param name="dbQueries"></param>
        public static void MergeTextualandNumericDataValueColumn(DIConnection dbConnection, DIQueries dbQueries)
        {
            try
            {
                if (!ISColumnExists(dbConnection, Constants.Data.Orginal_Data_valueColumn, dbQueries.TablesName.Data))
                {

                    //1. Rename Textual_Data_Value & Data_value  to orgTextual_Data_value & orgData_Value respectively
                    RenameOriganalDataTableColumnInDatabase(dbConnection, dbQueries, Data.TextualDataValue, Constants.Data.Orginal_Textual_Data_valueColumn, " Memo");
                    RenameOriganalDataTableColumnInDatabase(dbConnection, dbQueries, Data.DataValue, Constants.Data.Orginal_Data_valueColumn, " Double ");
                    System.Threading.Thread.Sleep(100);
                    //2. Create new column Data_Value of memo data type
                    string SqlQuery = "ALTER Table " + dbQueries.TablesName.Data + " Add Column " + Data.DataValue + " Memo NULL";
                    dbConnection.ExecuteNonQuery(SqlQuery);
                    System.Threading.Thread.Sleep(10);
                    //3. Merge all data values into Data_Value column
                    SqlQuery = "UPDATE " + dbQueries.TablesName.Data + " SET " + Data.DataValue + "=" + Constants.Data.Orginal_Data_valueColumn;
                    dbConnection.ExecuteNonQuery(SqlQuery);

                    SqlQuery = "UPDATE " + dbQueries.TablesName.Data + " SET " + Data.DataValue + "=" + Constants.Data.Orginal_Textual_Data_valueColumn + " WHERE " + Data.IsTextualData + "=" + true;
                    dbConnection.ExecuteNonQuery(SqlQuery);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        internal CategorizationUtility(string agencyId, string language, Header header, string outputFolder, DIConnection DIConnection, DIQueries DIQueries)
            : base(agencyId, language, header, outputFolder)
        {
            this._diConnection = DIConnection;
            this._diQueries = DIQueries;

            if (string.IsNullOrEmpty(language))
            {
                this.Language = this._diQueries.LanguageCode.Substring(1);
                this._multiLanguageHandlingRequired = true;
            }
            else
            {
                if (this._diConnection.IsValidDILanguage(this._diQueries.DataPrefix, language))
                {
                    this.Language = language;
                    this._multiLanguageHandlingRequired = false;
                }
                else
                {
                    this.Language = this._diQueries.LanguageCode.Substring(1);
                    this._multiLanguageHandlingRequired = false;
                }
            }
        }
示例#16
0
        public static int CreateChildTbl(DIConnection dbConnection, string languageCode)
        {
            int RetVal = -1;

            RetVal = CreateSearchResultCopyTable(dbConnection, QDSConstants.QDSTables.ChildTable.TableName, languageCode);

            return RetVal;
        }
示例#17
0
 internal BaseQueryUtility(Dictionary<string, string> dictUserSelections, DataReturnDetailTypes dataReturnDetailType, string agencyId, DIConnection DIConnection, DIQueries DIQueries)
 {
     this._dictUserSelections = dictUserSelections;
     this._dataReturnDetailType = dataReturnDetailType;
     this._agencyId = agencyId;
     this._diConnection = DIConnection;
     this._diQueries = DIQueries;
 }
示例#18
0
 public IUSBuilder(DIConnection connection, DIQueries queries)
 {
     this.DBConnection = connection;
     this.DBQueries = queries;
     this.DIIndicator = new IndicatorBuilder(connection, queries);
     this.DIUnit = new UnitBuilder(connection, queries);
     this.DISubgroupVal = new DI6SubgroupValBuilder(connection, queries);
     DIConnection.ConnectionType = this.DBConnection.ConnectionStringParameters.ServerType;
 }
        /// <summary>
        /// Returns the instance of BaseListViewSource. Based on Factory method.
        /// </summary>
        /// <param name="listType"></param>
        /// <param name="dbConnection"></param>
        /// <param name="dbQueries"></param>
        /// <param name="userprefenece"></param>
        /// <returns></returns>
        public static BaseListViewSource CreateListViewSource(ListViewType listType, DIConnection dbConnection, DIQueries dbQueries, UserPreference userprefenece)
        {
            BaseListViewSource RetVal = null;

            switch (listType)
            {
                case ListViewType.Indicator:
                    RetVal = new IndicatorListViewSource();
                    RetVal.RaiseInitializedIndicatorListViewEvent();
                    break;

                case ListViewType.Timeperiod:
                    RetVal = new TimeperiodListViewSource();
                    RetVal.RaiseInitializedTimperiodListViewEvent();
                    break;

                case ListViewType.Area:
                    RetVal = new AreaListViewSource();
                    RetVal.RaiseInitializedAreaListViewEvent();
                    break;

                case ListViewType.Source:
                    RetVal = new DISourceListViewSource();
                    RetVal.RaiseInitializedDISourceListViewEvent();
                    break;

                case ListViewType.Unit:
                    RetVal = new UnitListViewSource();
                    RetVal.RaiseInitializedUnitListViewEvent();
                    break;

                case ListViewType.SubgroupVal:
                    RetVal = new SubgroupValListViewSource();
                    RetVal.RaiseInitializedUnitListViewEvent();
                    break;

                case ListViewType.IC:
                    RetVal = new ICListViewSource();
                    break;

                default:
                    break;
            }

            if (RetVal != null)
            {
                //set variables
                RetVal.DBConnection = dbConnection;
                RetVal.DBQueries = dbQueries;
                RetVal.DIUserPreference = userprefenece;

                //set columns
                RetVal.SetColumnInfo();
            }

            return RetVal;
        }
 public IndicatorClassificationSelections(DIConnection dIConnection,DIQueries dIQueries)
 {
     // -- DAL connection object
     this.DbConnection = dIConnection;
     // -- DAL query object
     this.DbQueries = dIQueries;
     // -- Intialize the string builder object
     this._XMLString = new StringBuilder();
 }
        /// <summary>
        /// Returns the instance of BaseListViewSource. Based on Factory method.
        /// </summary>
        /// <param name="listType"></param>
        /// <param name="showCheckBoxColumn"></param>
        /// <param name="dbConnection"></param>
        /// <param name="dbQueries"></param>
        /// <returns></returns>
        public static BaseListViewSource CreateListViewSource(ListViewType listType, DIConnection dbConnection, DIQueries dbQueries)
        {
            BaseListViewSource RetVal = null;
            UserPreference DIUserPreferencce = new UserPreference();

            RetVal = ListViewSourceFactory.CreateListViewSource(listType, dbConnection, dbQueries, DIUserPreferencce);

            return RetVal;
        }
        public override void Import(string selectedNids)
        {
            DataTable Table = null;
            int ProgressCounter = 0;
            DI6SubgroupTypeBuilder SGBuilderObj = null;
            DI6SubgroupTypeInfo SGInfoObj = null;
            Dictionary<string, DataRow> FileWithNids = new Dictionary<string, DataRow>();

            DIConnection SourceDBConnection = null;
            DIQueries SourceDBQueries = null;
            DI6SubgroupTypeBuilder SourceSGTypeBuilder = null;

            //-- Step 1: Get TempTable with Sorted SourceFileName
            Table = this._TargetDBConnection.ExecuteDataTable(this.ImportQueries.GetImportSubgroupDimensions(selectedNids));

            //-- Step 2:Initialise Indicator Builder with Target DBConnection
            SGBuilderObj = new DI6SubgroupTypeBuilder(this.TargetDBConnection, this.TargetDBQueries);

            // Initialize progress bar
            this.RaiseProgressBarInitialize(selectedNids.Split(',').GetUpperBound(0) + 1);

            //-- Step 3: Import Nids for each SourceFile
            foreach (DataRow Row in Table.Copy().Rows)
            {
                try
                {
                    string SourceFileWPath = Convert.ToString(Row[MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]);

                    SourceDBConnection = new DIConnection(DIServerType.MsAccess, String.Empty, String.Empty, SourceFileWPath, String.Empty, MergetTemplateConstants.DBPassword);
                    SourceDBQueries = DataExchange.GetDBQueries(SourceDBConnection);

                    // get subgroup type info from source
                    SourceSGTypeBuilder = new DI6SubgroupTypeBuilder(SourceDBConnection, SourceDBQueries);
                    SGInfoObj =SourceSGTypeBuilder.GetSubgroupTypeInfoByNid(Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]));

                    // import subgroup type only if doesnt exist
                    SGBuilderObj.ImportSubgroupType(SGInfoObj, Convert.ToInt32(Row[MergetTemplateConstants.Columns.COLUMN_SRCNID]), SourceDBQueries, SourceDBConnection);
                    ProgressCounter += 1;
                    this.RaiseProgressBarIncrement(ProgressCounter);

                }
                catch (Exception ex) { ExceptionFacade.ThrowException(ex); }
                finally
                {
                    if (SourceDBConnection != null)
                        SourceDBConnection.Dispose();
                    if (SourceDBQueries != null)
                        SourceDBQueries.Dispose();
                }
            }
            this._AvailableTable = this.GetAvailableTable();
            this._UnmatchedTable = this.GetUnmatchedTable();
            // Close ProgressBar
            this.RaiseProgressBarClose();
        }
示例#23
0
        internal AssistantImporter(DIConnection targetConnection, DIQueries targetQueries, List<string> sourceDatabaseFileNamesWPath)
        {
            this._TargetDBConnection = targetConnection;
            this._TargetDBQueries = targetQueries;

            this.SourceDatabaseFileNamesWPath = sourceDatabaseFileNamesWPath;

            this.AvailableIndicators = new IndicatorBuilder(this._TargetDBConnection, this._TargetDBQueries);
            this.AvailableUnit= new UnitBuilder(this._TargetDBConnection, this._TargetDBQueries);
            this.AvailableSubgroupVal= new DI6SubgroupValBuilder(this._TargetDBConnection, this._TargetDBQueries);
        }
示例#24
0
        public static void ClearIcon(DIConnection dbConnection, string dataPrefix, IconElementType elementType)
        {
            try
            {
                dbConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Icon.Delete.ClearIcon(dataPrefix, DIIcons.Elements[elementType].ToString()));

            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
        }
示例#25
0
 //Returns the requires area levels
 public static DataTable GetAreaLevels(DIConnection dBConnection, DIQueries dBQueries)
 {
     DataTable dtAreaLevel = null;
     try
     {
         dtAreaLevel = dBConnection.ExecuteDataTable(dBQueries.Area.GetAreaLevel(FilterFieldType.None, string.Empty));
     }
     catch (Exception)
     {
     }
     return dtAreaLevel;
 }
示例#26
0
        /// <summary>
        /// Generate Cache Result tables on language basis
        /// </summary>
        /// <param name="databasePath"></param>
        public void GenerateCacheResults(string databasePath)
        {
            List<string> DbLangCodes = new List<string>();
            DIConnection DbConnection = null;
            string DataFolerName = string.Empty;
            int ProgressCount = 20;

            try
            {
                //-- raise event to display progress form
                this.RaiseDisplayProgressFormEvent();

                // increment progress bar value
                this.RaiseProgressChangedEvent(ProgressCount++, string.Empty, string.Empty, false);

                DbConnection = new DIConnection(DIServerType.MsAccess, "", "", databasePath, "", "");

                DbLangCodes = DI7OfflineSPHelper.GetAllDbLangCodes(DbConnection);

                // increment progress bar value
                this.RaiseProgressChangedEvent(ProgressCount++, string.Empty, string.Empty, false);

                //-- Merge Textual_Data_Value and Data_value column into Data_value column
                DIDataValueHelper.MergeTextualandNumericDataValueColumn(databasePath);

                // increment progress bar value
                this.RaiseProgressChangedEvent(ProgressCount++, string.Empty, string.Empty, false);

                //-- Create new temp table and alter table schemas
                this.CreateNAlterSchemas(DbConnection);

                // increment progress bar value
                this.RaiseProgressChangedEvent(ProgressCount++, string.Empty, string.Empty, false);

                //-- Generate cache on language basis
                foreach (string LangCode in DbLangCodes)
                {
                    this.CreateCacheResults(DbConnection, LangCode);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (DbConnection != null)
                {
                    DbConnection.Dispose();
                    DbConnection = null;
                }
            }
        }
示例#27
0
        public static int CreateDISearchResultsTable(DIConnection dbConnection, string languageCode)
        {
            int RetVal = -1;
            StringBuilder SBQry = new StringBuilder();
            string TblName = string.Empty;

            try
            {
                TblName = QDSConstants.QDSTables.DISearchResult.TableName + "_" + languageCode;

                dbConnection.DropTable(TblName);

                SBQry.Append("Create Table " + TblName);
                SBQry.Append("(");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.NId + "] COUNTER, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.SearchLanguage + "] Text(50) NOT NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.IndicatorNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.UnitNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.AreaNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.IsAreaNumeric + "] YESNO NOT NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.IndicatorName + "] Text(255) NOT NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.Unit + "] Text(128) NOT NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.Area + "] Text(255) NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.DefaultSG + "] Text(255) NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.MRDTP + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.MRD + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.AreaCount + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.SGCount + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.SourceCount + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.TPCount + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.DVCount + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.AreaNIds + "] Text(255) NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.SGNIds + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.SourceNIds + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.TPNIds + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.DVNIds + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.DVSeries + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.Dimensions + "] Text NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.BlockAreaParentNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.IUSNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.AreaParentNId + "] Long NULL, ");
                SBQry.Append("[" + QDSConstants.QDSTables.DISearchResult.Columns.IsBlockAreaRecord + "] YESNO");
                SBQry.Append(")");

                RetVal = dbConnection.ExecuteNonQuery(SBQry.ToString());
            }
            catch (Exception)
            {
                throw;
            }

            return RetVal;
        }
示例#28
0
        /// <summary>
        /// Process Mapped Areas from MappedRows.
        /// </summary>
        public void ProcessMappedAreas()
        {
            DIConnection SrcDBConnection = null;
            DIQueries SrcDBQueries = null;

            AreaBuilder TrgAreaBuilder = null;
            AreaBuilder SourceAreaBuilder = null;
            AreaInfo SrcAreaInfo = null;

            DataTable Table = null;
            string SourceFileWPath = string.Empty;
            int TrgAreaNid = 0;

            if (this.MappedTables.ContainsKey(TemplateMergeControlType.Areas))
            {
                TrgAreaBuilder = new AreaBuilder(this.DBConnection, this.DBQueries);

                foreach (DataRow Row in this.MappedTables[TemplateMergeControlType.Areas].MappedTable.MappedTable.Rows)
                {
                    //todo:
                    Table = this.DBConnection.ExecuteDataTable(TemplateQueries.GetImportAreas());

                    TrgAreaNid = Convert.ToInt32(Row[MergetTemplateConstants.Columns.AVAILABLE_COL_Prefix + Area.AreaNId]);

                    if (Table != null && Table.Rows.Count > 0)
                    {
                        try
                        {
                            SourceFileWPath = Convert.ToString(Table.Rows[0][MergetTemplateConstants.Columns.COLUMN_SOURCEFILENAME]);

                            SrcDBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, SourceFileWPath, string.Empty, string.Empty);
                            SrcDBQueries = DataExchange.GetDBQueries(SrcDBConnection);

                            // Get Source Area Info
                            SourceAreaBuilder = new AreaBuilder(SrcDBConnection, SrcDBQueries);
                            SrcAreaInfo= SourceAreaBuilder.GetAreaInfo(FilterFieldType.NId, Convert.ToString(Table.Rows[0][MergetTemplateConstants.Columns.COLUMN_SRCNID]));

                            // Import Mapped Area
                            TrgAreaBuilder.ImportAreaFrmMappedArea(SrcAreaInfo, SrcAreaInfo.Nid, TrgAreaNid, SrcDBQueries, SrcDBConnection);
                        }
                        finally
                        {
                            if (SrcDBConnection != null)
                            {
                                SrcDBConnection.Dispose();
                                SrcDBQueries.Dispose();
                            }
                        }
                    }
                }
            }
        }
示例#29
0
        /// <summary>
        /// Area Autoselection: From the TreeView by Selected Area, Target Area Level
        /// </summary>
        /// <param name="userPreference"></param>
        /// <param name="dIConnection"></param>
        /// <param name="dIQueries"></param>
        /// <param name="parentNId"></param>
        /// <param name="currentLevel"></param>
        /// <param name="requiredLevel"></param>
        public AutoSelectArea(UserPreference.UserPreference userPreference, DI_LibDAL.Connection.DIConnection dIConnection, DI_LibDAL.Queries.DIQueries dIQueries, int parentNId, int currentLevel, int requiredLevel)
        {
            // -- Connection details preserved
            this.mdIConnection = dIConnection;
            this.mdIQueries = dIQueries;
            this.mUserPreference = userPreference;

            // Autoselect Parameters
            this.mparentNId = parentNId;
            this.mcurrentLevel = currentLevel;
            this.mrequiredLevel = requiredLevel;
            this.mAreaNIDs = string.Empty;
        }
示例#30
0
        /// <summary>
        /// Area Autoselection: From the Available list by a list of available Area NIDs
        /// </summary>
        /// <param name="userPreference"></param>
        /// <param name="dIConnection"></param>
        /// <param name="dIQueries"></param>
        /// <param name="sAvlAreaNIDs"></param>
        public AutoSelectArea(UserPreference.UserPreference userPreference, DI_LibDAL.Connection.DIConnection dIConnection, DI_LibDAL.Queries.DIQueries dIQueries, string avlAreaNIDs)
        {
            // -- Connection details preserved
            this.mdIConnection = dIConnection;
            this.mdIQueries = dIQueries;
            this.mUserPreference = userPreference;

            // Autoselect Parameters
            this.mparentNId = -1;
            this.mcurrentLevel = 0;
            this.mrequiredLevel = 0;
            this.mAreaNIDs = avlAreaNIDs;
        }