コード例 #1
0
        /// <summary>
        /// Check existance of indicator record into database if false then create indicator record 
        /// </summary>
        /// <param name="indicatorInfo">object of IndicatorInfo</param>
        /// <returns>Indicator Nid</returns>
        public int CheckNCreateIndicator(IndicatorInfo indicatorInfo)
        {
            int RetVal = 0;

            try
            {
                // check indicator exists or not
                RetVal = this.CheckIndicatorExists(indicatorInfo);

                // if indicator does not exist then create it.
                if (RetVal <= 0)
                {
                    // insert indicator
                    if (this.InsertIntoDatabase(indicatorInfo))
                    {
                        RetVal = this.GetNidByName(indicatorInfo.Name);
                    }

                }

                // add indicator information into collection
                indicatorInfo.Nid = RetVal;
                this.AddIndicatorIntoCollection(indicatorInfo);
            }
            catch (Exception)
            {
                RetVal = 0;
            }

            return RetVal;
        }
コード例 #2
0
        /// <summary>
        /// Check existance of indicator record into database if false then create indicator record
        /// </summary>
        /// <param name="indicatorInfo">object of IndicatorInfo</param>
        /// <returns>Indicator Nid</returns>
        public int CheckNCreateIndicator(IndicatorInfo indicatorInfo)
        {
            int RetVal = 0;

            try
            {
                // check indicator exists or not
                RetVal = this.CheckIndicatorExists(indicatorInfo);

                // if indicator does not exist then create it.
                if (RetVal <= 0)
                {
                    // insert indicator
                    if (this.InsertIntoDatabase(indicatorInfo))
                    {
                        RetVal = this.GetNidByName(indicatorInfo.Name);
                    }
                }

                // add indicator information into collection
                indicatorInfo.Nid = RetVal;
                this.AddIndicatorIntoCollection(indicatorInfo);
            }
            catch (Exception)
            {
                RetVal = 0;
            }

            return(RetVal);
        }
コード例 #3
0
 /// <summary>
 ///To add indicatorInfo into collection
 /// </summary>
 /// <param name="indicatorRecord">object of IndicatorInfo</param>
 private void AddIndicatorIntoCollection(IndicatorInfo indicatorInfo)
 {
     if (!this.IndicatorCollection.ContainsKey(indicatorInfo.Name))
     {
         this.IndicatorCollection.Add(indicatorInfo.Name, indicatorInfo);
     }
 }
コード例 #4
0
        /// <summary>
        /// Returns instance of IndicatorInfo.
        /// </summary>
        /// <param name="filterClause"></param>
        /// <param name="filterText"></param>
        /// <param name="selectionType"></param>
        /// <returns></returns>
        public IndicatorInfo GetIndicatorInfo(FilterFieldType filterClause, string filterText, FieldSelection selectionType)
        {
            string        Query  = string.Empty;
            IndicatorInfo RetVal = new IndicatorInfo();
            DataTable     IndicatorTable;

            try
            {
                //get indicator information
                Query          = this.DBQueries.Indicators.GetIndicator(filterClause, filterText, selectionType);
                IndicatorTable = this.DBConnection.ExecuteDataTable(Query);

                //set indicator info
                if (IndicatorTable != null)
                {
                    if (IndicatorTable.Rows.Count > 0)
                    {
                        RetVal.GID    = IndicatorTable.Rows[0][Indicator.IndicatorGId].ToString();
                        RetVal.Global = Convert.ToBoolean(IndicatorTable.Rows[0][Indicator.IndicatorGlobal]);
                        RetVal.Name   = IndicatorTable.Rows[0][Indicator.IndicatorName].ToString();
                        RetVal.Nid    = Convert.ToInt32(IndicatorTable.Rows[0][Indicator.IndicatorNId]);
                        if (selectionType == FieldSelection.Heavy)
                        {
                            RetVal.Info = IndicatorTable.Rows[0][Indicator.IndicatorInfo].ToString();
                        }
                    }
                }
            }
            catch (Exception)
            {
                RetVal = null;
            }
            return(RetVal);
        }
コード例 #5
0
        public int ImportIndicator(string indicatorName, string indicatorGID, bool isGlobal, bool highIsGood)
        {
            int           RetVal           = 0;
            IndicatorInfo IndicatorInfoObj = null;
            IndicatorInfo TrgIndicatorInfo = null;
            string        LangCode         = this.DBQueries.LanguageCode;

            IndicatorInfoObj            = new IndicatorInfo();
            IndicatorInfoObj.Global     = isGlobal;
            IndicatorInfoObj.Name       = indicatorName;
            IndicatorInfoObj.GID        = indicatorGID;
            IndicatorInfoObj.HighIsGood = highIsGood;
            try
            {
                RetVal = this.GetIndicatorNid(indicatorGID, indicatorName);

                if (RetVal > 0)
                {
                    if (!this.DBQueries.LanguageCode.StartsWith("_"))
                    {
                        LangCode = "_" + LangCode;
                    }

                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Light);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & isGlobal == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, LangCode, indicatorName, indicatorGID, isGlobal, TrgIndicatorInfo.Info, RetVal, IndicatorInfoObj.HighIsGood));
                    }
                }
                else
                {
                    if (this.InsertIntoDatabase(IndicatorInfoObj))
                    {
                        //get nid
                        RetVal = Convert.ToInt32(this.DBConnection.ExecuteScalarSqlQuery("SELECT @@IDENTITY"));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(RetVal);
        }
コード例 #6
0
        /// <summary>
        /// To check existance of Indicator first into collection then into database
        /// </summary>
        /// <param name="indicatorRecord">object of IndicatorInfo</param>
        /// <returns>Indicator Nid</returns>
        public int CheckIndicatorExists(IndicatorInfo indicatorInfo)
        {
            int RetVal = 0;

            //Step 1: check source exists in source collection
            RetVal = this.CheckIndicatorInCollection(indicatorInfo.Name);

            //Step 2: check indicator exists in database.
            if (RetVal <= 0)
            {
                RetVal = this.GetIndicatorNid(indicatorInfo.GID, indicatorInfo.Name);
            }

            return RetVal;
        }
コード例 #7
0
        /// <summary>
        /// To check existance of Indicator first into collection then into database
        /// </summary>
        /// <param name="indicatorRecord">object of IndicatorInfo</param>
        /// <returns>Indicator Nid</returns>
        public int CheckIndicatorExists(IndicatorInfo indicatorInfo)
        {
            int RetVal = 0;

            //Step 1: check source exists in source collection
            RetVal = this.CheckIndicatorInCollection(indicatorInfo.Name);

            //Step 2: check indicator exists in database.
            if (RetVal <= 0)
            {
                RetVal = this.GetIndicatorNid(indicatorInfo.GID, indicatorInfo.Name);
            }

            return(RetVal);
        }
コード例 #8
0
        /// <summary>
        /// Insert Indicator record into database
        /// </summary>
        /// <param name="indicatorInfo">object of IndicatorInfo</param>
        /// <returns>Ture/False. Return true after successful insertion otherwise false</returns>
        private bool InsertIntoDatabase(IndicatorInfo indicatorInfo)
        {
            bool   RetVal               = false;
            string IndicatorName        = indicatorInfo.Name;
            string IndicatorGId         = Guid.NewGuid().ToString();
            string LanguageCode         = string.Empty;
            string DefaultLanguageCode  = string.Empty;
            string IndicatorForDatabase = string.Empty;

            try
            {
                DefaultLanguageCode = this.DBQueries.LanguageCode;

                //replace GID only if given gid is not empty or null.
                if (!string.IsNullOrEmpty(indicatorInfo.GID))
                {
                    IndicatorGId = indicatorInfo.GID;
                }

                foreach (DataRow languageRow in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows)
                {
                    LanguageCode = languageRow[Language.LanguageCode].ToString();
                    if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty))
                    {
                        IndicatorForDatabase = IndicatorName;
                    }
                    else
                    {
                        IndicatorForDatabase = Constants.PrefixForNewValue + IndicatorName;
                    }
                    //--
                    indicatorInfo.Info = DICommon.CheckNConvertMetadataXml(indicatorInfo.Info);

                    this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Insert.InsertIndicator(this.DBQueries.DataPrefix, "_" + LanguageCode, IndicatorForDatabase, IndicatorGId, indicatorInfo.Info, indicatorInfo.Global, indicatorInfo.HighIsGood, this.DBConnection.ConnectionStringParameters.ServerType));
                }

                RetVal = true;
            }
            catch (Exception)
            {
                RetVal = false;
            }

            return(RetVal);
        }
コード例 #9
0
 public int ImportIndicatorMetadata(IndicatorInfo indicatorInfo, int NidInSourceDB, DIQueries sourceQurey, DIConnection sourceDBConnection)
 {
     return(this.ImportIndicator(indicatorInfo, NidInSourceDB, sourceQurey, sourceDBConnection, false));
 }
コード例 #10
0
        private int GetElementNId(string excelFilePath, MetaDataType elementType, int elementNameRowIndex)
        {
            int RetVal = 0;
            string ElementName = string.Empty;
            string ElementGId = string.Empty;
            SpreadsheetGear.IWorksheet MetadataSheet;
            IndicatorBuilder IndBuilder = null;
            IndicatorInfo IndInfo = new IndicatorInfo();
            DataTable Table = null;
            int GIdRowIndex = elementNameRowIndex + 1;
            //-- Open excel File and get first worksheet
            DIExcel DiExcel = new DIExcel(excelFilePath);
            MetadataSheet = DiExcel.GetWorksheet(0);
            //-- Get Element GId
            ElementGId = DiExcel.GetCellValue(ElementSheetIndex, GIdRowIndex, ElementGIdColumnIndex, GIdRowIndex, ElementGIdColumnIndex);
            //-- Get Element Name
            ElementName = DiExcel.GetCellValue(ElementSheetIndex, elementNameRowIndex, ElementNameColumnIndex, elementNameRowIndex, ElementNameColumnIndex);

            //-- Get GId By Name if GID is blank in Excel File
            if (!string.IsNullOrEmpty(ElementGId) || !string.IsNullOrEmpty(ElementName))
            {
                switch (elementType)
                {
                    case MetaDataType.Indicator:
                        IndBuilder = new IndicatorBuilder(this.DBConnection, this.DBQueries);
                        RetVal = IndBuilder.GetIndicatorNid(ElementGId, ElementName);

                        break;
                    case MetaDataType.Map:
                        Table = this.DBConnection.ExecuteDataTable(this.DBQueries.Area.GetAreaMapMetadataByName(string.IsNullOrEmpty(ElementGId) ? ElementName : ElementGId));
                        if (Table.Rows.Count > 0)
                        {
                            RetVal = Convert.ToInt32(Table.Rows[0][Area_Map_Metadata.LayerNId]);
                        }
                        break;
                    case MetaDataType.Source:
                    case MetaDataType.Sector:
                    case MetaDataType.Goal:
                    case MetaDataType.CF:
                    case MetaDataType.Theme:
                    case MetaDataType.Institution:
                    case MetaDataType.Convention:
                    case MetaDataType.IndicatorClassification:
                        Table = this.DBConnection.ExecuteDataTable(this.DBQueries.IndicatorClassification.GetIC(FilterFieldType.GId, "'" + ElementGId + "'", FieldSelection.Heavy));
                        if (Table.Rows.Count > 0)
                        {
                            RetVal = Convert.ToInt32(Table.Rows[0][IndicatorClassifications.ICNId]);
                        }
                        break;
                    default:
                        break;
                }
            }

            return RetVal;
        }
コード例 #11
0
ファイル: IUSBuilder.cs プロジェクト: SDRC-India/sdrcdevinfo
        /// <summary>
        /// Returns instance of IUSInfo.
        /// </summary>
        /// <param name="filterClause"></param>
        /// <param name="filterText"></param>
        /// <param name="selectionType"></param>
        /// <returns></returns>
        public IUSInfo GetIUSInfo(FilterFieldType filterClause, string filterText, FieldSelection selectionType)
        {
            string Query = string.Empty;

            IUSInfo RetVal = new IUSInfo();
            IndicatorInfo IndicatorObject = new IndicatorInfo();
            UnitInfo UnitObject = new UnitInfo();
            IndicatorBuilder IndicatorBuilderObj = null;
            UnitBuilder UnitBuilderObj = null;
            DI6SubgroupValBuilder SubgroupValBuilderObj = null;
            DI6SubgroupValInfo SubgroupValObject = new DI6SubgroupValInfo();

            int IndicatorNid = 0;
            int UnitNid = 0;
            int SGNid = 0;
            int MinVal = 0;
            int MaxVal = 0;
            DataTable Table = null;
            try
            {

                //get IUS information
                Query = this.DBQueries.IUS.GetIUS(filterClause, filterText, selectionType);
                Table = this.DBConnection.ExecuteDataTable(Query);

                //set IUS info
                if (Table != null)
                {
                    if (Table.Rows.Count > 0)
                    {
                        MinVal = 0;
                        MaxVal = 0;

                        // initialize builder objects
                        IndicatorBuilderObj = new IndicatorBuilder(this.DBConnection, this.DBQueries);
                        UnitBuilderObj = new UnitBuilder(this.DBConnection, this.DBQueries);
                        SubgroupValBuilderObj = new DI6SubgroupValBuilder(this.DBConnection, this.DBQueries);

                        // set IUS properties
                        //-- set maximum value
                        if (!string.IsNullOrEmpty(Convert.ToString(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue])))
                        {
                            MaxVal = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue]);
                        }
                        //-- Set Minmum Value
                        if (!string.IsNullOrEmpty(Convert.ToString(Table.Rows[0][Indicator_Unit_Subgroup.MinValue])))
                        {
                            MinVal = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MinValue]);
                        }

                        RetVal.Maximum = MaxVal;    // Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue]);
                        RetVal.Minimum = MinVal;    // Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MinValue]);

                        RetVal.Nid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.IUSNId]);

                        // set indicator, unit and subgroup info
                        IndicatorNid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.IndicatorNId]);
                        UnitNid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.UnitNId]);
                        SGNid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.SubgroupValNId]);

                        RetVal.IndicatorInfo = IndicatorBuilderObj.GetIndicatorInfo(FilterFieldType.NId, IndicatorNid.ToString(), FieldSelection.Light);
                        RetVal.UnitInfo = UnitBuilderObj.GetUnitInfo(FilterFieldType.NId, UnitNid.ToString());
                        RetVal.SubgroupValInfo = SubgroupValBuilderObj.GetSubgroupValInfo(FilterFieldType.NId, SGNid.ToString());

                    }
                }
            }
            catch (Exception)
            {
                RetVal = null;
            }

            return RetVal;
        }
コード例 #12
0
ファイル: IUSInfo.cs プロジェクト: SDRC-India/sdrcdevinfo
 public IUSInfo()
 {
     this._IndicatorInfo = new IndicatorInfo();
     this._UnitInfo = new UnitInfo();
     this._SubgroupValInfo = new DI6SubgroupValInfo();
 }
コード例 #13
0
        /// <summary>
        /// Insert Indicator record into database
        /// </summary>
        /// <param name="indicatorInfo">object of IndicatorInfo</param>
        /// <returns>Ture/False. Return true after successful insertion otherwise false</returns>
        private bool InsertIntoDatabase(IndicatorInfo indicatorInfo)
        {
            bool RetVal = false;
            string IndicatorName = indicatorInfo.Name;
            string IndicatorGId = Guid.NewGuid().ToString();
            string LanguageCode = string.Empty;
            string DefaultLanguageCode = string.Empty;
            string IndicatorForDatabase = string.Empty;

            try
            {
                DefaultLanguageCode = this.DBQueries.LanguageCode;

                //replace GID only if given gid is not empty or null.
                if (!string.IsNullOrEmpty(indicatorInfo.GID))
                {
                    IndicatorGId = indicatorInfo.GID;
                }

                foreach (DataRow languageRow in this.DBConnection.DILanguages(this.DBQueries.DataPrefix).Rows)
                {

                    LanguageCode = languageRow[Language.LanguageCode].ToString();
                    if (LanguageCode == DefaultLanguageCode.Replace("_", String.Empty))
                    {
                        IndicatorForDatabase = IndicatorName;
                    }
                    else
                    {
                        IndicatorForDatabase = Constants.PrefixForNewValue + IndicatorName;

                    }
                    //--
                    indicatorInfo.Info = DICommon.CheckNConvertMetadataXml(indicatorInfo.Info);

                    this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Insert.InsertIndicator(this.DBQueries.DataPrefix, "_" + LanguageCode, IndicatorForDatabase, IndicatorGId, indicatorInfo.Info, indicatorInfo.Global, indicatorInfo.HighIsGood, this.DBConnection.ConnectionStringParameters.ServerType));
                }

                RetVal = true;
            }
            catch (Exception)
            {
                RetVal = false;
            }

            return RetVal;
        }
コード例 #14
0
ファイル: DITemplate.cs プロジェクト: SDRC-India/sdrcdevinfo
        /// <summary>
        /// DevInfo_5_0 Indicator Spreadsheet (should have 2 columns only staring the value from 6th Row - Indicator,Indicator_GId)
        /// </summary>
        /// <param name="templateFileName"></param>
        /// <param name="xlsFilenames"></param>
        /// <param name="tempFolderPath"></param>
        /// <returns></returns>
        public bool CreateTemplateFrmIndicatorSpreadsheet(string templateFileName, List<string> xlsFilenames, string tempFolderPath, DIQueries trgQueries, string languageName)
        {
            bool RetVal = false;
            DIConnection DBConnection = null;
            DIQueries DBQueries;
            IndicatorBuilder IndicatorBuilderObj;
            DIDatabase TempTemplateFile;
            string DataPrefix = string.Empty;
            string LanguageCode = string.Empty;

            try
            {
                //create temp template file
                TempTemplateFile = new DIDatabase(templateFileName);
                TempTemplateFile.Dispose();

                //create DIConnection, queries and indicator objects
                DBConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, templateFileName, string.Empty, string.Empty);

                if (trgQueries == null)
                {
                    DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), DBConnection.DILanguageCodeDefault(DBConnection.DIDataSetDefault()));
                }
                else
                {
                    DBQueries = new DIQueries(DBConnection.DIDataSetDefault(), trgQueries.LanguageCode);
                    DataPrefix = DBQueries.DataPrefix;
                    LanguageCode = trgQueries.LanguageCode.Replace("_", "");

                    this.UpdateTablesForTargetLanguage(languageName, DBConnection, DBQueries, DataPrefix, LanguageCode);
                }

                IndicatorBuilderObj = new IndicatorBuilder(DBConnection, DBQueries);

                //get indicators from excel files
                foreach (string XlsFileName in xlsFilenames)
                {
                    try
                    {
                        // insert indicators into template
                        DIExcel IndicatorXlsFile = new DIExcel(XlsFileName);
                        IndicatorInfo NewIndicator;
                        DataTable TempTable = IndicatorXlsFile.GetDataTableFromSheet(IndicatorXlsFile.GetSheetName(0));
                        //check it is a valid indicator excel file or not
                        if (TempTable.Rows.Count > 5 & TempTable.Columns.Count > 1)
                        {
                            if (TempTable.Rows[2][0].ToString() == DITemplate.IndicatorString)
                            {
                                //starting index should be 5
                                for (int i = 5; i < TempTable.Rows.Count; i++)
                                {
                                    NewIndicator = new IndicatorInfo();

                                    //indicator Name
                                    NewIndicator.Name = DICommon.RemoveQuotes(TempTable.Rows[i][0].ToString());
                                    //indicator GId
                                    NewIndicator.GID = DICommon.RemoveQuotes(TempTable.Rows[i][1].ToString());
                                    //insert indicator into template
                                    IndicatorBuilderObj.CheckNCreateIndicator(NewIndicator);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
                RetVal = true;

            }
            catch (Exception ex)
            {
                RetVal = false;
                throw new ApplicationException(ex.ToString());
            }
            finally
            {
                if (DBConnection != null)
                {
                    DBConnection.Dispose();
                }
            }
            return RetVal;
        }
コード例 #15
0
        /// <summary>
        /// Returns instance of IUSInfo.
        /// </summary>
        /// <param name="filterClause"></param>
        /// <param name="filterText"></param>
        /// <param name="selectionType"></param>
        /// <returns></returns>
        public IUSInfo GetIUSInfo(FilterFieldType filterClause, string filterText, FieldSelection selectionType)
        {
            string Query = string.Empty;

            IUSInfo               RetVal                = new IUSInfo();
            IndicatorInfo         IndicatorObject       = new IndicatorInfo();
            UnitInfo              UnitObject            = new UnitInfo();
            IndicatorBuilder      IndicatorBuilderObj   = null;
            UnitBuilder           UnitBuilderObj        = null;
            DI6SubgroupValBuilder SubgroupValBuilderObj = null;
            DI6SubgroupValInfo    SubgroupValObject     = new DI6SubgroupValInfo();

            int       IndicatorNid = 0;
            int       UnitNid      = 0;
            int       SGNid        = 0;
            int       MinVal       = 0;
            int       MaxVal       = 0;
            DataTable Table        = null;

            try
            {
                //get IUS information
                Query = this.DBQueries.IUS.GetIUS(filterClause, filterText, selectionType);
                Table = this.DBConnection.ExecuteDataTable(Query);

                //set IUS info
                if (Table != null)
                {
                    if (Table.Rows.Count > 0)
                    {
                        MinVal = 0;
                        MaxVal = 0;

                        // initialize builder objects
                        IndicatorBuilderObj   = new IndicatorBuilder(this.DBConnection, this.DBQueries);
                        UnitBuilderObj        = new UnitBuilder(this.DBConnection, this.DBQueries);
                        SubgroupValBuilderObj = new DI6SubgroupValBuilder(this.DBConnection, this.DBQueries);

                        // set IUS properties
                        //-- set maximum value
                        if (!string.IsNullOrEmpty(Convert.ToString(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue])))
                        {
                            MaxVal = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue]);
                        }
                        //-- Set Minmum Value
                        if (!string.IsNullOrEmpty(Convert.ToString(Table.Rows[0][Indicator_Unit_Subgroup.MinValue])))
                        {
                            MinVal = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MinValue]);
                        }

                        RetVal.Maximum = MaxVal;    // Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MaxValue]);
                        RetVal.Minimum = MinVal;    // Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.MinValue]);

                        RetVal.Nid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.IUSNId]);

                        // set indicator, unit and subgroup info
                        IndicatorNid = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.IndicatorNId]);
                        UnitNid      = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.UnitNId]);
                        SGNid        = Convert.ToInt32(Table.Rows[0][Indicator_Unit_Subgroup.SubgroupValNId]);

                        RetVal.IndicatorInfo   = IndicatorBuilderObj.GetIndicatorInfo(FilterFieldType.NId, IndicatorNid.ToString(), FieldSelection.Light);
                        RetVal.UnitInfo        = UnitBuilderObj.GetUnitInfo(FilterFieldType.NId, UnitNid.ToString());
                        RetVal.SubgroupValInfo = SubgroupValBuilderObj.GetSubgroupValInfo(FilterFieldType.NId, SGNid.ToString());
                    }
                }
            }
            catch (Exception)
            {
                RetVal = null;
            }

            return(RetVal);
        }
コード例 #16
0
        /// <summary>
        /// To import indicator information from mapped indicator
        /// </summary>
        /// <param name="indicatorInfo"></param>
        /// <param name="NidInSourceDB"></param>
        /// <param name="NidInTrgDB"></param>
        /// <param name="sourceQurey"></param>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public int ImportIndicatorFrmMappedIndicator(IndicatorInfo indicatorInfo, int NidInSourceDB, int NidInTrgDB, DIQueries sourceQurey, DIConnection sourceDBConnection)
        {
            int RetVal = -1;
            string metadataInfo = string.Empty;
            string SqlString = string.Empty;
            DataRow Row;
            DataTable TempTable;
            Dictionary<String, String> OldIconNId_NewIconNId = new Dictionary<string, string>();
            MetaDataBuilder MetaDataBuilderObj;
            IndicatorInfo TrgIndicatorInfo;

            try
            {
                // set RetVal to targetNID
                RetVal = NidInTrgDB;

                if (RetVal > 0)
                {
                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Light);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & indicatorInfo.Global == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, indicatorInfo.Name, indicatorInfo.GID, indicatorInfo.Global, indicatorInfo.Info, RetVal));
                    }

                }

                //update/insert icon
                DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.Indicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);

                OldIconNId_NewIconNId = DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.MetadataIndicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);

                // get metadata info.
                metadataInfo = indicatorInfo.Info;

                // Update IconNids in xml if exists
                foreach (string OldIconName in OldIconNId_NewIconNId.Keys)
                {
                    metadataInfo = metadataInfo.Replace(OldIconName, OldIconNId_NewIconNId[OldIconName].ToString());
                }

                metadataInfo = DICommon.CheckNConvertMetadataXml(metadataInfo);
                // Update Metadata
                this.DBConnection.ExecuteNonQuery(DALQueries.Indicator.Update.UpdateIndicatorInfo(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, DICommon.RemoveQuotes(metadataInfo), FilterFieldType.GId, indicatorInfo.GID));

                // -- insert records in xslt tables

                SqlString = sourceQurey.Xslt.GetXSLT(NidInSourceDB.ToString(), MetadataElementType.Indicator);
                TempTable = sourceDBConnection.ExecuteDataTable(SqlString);

                if (TempTable.Rows.Count > 0)
                {
                    Row = TempTable.Rows[0];
                    MetaDataBuilderObj = new MetaDataBuilder(this.DBConnection, this.DBQueries);
                    MetaDataBuilderObj.ImportTransformInfo(Row[XSLT.XSLTText].ToString(), Row[XSLT.XSLTFile].ToString(), RetVal.ToString(), MetadataElementType.Indicator);
                }

            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return RetVal;
        }
コード例 #17
0
        /// <summary>
        /// To import indicator information from mapped indicator
        /// </summary>
        /// <param name="indicatorInfo"></param>
        /// <param name="NidInSourceDB"></param>
        /// <param name="NidInTrgDB"></param>
        /// <param name="sourceQurey"></param>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public int ImportIndicatorFrmMappedIndicator(IndicatorInfo indicatorInfo, int NidInSourceDB, int NidInTrgDB, DIQueries sourceQurey, DIConnection sourceDBConnection)
        {
            int       RetVal       = -1;
            string    metadataInfo = string.Empty;
            string    SqlString    = string.Empty;
            DataRow   Row;
            DataTable TempTable;
            Dictionary <String, String> OldIconNId_NewIconNId = new Dictionary <string, string>();
            MetaDataBuilder             MetaDataBuilderObj;
            IndicatorInfo TrgIndicatorInfo;

            try
            {
                // set RetVal to targetNID
                RetVal = NidInTrgDB;

                if (RetVal > 0)
                {
                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Light);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & indicatorInfo.Global == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, indicatorInfo.Name, indicatorInfo.GID, indicatorInfo.Global, indicatorInfo.Info, RetVal));
                    }
                }


                //update/insert icon
                DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.Indicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);

                OldIconNId_NewIconNId = DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.MetadataIndicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);

                // get metadata info.
                metadataInfo = indicatorInfo.Info;

                // Update IconNids in xml if exists
                foreach (string OldIconName in OldIconNId_NewIconNId.Keys)
                {
                    metadataInfo = metadataInfo.Replace(OldIconName, OldIconNId_NewIconNId[OldIconName].ToString());
                }

                metadataInfo = DICommon.CheckNConvertMetadataXml(metadataInfo);
                // Update Metadata
                this.DBConnection.ExecuteNonQuery(DALQueries.Indicator.Update.UpdateIndicatorInfo(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, DICommon.RemoveQuotes(metadataInfo), FilterFieldType.GId, indicatorInfo.GID));


                // -- insert records in xslt tables

                SqlString = sourceQurey.Xslt.GetXSLT(NidInSourceDB.ToString(), MetadataElementType.Indicator);
                TempTable = sourceDBConnection.ExecuteDataTable(SqlString);


                if (TempTable.Rows.Count > 0)
                {
                    Row = TempTable.Rows[0];
                    MetaDataBuilderObj = new MetaDataBuilder(this.DBConnection, this.DBQueries);
                    MetaDataBuilderObj.ImportTransformInfo(Row[XSLT.XSLTText].ToString(), Row[XSLT.XSLTFile].ToString(), RetVal.ToString(), MetadataElementType.Indicator);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(RetVal);
        }
コード例 #18
0
        public int ImportIndicator(string indicatorName, string indicatorGID, bool isGlobal, bool highIsGood)
        {
            int RetVal = 0;
            IndicatorInfo IndicatorInfoObj = null;
            IndicatorInfo TrgIndicatorInfo = null;
            string LangCode = this.DBQueries.LanguageCode;

            IndicatorInfoObj = new IndicatorInfo();
            IndicatorInfoObj.Global = isGlobal;
            IndicatorInfoObj.Name = indicatorName;
            IndicatorInfoObj.GID = indicatorGID;
            IndicatorInfoObj.HighIsGood = highIsGood;
            try
            {

                RetVal = this.GetIndicatorNid(indicatorGID, indicatorName);

                if (RetVal > 0)
                {
                    if (!this.DBQueries.LanguageCode.StartsWith("_"))
                    {
                        LangCode = "_" + LangCode;
                    }

                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Light);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & isGlobal == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, LangCode, indicatorName, indicatorGID, isGlobal, TrgIndicatorInfo.Info, RetVal, IndicatorInfoObj.HighIsGood));
                    }
                }
                else
                {
                    if (this.InsertIntoDatabase(IndicatorInfoObj))
                    {
                        //get nid
                        RetVal = Convert.ToInt32(this.DBConnection.ExecuteScalarSqlQuery("SELECT @@IDENTITY"));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return RetVal;
        }
コード例 #19
0
        /// <summary>
        /// To import indicator into template or database
        /// </summary>
        /// <param name="indicatorInfo"></param>
        /// <param name="NidInSourceDB"></param>
        /// <param name="sourceQurey"></param>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public int ImportIndicator(IndicatorInfo sourceIndicatorInfo, int NidInSourceDB, DIQueries sourceQurey, DIConnection sourceDBConnection, bool importIndicatorInfoAlso)
        {
            int RetVal = -1;
            string metadataInfo = string.Empty;
            string SqlString = string.Empty;
            DataRow Row;
            DataTable TempTable;
            //Dictionary<String, String> OldIconNId_NewIconNId = new Dictionary<string, string>();
            //MetaDataBuilder MetaDataBuilderObj;
            DI7MetaDataBuilder MetadataBuilderObj = null;
            IndicatorInfo TrgIndicatorInfo;

            try
            {
                //check Indicator already exists in database or not

                RetVal = this.GetIndicatorNid(sourceIndicatorInfo.GID, sourceIndicatorInfo.Name);

                if (RetVal > 0)
                {
                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Heavy);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & sourceIndicatorInfo.Global == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        sourceIndicatorInfo.Info = DICommon.CheckNConvertMetadataXml(sourceIndicatorInfo.Info);
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, sourceIndicatorInfo.Name, sourceIndicatorInfo.GID, sourceIndicatorInfo.Global, sourceIndicatorInfo.Info, RetVal, sourceIndicatorInfo.HighIsGood));
                    }

                }
                else if (importIndicatorInfoAlso)
                {
                    if (this.InsertIntoDatabase(sourceIndicatorInfo))
                    {
                        //get nid
                        RetVal = Convert.ToInt32(this.DBConnection.ExecuteScalarSqlQuery("SELECT @@IDENTITY"));
                    }
                }

                if (RetVal > 0)
                {
                    //update/insert icon
                    DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.Indicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);

                    // import metadata
                    MetadataBuilderObj = new DI7MetaDataBuilder(this.DBConnection, this.DBQueries);
                    MetadataBuilderObj.ImportMetadata(sourceDBConnection, sourceQurey, NidInSourceDB, RetVal, MetadataElementType.Indicator, MetaDataType.Indicator, IconElementType.MetadataIndicator);

                    //////// -- insert records in xslt tables
                    //////SqlString = sourceQurey.Xslt.GetXSLT(NidInSourceDB.ToString(), MetadataElementType.Indicator);
                    //////TempTable = sourceDBConnection.ExecuteDataTable(SqlString);

                    //////if (TempTable.Rows.Count > 0)
                    //////{
                    //////    Row = TempTable.Rows[0];
                    //////    MetaDataBuilderObj = new MetaDataBuilder(this.DBConnection, this.DBQueries);
                    //////    MetaDataBuilderObj.ImportTransformInfo(Row[XSLT.XSLTText].ToString(), Row[XSLT.XSLTFile].ToString(), RetVal.ToString(), MetadataElementType.Indicator);
                    //////}
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return RetVal;
        }
コード例 #20
0
        /// <summary>
        /// Returns instance of IndicatorInfo.
        /// </summary>
        /// <param name="filterClause"></param>
        /// <param name="filterText"></param>
        /// <param name="selectionType"></param>
        /// <returns></returns>
        public IndicatorInfo GetIndicatorInfo(FilterFieldType filterClause, string filterText, FieldSelection selectionType)
        {
            string Query = string.Empty;
            IndicatorInfo RetVal = new IndicatorInfo();
            DataTable IndicatorTable;
            try
            {
                //get indicator information
                Query = this.DBQueries.Indicators.GetIndicator(filterClause, filterText, selectionType);
                IndicatorTable = this.DBConnection.ExecuteDataTable(Query);

                //set indicator info
                if (IndicatorTable != null)
                {
                    if (IndicatorTable.Rows.Count > 0)
                    {
                        RetVal.GID = IndicatorTable.Rows[0][Indicator.IndicatorGId].ToString();
                        RetVal.Global = Convert.ToBoolean(IndicatorTable.Rows[0][Indicator.IndicatorGlobal]);
                        RetVal.Name = IndicatorTable.Rows[0][Indicator.IndicatorName].ToString();
                        RetVal.Nid = Convert.ToInt32(IndicatorTable.Rows[0][Indicator.IndicatorNId]);
                        if (selectionType == FieldSelection.Heavy)
                        {
                            RetVal.Info = IndicatorTable.Rows[0][Indicator.IndicatorInfo].ToString();
                        }
                    }
                }
            }
            catch (Exception)
            {
                RetVal = null;
            }
            return RetVal;
        }
コード例 #21
0
        private string GetElementInfo(MetaDataType elementType, string elementGId)
        {
            string RetVal = string.Empty;
            IndicatorBuilder IndBuilder = null;
            IndicatorInfo IndInfo = new IndicatorInfo();
            DataTable Table = null;

            elementGId = DICommon.RemoveQuotes(elementGId);
            try
            {

                switch (elementType)
                {
                    case MetaDataType.Indicator:
                        IndBuilder = new IndicatorBuilder(this.DBConnection, this.DBQueries);
                        IndInfo = IndBuilder.GetIndicatorInfo(FilterFieldType.GId, "'" + elementGId + "'", FieldSelection.Heavy);
                        RetVal = IndInfo.Info;
                        break;
                    case MetaDataType.Map:
                        Table = this.DBConnection.ExecuteDataTable(this.DBQueries.Area.GetAreaMapMetadataByName(elementGId));
                        RetVal = Convert.ToString(Table.Rows[0][Area_Map_Metadata.MetadataText]);
                        break;
                    case MetaDataType.Source:
                    case MetaDataType.Sector:
                    case MetaDataType.Goal:
                    case MetaDataType.CF:
                    case MetaDataType.Theme:
                    case MetaDataType.Institution:
                    case MetaDataType.Convention:
                    case MetaDataType.IndicatorClassification:
                        Table = this.DBConnection.ExecuteDataTable(this.DBQueries.IndicatorClassification.GetIC(FilterFieldType.GId, "'" + elementGId + "'", FieldSelection.Heavy));
                        RetVal = Convert.ToString(Table.Rows[0][IndicatorClassifications.ICInfo]);
                        break;
                    default:
                        break;
                }

            }
            catch (Exception)
            {
            }
            return RetVal;
        }
コード例 #22
0
        /// <summary>
        /// Imports indicator metadata from template/database
        /// </summary>
        /// <param name="dataPrefix"></param>
        /// <param name="sourceDBConnection"></param>
        /// <param name="sourceDBQueries"></param>
        /// <param name="selectedNIDs"></param>
        /// <param name="selectionCount"></param>
        /// <param name="metadataType"></param>
        public void ImportIndicatorMetadata(string dataPrefix, DIConnection sourceDBConnection, DIQueries sourceDBQueries, string selectedNIDs, int selectionCount, MetaDataType metadataType)
        {
            DataTable TempDataTable;
            int       CurrentRecordIndex = 0;
            DI7MetadataCategoryBuilder MetadataCategoryBuilderObj;
            IndicatorInfo    SourceIndicatorInfo = new IndicatorInfo();
            IndicatorBuilder IndBuilder          = null;

            try
            {
                this.RaiseStartProcessEvent();
                IndBuilder = new IndicatorBuilder(this.DBConnection, this.DBQueries);

                // 1. import metadta categories
                // import indicator metadata categories
                MetadataCategoryBuilderObj = new DI7MetadataCategoryBuilder(this.DBConnection, this.DBQueries);
                MetadataCategoryBuilderObj.ImportAllMetadataCategories(sourceDBConnection, sourceDBQueries, MetadataElementType.Indicator);


                // 2. Imort metadata reports
                if (selectionCount == -1)
                {
                    // -- GET ALL
                    TempDataTable = sourceDBConnection.ExecuteDataTable(sourceDBQueries.Indicators.GetIndicator(FilterFieldType.None, string.Empty, FieldSelection.Heavy));
                }
                else
                {
                    // -- GET SELECTED
                    TempDataTable = sourceDBConnection.ExecuteDataTable(sourceDBQueries.Indicators.GetIndicator(FilterFieldType.NId, selectedNIDs, FieldSelection.Heavy));
                }


                //////// -- Initialize Progress Bar
                this.RaiseBeforeProcessEvent(TempDataTable.Rows.Count);
                foreach (DataRow Row in TempDataTable.Rows)
                {
                    CurrentRecordIndex++;

                    // get source indicator info
                    SourceIndicatorInfo        = new IndicatorInfo();
                    SourceIndicatorInfo.Nid    = Convert.ToInt32(Row[Indicator.IndicatorNId]);
                    SourceIndicatorInfo.GID    = Convert.ToString(Row[Indicator.IndicatorGId]);
                    SourceIndicatorInfo.Name   = Convert.ToString(Row[Indicator.IndicatorName]);
                    SourceIndicatorInfo.Global = Convert.ToBoolean(Row[Indicator.IndicatorGlobal]);

                    //import metadata
                    IndBuilder.ImportIndicatorMetadata(SourceIndicatorInfo, SourceIndicatorInfo.Nid, sourceDBQueries, sourceDBConnection);

                    // -- Increemnt the Progress Bar Value
                    this.RaiseProcessInfoEvent(CurrentRecordIndex);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
            finally
            {
                this.RaiseEndProcessEvent();
            }
        }
コード例 #23
0
        /// <summary>
        /// To import indicator into template or database
        /// </summary>
        /// <param name="indicatorInfo"></param>
        /// <param name="NidInSourceDB"></param>
        /// <param name="sourceQurey"></param>
        /// <param name="sourceDBConnection"></param>
        /// <returns></returns>
        public int ImportIndicator(IndicatorInfo sourceIndicatorInfo, int NidInSourceDB, DIQueries sourceQurey, DIConnection sourceDBConnection, bool importIndicatorInfoAlso)
        {
            int       RetVal       = -1;
            string    metadataInfo = string.Empty;
            string    SqlString    = string.Empty;
            DataRow   Row;
            DataTable TempTable;
            //Dictionary<String, String> OldIconNId_NewIconNId = new Dictionary<string, string>();
            //MetaDataBuilder MetaDataBuilderObj;
            DI7MetaDataBuilder MetadataBuilderObj = null;
            IndicatorInfo      TrgIndicatorInfo;

            try
            {
                //check Indicator already exists in database or not

                RetVal = this.GetIndicatorNid(sourceIndicatorInfo.GID, sourceIndicatorInfo.Name);

                if (RetVal > 0)
                {
                    TrgIndicatorInfo = this.GetIndicatorInfo(FilterFieldType.NId, RetVal.ToString(), FieldSelection.Heavy);

                    // dont import if trg indicator is global but source indicator is local
                    if (TrgIndicatorInfo.Global & sourceIndicatorInfo.Global == false)
                    {
                        // dont import if trg indicator is global but source indicator is local
                    }
                    else
                    {
                        sourceIndicatorInfo.Info = DICommon.CheckNConvertMetadataXml(sourceIndicatorInfo.Info);
                        //update the gid,name and global on the basis of nid
                        this.DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.Indicator.Update.UpdateByNid(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode, sourceIndicatorInfo.Name, sourceIndicatorInfo.GID, sourceIndicatorInfo.Global, sourceIndicatorInfo.Info, RetVal, sourceIndicatorInfo.HighIsGood));
                    }
                }
                else if (importIndicatorInfoAlso)
                {
                    if (this.InsertIntoDatabase(sourceIndicatorInfo))
                    {
                        //get nid
                        RetVal = Convert.ToInt32(this.DBConnection.ExecuteScalarSqlQuery("SELECT @@IDENTITY"));
                    }
                }

                if (RetVal > 0)
                {
                    //update/insert icon
                    DIIcons.ImportElement(NidInSourceDB, RetVal, IconElementType.Indicator, sourceQurey, sourceDBConnection, this.DBQueries, this.DBConnection);


                    // import metadata
                    MetadataBuilderObj = new DI7MetaDataBuilder(this.DBConnection, this.DBQueries);
                    MetadataBuilderObj.ImportMetadata(sourceDBConnection, sourceQurey, NidInSourceDB, RetVal, MetadataElementType.Indicator, MetaDataType.Indicator, IconElementType.MetadataIndicator);

                    //////// -- insert records in xslt tables
                    //////SqlString = sourceQurey.Xslt.GetXSLT(NidInSourceDB.ToString(), MetadataElementType.Indicator);
                    //////TempTable = sourceDBConnection.ExecuteDataTable(SqlString);


                    //////if (TempTable.Rows.Count > 0)
                    //////{
                    //////    Row = TempTable.Rows[0];
                    //////    MetaDataBuilderObj = new MetaDataBuilder(this.DBConnection, this.DBQueries);
                    //////    MetaDataBuilderObj.ImportTransformInfo(Row[XSLT.XSLTText].ToString(), Row[XSLT.XSLTFile].ToString(), RetVal.ToString(), MetadataElementType.Indicator);
                    //////}
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(RetVal);
        }
コード例 #24
0
        private IndicatorInfo GetIndicatorInfo(DataRow row)
        {
            IndicatorInfo RetVal;

            try
            {
                //get unit from source table
                RetVal = new IndicatorInfo();
                RetVal.Name = DICommon.RemoveQuotes(row[Indicator.IndicatorName].ToString());
                RetVal.GID = row[Indicator.IndicatorGId].ToString();
                RetVal.Global = Convert.ToBoolean(row[Indicator.IndicatorGlobal]);
                RetVal.Info = DICommon.RemoveQuotes(Convert.ToString(row[Indicator.IndicatorInfo]));
                RetVal.Nid = Convert.ToInt32(row[Indicator.IndicatorNId]);
            }
            catch (Exception ex)
            {
                RetVal = null;
                ExceptionFacade.ThrowException(ex);
            }
            return RetVal;
        }
コード例 #25
0
 public int ImportIndicatorMetadata(IndicatorInfo indicatorInfo, int NidInSourceDB, DIQueries sourceQurey, DIConnection sourceDBConnection)
 {
     return this.ImportIndicator(indicatorInfo, NidInSourceDB, sourceQurey, sourceDBConnection, false);
 }
コード例 #26
0
 /// <summary>
 ///To add indicatorInfo into collection 
 /// </summary>
 /// <param name="indicatorRecord">object of IndicatorInfo</param>
 private void AddIndicatorIntoCollection(IndicatorInfo indicatorInfo)
 {
     if (!this.IndicatorCollection.ContainsKey(indicatorInfo.Name))
     {
         this.IndicatorCollection.Add(indicatorInfo.Name, indicatorInfo);
     }
 }
コード例 #27
0
 public IUSInfo()
 {
     this._IndicatorInfo   = new IndicatorInfo();
     this._UnitInfo        = new UnitInfo();
     this._SubgroupValInfo = new DI6SubgroupValInfo();
 }
コード例 #28
0
        /// <summary>
        /// Imports indicator metadata from template/database
        /// </summary>
        /// <param name="dataPrefix"></param>
        /// <param name="sourceDBConnection"></param>
        /// <param name="sourceDBQueries"></param>
        /// <param name="selectedNIDs"></param>
        /// <param name="selectionCount"></param>
        /// <param name="metadataType"></param>
        public void ImportIndicatorMetadata(string dataPrefix, DIConnection sourceDBConnection, DIQueries sourceDBQueries, string selectedNIDs, int selectionCount, MetaDataType metadataType)
        {
            DataTable TempDataTable;
            int CurrentRecordIndex = 0;
            DI7MetadataCategoryBuilder MetadataCategoryBuilderObj;
            IndicatorInfo SourceIndicatorInfo = new IndicatorInfo();
            IndicatorBuilder IndBuilder = null;

            try
            {
                this.RaiseStartProcessEvent();
                IndBuilder = new IndicatorBuilder(this.DBConnection, this.DBQueries);

                // 1. import metadta categories
                // import indicator metadata categories
                MetadataCategoryBuilderObj = new DI7MetadataCategoryBuilder(this.DBConnection, this.DBQueries);
                MetadataCategoryBuilderObj.ImportAllMetadataCategories(sourceDBConnection, sourceDBQueries, MetadataElementType.Indicator);

                // 2. Imort metadata reports
                if (selectionCount == -1)
                {
                    // -- GET ALL
                    TempDataTable = sourceDBConnection.ExecuteDataTable(sourceDBQueries.Indicators.GetIndicator(FilterFieldType.None, string.Empty, FieldSelection.Heavy));
                }
                else
                {
                    // -- GET SELECTED
                    TempDataTable = sourceDBConnection.ExecuteDataTable(sourceDBQueries.Indicators.GetIndicator(FilterFieldType.NId, selectedNIDs, FieldSelection.Heavy));
                }

                //////// -- Initialize Progress Bar
                this.RaiseBeforeProcessEvent(TempDataTable.Rows.Count);
                foreach (DataRow Row in TempDataTable.Rows)
                {
                    CurrentRecordIndex++;

                    // get source indicator info
                    SourceIndicatorInfo = new IndicatorInfo();
                    SourceIndicatorInfo.Nid = Convert.ToInt32(Row[Indicator.IndicatorNId]);
                    SourceIndicatorInfo.GID = Convert.ToString(Row[Indicator.IndicatorGId]);
                    SourceIndicatorInfo.Name = Convert.ToString(Row[Indicator.IndicatorName]);
                    SourceIndicatorInfo.Global = Convert.ToBoolean(Row[Indicator.IndicatorGlobal]);

                    //import metadata
                    IndBuilder.ImportIndicatorMetadata(SourceIndicatorInfo, SourceIndicatorInfo.Nid, sourceDBQueries, sourceDBConnection);

                    // -- Increemnt the Progress Bar Value
                    this.RaiseProcessInfoEvent(CurrentRecordIndex);

                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
            finally
            {
                this.RaiseEndProcessEvent();
            }
        }