Пример #1
0
        }//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.

        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #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
Пример #3
0
        }// Close GetIssuedItem method

        #endregion

        #region Update form object methods

        // ===================================================================================
        /// <summary>
        /// This class saves items to form ResultData table
        /// </summary>
        /// <param name="Layout">EvForm: a form object</param>
        /// <returns>EvEventCodes: an event code for saving items</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Exit, if the UserCommonName or VisitId or FormId is empty.
        ///
        /// 2. Execute the method for deleting items, if the action code is delete
        ///
        /// 3. Execute the method for adding items, if the form Uid is empty.
        ///
        /// 4. Else, execute the method for updating items
        ///
        /// 5. Return an event code of the method execution.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvEventCodes SaveItem(EdRecord Layout)
        {
            this.LogMethod("saveForm method.");
            this.LogValue("Action: " + Layout.SaveAction);
            //
            // Initialise the local variables
            //
            EdRecords      records    = new EdRecords(this.ClassParameters);
            EdRecordFields formFields = new EdRecordFields(this.ClassParameters);
            EvEventCodes   iReturn    = EvEventCodes.Ok;

            if (Layout.LayoutId == String.Empty)
            {
                this.LogValue("Empty FormId");
                return(EvEventCodes.Identifier_Form_Id_Error);
            }

            //
            // If the Action is DELETE and the state is draft.
            //
            if (Layout.SaveAction == EdRecord.SaveActionCodes.Layout_Deleted &&
                Layout.State == EdRecordObjectStates.Form_Draft)
            {
                iReturn = this._Dal_RecordLayouts.DeleteItem(Layout);
                if (iReturn != EvEventCodes.Ok)
                {
                    return(iReturn);
                }

                //
                // Withdraw the TestReport items associated with this TestReport.
                //
                iReturn = formFields.DeleteFields(Layout);
                return(iReturn);
            }

            //
            // Update the form state based on the form object Action property.
            //
            this.updateState(Layout);
            this.LogValue("Form State: " + Layout.State);

            //
            // If the trial is in use and not being re-issued then it cannot be withdrawn.
            //
            //  Check if trial has been used.  If so return an error.
            //
            if (Layout.State == EdRecordObjectStates.Withdrawn)
            {
            }//END trial state is withdrawn.

            //
            // If the unique identifier is null then add this object as a new
            // form object.
            //
            this.LogValue("Save Form to Database.");

            if (Layout.Guid == Guid.Empty) // Add new form
            {
                this.LogValue("Add Form to database");

                //
                // Add the trial to the database.
                //
                iReturn = this._Dal_RecordLayouts.AddItem(Layout);
                this.LogClass(this._Dal_RecordLayouts.Log);

                //
                // Return the DAL DebugLog.
                //
                return(iReturn);
            }//END Add new trial.

            //
            // If the trial being approved then withdraw the pervious issues trial
            //
            if (Layout.SaveAction == EdRecord.SaveActionCodes.Layout_Approved)
            {
                this.LogValue("Withdraw the form");

                //
                // Update the trial to withdraw is from use.
                //
                iReturn = this._Dal_RecordLayouts.WithdrawIssuedForm(Layout);
                this.LogClass(this._Dal_RecordLayouts.Log);
            }

            //
            // Update the trial object.
            //
            this.LogValue("Update Form ");

            //
            // Update the trial int the database.
            //
            iReturn = this._Dal_RecordLayouts.UpdateItem(Layout);
            this.LogClass(this._Dal_RecordLayouts.Log);

            //
            // Return the DAL DebugLog.
            //
            return(iReturn);
        }//END SaveItem method