/// <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; }
/// <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; }
/// <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(); } }
/// <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(); }
/// <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(); }
/// <summary> /// Constructor for DIDataView builds up the primary information for getting paged data /// </summary> /// <param name="userPreference"></param> /// <param name="dIConnection"></param> /// <param name="dIQueries"></param> /// <param name="maskFolder">Path of Mask Folder where mask files for Indicator, Area and Source metadata resides. Constants for mask file name are available within this class</param> /// <param name="languageFilePath">Path of language file, used to set language based column captions</param> public DIDataView(UserPreference.UserPreference userPreference, DI_LibDAL.Connection.DIConnection dIConnection, DI_LibDAL.Queries.DIQueries dIQueries, string maskFolder, string commentsDataNIds) { string _Query = string.Empty; string[] DistinctColumns = new string[1]; // -- Connection details preserved for getting IUSSource (recommended source) later on demand this.mdIConnection = dIConnection; this.mdIQueries = dIQueries; this.mUserPreference = userPreference; this.mUserPreference.UserSelection.UserSelectionChangeEvent += UserSelectionChanged; // Mask folder for Metadata this.msMaskFolder = maskFolder; this._PagingCompleted = false; #region STEP 1: Get DataNIDs for the selected Indicator, Time and Area and Build the Master Tables // -- STEP 1: Get DataNIDs for the selected Indicator, Time and Area // -- STEP 1.1 - Build Query for the Data View - This query will return only the DataNIds on the basis of the selected I, A and T // Query for Data NIDs //We have to get data for records which are marked as deleted and still to be displayed at Data page if (string.IsNullOrEmpty(commentsDataNIds)) { _Query = dIQueries.Data.GetDataNIDByIUSTimePeriodAreaSource(userPreference.UserSelection, dIConnection.ConnectionStringParameters.ServerType, ""); } else { _Query = dIQueries.Data.GetDataNIDByIUSTimePeriodAreaSource(userPreference.UserSelection, dIConnection.ConnectionStringParameters.ServerType, commentsDataNIds); } // -- STEP 1.2: Execute the Query // -- This Data Table will have all the DataNIDs and wil be used in other operations to fetch data DataTable dtData = this.ExecuteInvariantDataTable(_Query); // -- STEP 1.3: Inititalize Data Tables InitializeVariables(); // -- STEP 1.4: Creating the Data Tables for // DataNID, IUSNId and IUS_SourceNId (These Datatables will be used in the DataView Page to fill the Data, Source, Unit and Subgroup Lists) // Indicator (master table based on IUSNId) // Unit (master table based on IUSNId) // Subgroup (master table based on IUSNId) // Source (master table based on IUS_SourceNId) if (dtData != null && dtData.Rows.Count > 0) { // Distinct DataNId DistinctColumns[0] = DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.DataNId; this._AllDataNIDs = dtData.DefaultView.ToTable(false, DistinctColumns); this._FilteredDataNIds = this._AllDataNIDs.Copy(); StringBuilder sbDataNIDs = new StringBuilder(); for (int i = 0; i < this._AllDataNIDs.Rows.Count; i++) { sbDataNIDs.Append("," + this._AllDataNIDs.Rows[i][Data.DataNId]); } if (sbDataNIDs.Length > 0) { msAllDataNIDs = sbDataNIDs.ToString().Substring(1); } // Distinct IUSNID DistinctColumns[0] = DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.IUSNId; DataTable dtIUSNIDs = GetInvariantDataTable(); dtIUSNIDs = dtData.DefaultView.ToTable(true, DistinctColumns); StringBuilder sbIUSNIDs = new StringBuilder(); this._IUSNIds = string.Empty; for (int i = 0; i < dtIUSNIDs.Rows.Count; i++) { sbIUSNIDs.Append("," + dtIUSNIDs.Rows[i][Data.IUSNId]); } if (sbIUSNIDs.Length > 0) { this._IUSNIds = sbIUSNIDs.ToString().Substring(1); } // Distinct AreaNIds DistinctColumns[0] = Data.AreaNId; DataTable dtAreaNIds = GetInvariantDataTable(); dtAreaNIds = dtData.DefaultView.ToTable(true, DistinctColumns); StringBuilder sbAreaNIds = new StringBuilder(); this._AreaNIds = string.Empty; for (int i = 0; i < dtAreaNIds.Rows.Count; i++) { sbAreaNIds.Append("," + dtAreaNIds.Rows[i][Data.AreaNId]); } if (sbAreaNIds.Length > 0) { this._AreaNIds = sbAreaNIds.ToString().Substring(1); } // Distinct TimePeriodNIds DistinctColumns[0] = Data.TimePeriodNId; DataTable dtTimePeriodNIds = GetInvariantDataTable(); dtTimePeriodNIds = dtData.DefaultView.ToTable(true, DistinctColumns); StringBuilder sbTimePeriodNIds = new StringBuilder(); this._TimePeriodNIds = string.Empty; for (int i = 0; i < dtTimePeriodNIds.Rows.Count; i++) { sbTimePeriodNIds.Append("," + dtTimePeriodNIds.Rows[i][Data.TimePeriodNId]); } if (sbTimePeriodNIds.Length > 0) { this._TimePeriodNIds = sbTimePeriodNIds.ToString().Substring(1); } // Distinct SourceNIDs string[] SourceDistinctColumns = new string[2]; SourceDistinctColumns[0] = DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.IUSNId; SourceDistinctColumns[1] = DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.SourceNId; this.mdtIUSSourceNIDs = dtData.DefaultView.ToTable(true, SourceDistinctColumns); // Build IUSIndicator table this.BuildIUSIndicator(dIConnection, dIQueries); // Build IUSUnit table this.BuildIUSUnit(dIConnection, dIQueries); // Build IUSSubgroup this.BuildIUSSubgroup(dIConnection, dIQueries); // Build Source this.BuildSource(dIConnection, dIQueries); //Build IUSSource this.GetIUSSource(dIConnection, dIQueries); // BuildMetadataTables this.BuildMetadataTables(userPreference, dIConnection, dIQueries); // BuildIUSICInfoTables this.BuildIUSICInfoTable(userPreference, dIConnection, dIQueries, dtIUSNIDs); // Set Paging Info SetPagingInfo(this._AllDataNIDs.Rows.Count); } #endregion }