コード例 #1
0
        /// <summary>
        /// Load the deserialize XML text
        /// </summary>
        /// <param name="SerializeText"></param>
        /// <returns></returns>
        public static GraphPresentation LoadFromSerializeText(string SerializeText, string languageFilePath, string maskFolderPath, string outputFolderPath)
        {
            GraphPresentation RetVal;
            Boolean IsInitilized = false;
            DIDataView objDIDataView;
            DIConnection objDIConnection;
            DIQueries objDIQueries;

            UserPreference.UserPreference objUserPreference;
            try
            {
                XmlSerializer GraphSerialize = new XmlSerializer(typeof(GraphPresentation));
                MemoryStream MemoryStream = new MemoryStream(StringToUTF8ByteArray(SerializeText));
                XmlTextWriter xmlTextWriter = new XmlTextWriter(MemoryStream, Encoding.UTF8);
                RetVal = (GraphPresentation)GraphSerialize.Deserialize(MemoryStream);

                // Set the Essential Properties
                if (RetVal.TablePresentation.UserPreference.General.ShowExcel)
                {
                    RetVal.TablePresentation.PresentationOutputType = PresentationOutputType.ExcellSheet;
                }
                else
                {
                    RetVal.TablePresentation.PresentationOutputType = PresentationOutputType.MHT;
                }
                if (RetVal != null)
                {
                    objUserPreference = RetVal.TablePresentation.UserPreference;
                    //TODO: Remove hardcoding
                    maskFolderPath = Path.Combine(objUserPreference.General.AdaptationPath, @"Bin\Templates\Metadata\Mask");
                    objDIConnection = new DIConnection(objUserPreference.Database.SelectedConnectionDetail);

                    objDIQueries = new DIQueries(objUserPreference.Database.SelectedDatasetPrefix, objUserPreference.Database.DatabaseLanguage);

                    //-- TODO remove hardcoded

                    objDIDataView = new DevInfo.Lib.DI_LibBAL.UI.DataViewPage.DIDataView(objUserPreference, objDIConnection, objDIQueries, maskFolderPath, string.Empty);
                    objDIDataView.GetAllDataByUserSelection();

                    IsInitilized = RetVal.IntializeGraphPresentation(objDIConnection, objDIQueries, string.Empty, objDIDataView);
                    if (!IsInitilized)
                    {
                        RetVal = null;
                    }
                }
                MemoryStream.Dispose();
            }
            catch (Exception ex)
            {
                RetVal = null;
            }
            return RetVal;
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dIDataView"></param>
        /// <param name="dIConnection"></param>
        /// <param name="dIQueries"></param>
        /// <param name="userPreference"></param>
        /// <param name="outputFolderPath"></param>
        /// <param name="outputType"></param>
        public GraphPresentation(DIDataView dIDataView, DIConnection dIConnection, DIQueries dIQueries, UserPreference.UserPreference userPreference, string outputFolderPath, PresentationOutputType outputType)
        {
            // - Create object of TablePresentation
            this._TablePresentation = new TablePresentation(dIDataView, dIConnection, dIQueries, userPreference, string.Empty);

            // - Set the Presenatation Type
            this._TablePresentation.PresentationType = Presentation.PresentationType.Graph;

            this._TablePresentation.ShowExcel = userPreference.General.ShowExcel;

            // - Initilize the graph appearence oject
            this._GraphAppearence = new StyleTemplate(Presentation.PresentationType.Graph, userPreference.General.ShowExcel);

            if (!userPreference.General.ShowExcel)
            {
                if (outputType == PresentationOutputType.ExcellSheet)
                {
                    this._TablePresentation.PresentationOutputType = PresentationOutputType.ExcellSheet;
                }
                else
                {
                    this._TablePresentation.PresentationOutputType = PresentationOutputType.MHT;
                }

                // Set the user pref.
                this.UserPreference = userPreference;

                this._SpreadsheetGearChartType = GetSpreadsheetChartTypeFromXlChartType(this.UserPreference.Chart.ChartType);

                // Initilize the all the language strings
                this.ApplyLanguageSettings();
            }
        }
コード例 #3
0
 /// <summary>
 /// Update the Table presentation object and grapg datasource
 /// </summary>
 /// <param name="dbConnection"></param>
 /// <param name="dbQueries"></param>
 /// <param name="languageFilePath">Obsolete not in use. May set string.empty for time being</param>
 /// <param name="dbDataView"></param>
 /// <returns></returns>
 /// <remarks>This method is called after calling the load method, only if we have presnetation data</remarks>
 public bool IntializeGraphPresentation(DIConnection dbConnection, DIQueries dbQueries, string languageFilePath, DIDataView dbDataView)
 {
     bool Retval = false;
     try
     {
         Retval = this._TablePresentation.IntializeTablePresentation(dbConnection, dbQueries, string.Empty, dbDataView);
     }
     catch (Exception)
     {
         Retval = false;
     }
     return Retval;
 }
コード例 #4
0
        /// <summary>
        /// Initilize the object for Graph
        /// </summary>
        /// <param name="presentationData">DataView</param>
        /// <param name="DIConnection">DIConnection used in IC Classification of step 3 & its implementation in step 6 and also for footnotes text and comments text in step 6</param>
        /// <param name="DIQueries">DIQueries</param>
        /// <param name="UserSelection">UserSelection2 (New UserSelection)</param>
        /// <remarks>
        /// This class using Table presenation class for generating datasource
        /// </remarks>
        public GraphPresentation(DIDataView dIDataView, DIConnection dIConnection, DIQueries dIQueries, UserPreference.UserPreference userPreference)
        {
            // - Create object of TablePresentation
            this._TablePresentation = new TablePresentation(dIDataView, dIConnection, dIQueries, userPreference, string.Empty);

            // - Set the Presenatation Type
            this._TablePresentation.PresentationType = Presentation.PresentationType.Graph;

            // - Initilize the graph appearence oject
            this._GraphAppearence = new StyleTemplate(Presentation.PresentationType.Graph, userPreference.General.ShowExcel);

            // Set the user pref for internal use
            this.UserPreference = userPreference;

            this._SpreadsheetGearChartType = GetSpreadsheetChartTypeFromXlChartType(this.UserPreference.Chart.ChartType);

            // Initilize the all the language strings
            this.ApplyLanguageSettings();
        }
コード例 #5
0
ファイル: DIExport.cs プロジェクト: SDRC-India/sdrcdevinfo
        /// <summary>
        /// It prepares PresentationData using DIDataView class for specified Userselections.
        /// </summary>
        /// <param name="dBConnection"></param>
        /// <param name="dBQueries"></param>
        /// <param name="userSelection"></param>
        /// <param name="xmlLanguageFileNameWPath"></param>
        /// <returns></returns>
        private static DataView GetPresentationData(DIConnection dBConnection, DIQueries dBQueries, UserSelection userSelection, string xmlLanguageFileNameWPath)
        {
            DataView RetVal = null;

            //Create UserPreference required for DIDataView object.
            UserPreference UserPreference = new UserPreference(xmlLanguageFileNameWPath);

            UserPreference.UserSelection = userSelection;

            // prepare Map's dataview
            DIDataView DIDataView = new DevInfo.Lib.DI_LibBAL.UI.DataViewPage.DIDataView(UserPreference, dBConnection, dBQueries, "", "");
            RetVal = DIDataView.GetAllDataByUserSelection();

            if (RetVal == null)
            {
                RetVal = dBConnection.ExecuteDataTable(dBQueries.Data.GetPresentationData(userSelection, dBConnection.ConnectionStringParameters.ServerType)).DefaultView;
            }

            return RetVal;
        }
コード例 #6
0
ファイル: Map.cs プロジェクト: SDRC-India/sdrcdevinfo
        /// <summary>
        /// It updates the Existing dataView of Map object with new DataView for Drilled Down AreasNIds specified.
        /// </summary>
        private static void MergeDataOfDrilledDownAreas(string areaNIds, string areaIDs, Map map)
        {
            UI.UserPreference.UserPreference UserPreference2 = null;
            UI.DataViewPage.DIDataView DIDataView2 = null;
            DataTable MRDTable = null;
            string areaIDsWithQuotes = string.Empty;

            if (map != null && string.IsNullOrEmpty(areaNIds) == false && string.IsNullOrEmpty(areaIDs) == false)
            {
                //-- Create new UserPreference with new areas but having same IUS, TimePeriod, Source.
                UserPreference2 = (UI.UserPreference.UserPreference)(map._UserPreference.Clone());
                areaIDsWithQuotes = "'" + areaIDs.Replace(",", "','") + "'";
                UserPreference2.UserSelection.AreaIds = areaIDs;
                UserPreference2.UserSelection.AreaNIds = areaNIds;

                //-- Create new DIDataView with new UserPreference.
                DIDataView2 = new DIDataView(UserPreference2, map.DIConnection, map.DIQueries, Path.Combine(map.UserPreference.General.AdaptationPath, @"Bin\Templates\Metadata\Mask"), string.Empty);
                DIDataView2.GetAllDataByUserSelection();

                if (DIDataView2.MainDataTable != null && DIDataView2.MainDataTable.Columns.Count > 0)
                {
                    MRDTable = DIDataView2.GetMostRecentData(false).Table;

                    //-- Merge new DataView with existing Map's DataView
                    map._DIDataView.MainDataTable.Merge(DIDataView2.MainDataTable);

                    //-- Re-assign PresentationData & MRDData
                    map._PresentationData.Table.Merge(DIDataView2.MainDataTable);

                    map.MRDData.Table.Merge(MRDTable);
                }
            }
        }
コード例 #7
0
ファイル: Map.cs プロジェクト: SDRC-India/sdrcdevinfo
        /// <summary>
        ///  Initializes the Map object and setting its properties with the parameters passed. DIConnection + DIQueries (for Database operations)
        /// </summary>
        /// <param name="presentationData">DataView containing Most recent Data</param>
        /// <param name="DIConnection"></param>
        /// <param name="DIQueries"></param>
        /// <param name="UserSelection">UserSelection</param>
        public Map(DIDataView DIDataView, DIConnection DIConnection, DIQueries DIQueries, UserPreference.UserPreference userPreference)
        {
            this._DIDataView = DIDataView;

            //Sets the private variable to connection  object.
            this.DIConnection = DIConnection;

            //Sets the private variable to DiQueries object.
            this.DIQueries = DIQueries;

            //Set the userPreference & userSelection.
            this._UserPreference = userPreference;      // Property is used when deserializing Map object and again re-creating DIDataView.

            //Set Presentation data
            this._PresentationData = DIDataView.GetPresentationData();

            // sets MetaData columns in its properties. (this._MDindicators, this._MDArea, this._MDSource are used in GeneratePresentation() where columns are needed to be displayed in excel sheet)
            this.SetMetadataInfo();
        }
コード例 #8
0
ファイル: Map.cs プロジェクト: SDRC-India/sdrcdevinfo
        public void Dispose()
        {
            //if ((m_QueryBase != null))
            //    m_QueryBase.Dispose();
            try
            {
                //-- Clearing all variable  of Map object

                this.UserPreference.Dispose();
                this._DIDataView = null;
                this._PresentationData.Dispose();
                this._MRDData.Dispose();
                this.m_Layers.Clear();
                this.m_Themes.Clear();
                this.m_Insets.Clear();
                this.m_CFLCol.Clear();

            }
            catch
            {

            }
        }