}//END getRecordList method. // ===================================================================================== /// <summary> /// This class returns a list of form objects. /// </summary> /// <param name="QueryParameters">EvQueryParameters: a query parameters object</param> /// <returns>List of EvForm: a list of form objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the list of form objects. /// /// 2. Return the list of form objects. /// </remarks> // ---------------------------------------------------------------------------------- public List<EdRecord> getRecordList ( EdQueryParameters QueryParameters ) { this.LogMethod ( "getRecordList " ); this.LogDebug ( "EvQueryParameters parameters." ); this.LogValue ( "- FormId: " + QueryParameters.LayoutId ); this.LogValue ( "- IncludeRecordFields: " + QueryParameters.IncludeRecordValues ); this.LogValue ( "- States.Count: " + QueryParameters.States.Count ); this.LogValue ( "- NotSelectedState: " + QueryParameters.NotSelectedState ); if ( QueryParameters.States != null ) { foreach ( EdRecordObjectStates state in QueryParameters.States ) { this.LogValue ( "- State: " + state ); } } // // Execute the query. // List<EdRecord> view = this._DalRecords.getRecordList ( QueryParameters ); this.LogClass ( this._DalRecords.Log ); this.LogMethodEnd ( "getRecordList" ); // // Return selectionList to UI // return view; }//END getRecordList method.
// ===================================================================================== /// <summary> /// This class returns a list of form objects. /// </summary> /// <param name="QueryParameters">EvQueryParameters: a query parameters object</param> /// <returns>List of EvForm: a list of form objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the list of form objects. /// /// 2. Return the list of form objects. /// </remarks> // ---------------------------------------------------------------------------------- public int geyEntityCount ( EdQueryParameters QueryParameters ) { this.LogMethod ( "geyEntityCount" ); this.LogValue ( "EdQueryParameters parameters." ); this.LogValue ( "- FormId: " + QueryParameters.LayoutId ); this.LogValue ( "- IncludeRecordFields: " + QueryParameters.IncludeRecordValues ); this.LogValue ( "- States.Count: " + QueryParameters.States.Count ); this.LogValue ( "- NotSelectedState: " + QueryParameters.NotSelectedState ); this.LogValue ( "- RecordRangeStart: " + QueryParameters.ResultStartRange ); this.LogValue ( "- RecordRangeFinish: " + QueryParameters.ResultFinishRange ); // // Execute the query. // int inResultCount = this._DalEntities.getRecordCount ( QueryParameters ); this.LogClass ( this._DalEntities.Log ); this.LogMethodEnd ( "geyEntityCount" ); // // Return selectionList to UI // return inResultCount; }//END getRecordList method.
}//END getRecordList method. // ===================================================================================== /// <summary> /// This class returns a list of option for selected form objects based on query object and ByUid condition. /// </summary> /// <param name="Query">EvQueryParameters: a query parameter object</param> /// <param name="ByUid">Boolean: true, if the list is selected by Uid</param> /// <returns>List of EvOption: a list of option objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the list of option objects based on query object and ByUid condition. /// /// 2. Return the list of option objects. /// </remarks> // ------------------------------------------------------------------------------------- public List<EvOption> getOptionList ( EdQueryParameters Query, bool ByUid ) { this.LogMethod ( "getOptionList" ); List<EvOption> List = this._DalRecords.getOptionList ( Query, ByUid ); this.LogClass ( this._DalRecords.Log ); return List; }//END GetList method.
}//END getEntityList method. // ===================================================================================== /// <summary> /// This class returns a list of option for selected form objects based on query object and ByUid condition. /// </summary> /// <param name="QueryParameters">EvQueryParameters: a query parameter object</param> /// <param name="UseGuid">Boolean: true, if the list is selected by Uid</param> /// <returns>List of EvOption: a list of option objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the list of option objects based on query object and ByUid condition. /// /// 2. Return the list of option objects. /// </remarks> // ------------------------------------------------------------------------------------- public List<EvOption> GetOptionList ( EdQueryParameters QueryParameters, bool UseGuid ) { this.LogMethod ( "getOptionList" ); List<EvOption> List = this._DalEntities.getOptionList ( QueryParameters, UseGuid ); this.LogClass ( this._DalEntities.Log ); this.LogMethodEnd ( "getOptionList" ); return List; }//END GetList method.
}//END GetUserList class // ================================================================================== /// <summary> /// This class returns a list of record options objects. /// </summary> /// <param name="ApplicationId">string: a Project identifier</param> /// <param name="SubjectId">string: a FirstSubject identifier</param> /// <returns>List of EvOption: a list of record options objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving a list of record objects /// /// 2. Return the list of record objects. /// </remarks> // ---------------------------------------------------------------------------------- private List <EvOption> GetRecordList(string EntityId) { // // Initialise the method variables and objects. // EdRecords trialRecords = new EdRecords( ); EdQueryParameters query = new EdQueryParameters( ); query.EntityId = EntityId; List <EvOption> list = trialRecords.getOptionList(query, true); this._DebugLog.AppendLine(trialRecords.Log); return(list); }//END GetRecordList class.
}//END getRecordList method. // ===================================================================================== /// <summary> /// This class returns a list of form objects. /// </summary> /// <param name="QueryParameters">EvQueryParameters: a query parameters object</param> /// <returns>List of EvForm: a list of form objects</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the list of form objects. /// /// 2. Return the list of form objects. /// </remarks> // ---------------------------------------------------------------------------------- public List<EdRecord> GetEntityList ( EdQueryParameters QueryParameters ) { this.LogMethod ( "GetEntityList" ); this.LogDebug ( "Parameters." ); this.LogValue ( "-LayoutId: " + QueryParameters.LayoutId ); this.LogValue ( "-IncludeRecordValues: " + QueryParameters.IncludeRecordValues ); this.LogValue ( "-States.Count: " + QueryParameters.States.Count ); this.LogValue ( "-ParentType: " + QueryParameters.ParentType ); /* this.LogDebug ( "-ParentUserId: {0}", QueryParameters.ParentUserId ); this.LogDebug ( "-ParentOrgId: {0}", QueryParameters.ParentOrgId ); this.LogDebug ( "-ParentGuid: {0}", QueryParameters.ParentGuid ); this.LogDebug ( "-Org_City: {0}", QueryParameters.Org_City ); this.LogDebug ( "-Org_Country: {0}", QueryParameters.Org_Country ); this.LogValue ( "-NotSelectedState: " + QueryParameters.NotSelectedState ); foreach ( EdRecordObjectStates state in QueryParameters.States ) { this.LogDebug ( "-State: " + state ); } this.LogDebug ( "-NotSelectedState: " + QueryParameters.SelectionFilters.Length ); for ( int i = 0; i < QueryParameters.SelectionFilters.Length; i++ ) { if ( QueryParameters.SelectionFilters [ i ] != null ) { this.LogDebug ( "-Filter: {0} Value: {1}. ", i, QueryParameters.SelectionFilters [ i ] ); } } */ // // Execute the query. // List<EdRecord> entityList = this._DalEntities.getEntityList ( QueryParameters ); this.LogClass ( this._DalEntities.Log ); // // Return selectionList to UI // this.LogMethodEnd ( "GetEntityList" ); return entityList; }//END getRecordList method.
}//End getRecordList method. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region export query record methods // ===================================================================================== /// <summary> /// this method exports the project records a list of csv string objects. /// </summary> /// <param name="ExportParameters">EvExportParameters object, defining the items to exported.</param> /// <param name="UserProfile">EvUserProfile object.</param> /// <returns>List of string where each item is row in a CSv output</returns> // ------------------------------------------------------------------------------------- private String exportProjectRecords( EvExportParameters ExportParameters, Evado.Digital.Model.EdUserProfile UserProfile) { this.LogMethod("exportProjectRecords method. "); // // Initialise the methods objects and variables. // List <EdRecord> recordList = new List <EdRecord> ( ); EdRecords formRecords = new EdRecords(this.ClassParameters); EdQueryParameters queryParameters = new EdQueryParameters( ); // // Set the start and end date filters. // queryParameters.States.Add(EdRecordObjectStates.Withdrawn); queryParameters.States.Add(EdRecordObjectStates.Draft_Record); if (ExportParameters.IncludeDraftRecords == true) { queryParameters.States.Add(EdRecordObjectStates.Withdrawn); } queryParameters.NotSelectedState = true; queryParameters.IncludeRecordValues = true; queryParameters.IncludeSummary = false; queryParameters.LayoutId = ExportParameters.LayoutId; recordList = formRecords.getRecordList(queryParameters); this.LogClass(formRecords.Log); string result = this.createExportFile( recordList, UserProfile, ExportParameters.IncludeFreeTextData, ExportParameters.IncludeDraftRecords); this.LogMethodEnd("exportProjectRecords"); return(result); }//END exportProjectRecords method
}//END getRecordExport_ListObject method // ============================================================================== /// <summary> /// This method creates the record view pageMenuGroup containing a list of commands to /// open the form record. /// </summary> /// <param name="Page">Evado.Model.Uniform.Page object to add the pageMenuGroup to.</param> // ------------------------------------------------------------------------------ private void getRecordExport_DownloadGroup ( Evado.UniForm.Model.Page Page ) { this.LogMethod ( "getRecordExport_DownloadGroup" ); this.LogDebug ( "FormRecords_IncludeFreeTextData: " + this.Session.FormRecords_IncludeFreeTextData ); this.LogDebug ( "FormRecords_IncludeDraftRecords: " + this.Session.FormRecords_IncludeDraftRecords ); // // Initialise the methods variables and objects. // Evado.UniForm.Model.Group pageGroup = new Evado.UniForm.Model.Group ( ); Evado.UniForm.Model.Field groupField = new Evado.UniForm.Model.Field ( ); EvFormRecordExport exportRecords = new EvFormRecordExport ( ); EvExportParameters exportParameters = new EvExportParameters ( ); EdQueryParameters queryParameters = new EdQueryParameters ( ); int exportRecordFileLimit = 250; this.LogDebug ( "exportRecordFileLimit: " + exportRecordFileLimit ); // // IF there are not parameters then exit. // if ( this.Session.Selected_EntityLayoutId == String.Empty ) { this.LogDebug ( " Form {0}. ", this.Session.Selected_EntityLayoutId ); this.LogMethodEnd ( "getRecordExport_DownloadGroup" ); return; } exportParameters = new EvExportParameters ( EvExportParameters.ExportDataSources.Project_Record, this.Session.Selected_EntityLayoutId ); exportParameters.IncludeTestSites = false; exportParameters.IncludeFreeTextData = this.Session.FormRecords_IncludeFreeTextData; exportParameters.IncludeDraftRecords = this.Session.FormRecords_IncludeDraftRecords; queryParameters = new EdQueryParameters ( ); queryParameters.LayoutId = this.Session.Selected_EntityLayoutId; queryParameters.States.Add ( EdRecordObjectStates.Withdrawn ); queryParameters.States.Add ( EdRecordObjectStates.Draft_Record ); queryParameters.States.Add ( EdRecordObjectStates.Empty_Record ); queryParameters.States.Add ( EdRecordObjectStates.Completed_Record ); if ( exportParameters.IncludeDraftRecords == true ) { queryParameters.States.Add ( EdRecordObjectStates.Withdrawn ); } queryParameters.NotSelectedState = true; queryParameters.IncludeSummary = true; queryParameters.IncludeRecordValues = false; queryParameters.IncludeComments = false; // // Create the export ResultData file. // int inResultCount = this._Bll_Entities.geyEntityCount ( queryParameters ); this.LogClass ( this._Bll_Entities.Log ); this.LogDebug ( "inResultCount: " + inResultCount ); // // Create the record display pageMenuGroup. // pageGroup = Page.AddGroup ( EdLabels.Record_Export_Download_Group_Title, Evado.UniForm.Model.EditAccess.Enabled ); pageGroup.CmdLayout = Evado.UniForm.Model.GroupCommandListLayouts.Vertical_Orientation; pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width; if ( inResultCount == 0 ) { LogDebug ( "Record Count is 0." ); pageGroup.Description = EdLabels.Form_Record_Export_Empty_List_Error_Message; this.LogMethodEnd ( "getRecordExport_DownloadGroup" ); return; } // // If the record list is less thant the exportrecord limit output. // if ( inResultCount <= exportRecordFileLimit ) { // // export the ResultData. // this.exportRecordData ( pageGroup, 0, exportParameters, this.Session.Selected_EntityLayoutId ); } else { // // Initialise the output loop parameters. int iRecordRangeStart = 0; int iRecordRangeFinish = exportRecordFileLimit; int iterations = ( inResultCount / exportRecordFileLimit ) + 1; this.LogValue ( "iterations: " + iterations ); for ( int iLoop = 0; iLoop < iterations && iRecordRangeFinish <= inResultCount; iLoop++ ) { // // export the ResultData. // var result = this.exportRecordData ( pageGroup, iLoop, exportParameters, this.Session.Selected_EntityLayoutId ); if ( result != EvEventCodes.Ok ) { this.LogDebug ( "Result {0}.", result ); this.LogMethodEnd ( "getRecordExport_DownloadGroup" ); return; } // // Increment the start and finish for then next loop // iRecordRangeStart = iRecordRangeFinish + 1; if ( ( iRecordRangeFinish + exportRecordFileLimit ) < inResultCount ) { iRecordRangeFinish += exportRecordFileLimit; } else { iRecordRangeFinish = inResultCount; } }//END loop iteration statement. } this.LogMethodEnd ( "getRecordExport_DownloadGroup" ); return; }//END getRecordExport_DownloadGroup method
}//ENd getList_SelectionGroup method // ============================================================================== /// <summary> /// This method executed the form record query of the database. /// </summary> /// <param name="ParentGuid">Guid: parent guid</param> /// <remarks> /// This method returns a list of forms based on the selection type of form record. /// </remarks> // ------------------------------------------------------------------------------ private void executeRecordQuery ( ) { this.LogMethod ( "executeRecordQuery" ); this.LogDebug ( "EntityLayoutIdSelection: " + this.Session.Selected_EntityLayoutId ); this.LogDebug ( "Layout.ParentType : " + this.Session.EntityLayout.Design.ParentType ); this.LogDebug ( "EntityTypeSelection: " + this.Session.EntityTypeSelection ); this.LogDebug ( "EntityStateSelection: " + this.Session.EntityStateSelection ); this.LogDebug ( "ParentGuid: {0}.", this.ParentGuid ); // // Initialise the methods variables and objects. // EdQueryParameters queryParameters = new EdQueryParameters ( ); // // Initialise the query values to the currently selected objects identifiers. // queryParameters.Type = this.Session.EntityTypeSelection; queryParameters.LayoutId = this.Session.Selected_EntityLayoutId; // // pass the entity selection filters to the query. // queryParameters.SelectionFilters = this.Session.EntitySelectionFilters; // // Initialise the query state selection. // queryParameters.States.Add ( EuAdapter.CONST_RECORD_STATE_SELECTION_DEFAULT ); queryParameters.NotSelectedState = true; if ( this.Session.EntityStateSelection != EdRecordObjectStates.Null ) { queryParameters.States.Add ( this.Session.EntityStateSelection ); queryParameters.NotSelectedState = false; } if ( this.EnableAuthorSelection == true ) { queryParameters.AuthorUserId = this.Session.SelectedUserId; } // // set the parent object selection criteria. // queryParameters.ParentType = this.Session.EntityLayout.Design.ParentType; if ( this.Session.EntityLayout.Design.ParentType == EdRecord.ParentTypeList.Organisation ) { queryParameters.ParentOrgId = this.Session.SelectedOrgId; } if ( this.Session.EntityLayout.Design.ParentType == EdRecord.ParentTypeList.User ) { queryParameters.ParentUserId = this.Session.SelectedUserId; } if ( this.Session.EntityLayout.Design.ParentType == EdRecord.ParentTypeList.Entity ) { queryParameters.ParentGuid = this.Session.Entity.Guid; if ( this.ParentGuid != Guid.Empty ) { queryParameters.ParentGuid = this.ParentGuid; } } // // Set the filter critier. // queryParameters.Org_City = this.Session.SelectedCity; queryParameters.Org_Country = this.Session.SelectedCountry; queryParameters.Org_PostCode = this.Session.SelectedPostCode; if ( queryParameters.Org_City != String.Empty || queryParameters.Org_Country != String.Empty || queryParameters.Org_PostCode != String.Empty ) { queryParameters.EnableOrganisationFilter = true; } /* this.LogDebug ( "Selected LayoutId: '" + queryParameters.LayoutId + "'" ); this.LogDebug ( "Selected ParentType: '" + queryParameters.ParentType + "'" ); this.LogDebug ( "Selected ParentGuid: '" + queryParameters.ParentGuid + "'" ); this.LogDebug ( "Selected Org_City: '" + queryParameters.Org_City + "'" ); this.LogDebug ( "Selected Org_Country: '" + queryParameters.Org_Country + "'" ); this.LogDebug ( "Selected Org_PostCode: '" + queryParameters.Org_PostCode + "'" ); */ // // Query the database to retrieve a list of the records matching the query parameter values. // if ( queryParameters.LayoutId != String.Empty ) { this.LogDebug ( "Querying form records" ); this.Session.EntityList = this._Bll_Entities.GetEntityList ( queryParameters ); this.LogDebugClass ( this._Bll_Entities.Log ); } this.LogDebug ( "EntityList.Count: " + this.Session.EntityList.Count ); this.LogMethodEnd ( "executeRecordQuery" ); }//END executeRecordQuery method.