}//END UpdateTokenUserProfile method // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Public class Methods // ================================================================================== /// <summary> /// This method returns the application data object to be processed by the client. /// </summary> /// <param name="PageCommand">ClientPageCommand object: containing the groupCommand that /// is called on web service</param> /// <returns>ClientApplicationData</returns> // ---------------------------------------------------------------------------------- public AppData getPageObject ( Command PageCommand ) { this.LogMethod ( "getPageObject method, " ); this.LogValue ( "NewUser: "******"PageCommand: " + PageCommand.getAsString ( false, false ) ); try { this._CommandHistory.DebugOn = this.DebugOn; // If the user is new and there is a non home page groupCommand // execute that groupCommand. // if ( this._NewUser == true ) { this.LogDebug ( "new user retreiving the last command" ); List<Evado.UniForm.Model.Parameter> header = PageCommand.Header; Command lastCommand = this._CommandHistory.getLastCommand ( ); this.LogValue ( "last command: " + lastCommand.Title ); if ( lastCommand.Id != Guid.Empty && lastCommand.Object != Evado.Digital.Adapter.EuAdapterClasses.Home_Page.ToString ( ) ) { this.LogValue ( "Executing the last command" ); PageCommand = lastCommand; PageCommand.Header = header; } }//END new user getting the last history command. this.LogValue ( "AFTER NEW USER: PageCommand: " + PageCommand.getAsString ( false, false ) ); // // Initialise the methods variables and objects. // this._ErrorMessage = String.Empty; this.LogValue ( "Short Title: " + PageCommand.GetParameter ( CommandParameters.Short_Title ) ); // // Set the groupCommand to a short title to it can be added to the groupCommand history. // PageCommand.setShortTitle ( ); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #region Save and Delete processes. // // If the method is to update a value then we need to undertake process processing after // the method has been processed to return the user to the exit page. if ( PageCommand.Method == ApplicationMethods.Delete_Object || PageCommand.Method == ApplicationMethods.Save_Object ) { this.LogMethod ( "SAVE OR DELETE METHODS." ); // // The save process returns a empty data object with the exit groupCommand. // Retrieve the groupCommand and direct the user to that page. // this._ClientDataObject = this.getObjectData ( PageCommand ); this.LogValue ( "Application.ID: " + this._ClientDataObject.Id + ", Page.Id: " + this._ClientDataObject.Page.Id ); if ( this._ClientDataObject.Message != String.Empty ) { this.LogValue ( "Error output" ); this.LogValue ( "AppDataObject.Message: " + this._ClientDataObject.Message ); return this._ClientDataObject; } // // Get the list page groupCommand as the default exit groupCommand. // this._ExitCommand = this._CommandHistory.getExitCommand ( PageCommand ); this.LogValue ( "Save ExitCommand: " + this._ExitCommand.getAsString ( false, false ) ); // // Set the page groupCommand to the saved objects exit groupCommand. To call the correct exit page. // PageCommand = this._ExitCommand; this.LogValue ( "OK: next page command: " + PageCommand.getAsString ( false, false ) ); // // out the error message to be added to the returning data object. // this._ErrorMessage = this._ClientDataObject.Message; this.LogValue ( "ErrorMessage: " + this._ErrorMessage ); this.LogMethod ( "END SAVE OR DELETE METHODS." ); }//END process save or delete object commands. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion // this.LogMethod ( "GET LIST, GET OR CREATE METHOD" ); // // Get the list page groupCommand as the default exit groupCommand. // this._ExitCommand = this._CommandHistory.getExitCommand ( PageCommand ); //this.LogDebug ( this._CommandHistory.Log ); //this.LogDebug ( "Final List: \r\n" + this._CommandHistory.listCommandHistory ( true ) ); this.LogValue ( "ExitCommand: " + this._ExitCommand.getAsString ( false, false ) ); // // get the data objec using the current page groupCommand. // this._ClientDataObject = this.getObjectData ( PageCommand ); this._ErrorMessage = this._ClientDataObject.Message; this.LogValue ( "RETURNED: ErrorMessage: " + this._ErrorMessage ); // // An empty Guid indicates a error has occured and return to the home page. // if ( this._ClientDataObject.Id == Guid.Empty ) { return getDefaultPage ( PageCommand ); } } catch ( Exception Ex ) { EvApplicationEvents.LogError ( this._EventLogSource, Evado.Model.EvStatics.getException ( Ex ) ); this.LogValue ( "Evado.UniForm.IntegrationServices.getPageObject method." ); this.LogValue ( "Exception Event. " + Evado.Model.EvStatics.getException ( Ex ) ); } this.LogValue ( "EXIT INTEGRATION SERVICE CLASS " ); // // Return the client data object to the client. // return this._ClientDataObject; }//END getPageObject Method
}//END getPageObject Method //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Private class methods // ================================================================================== /// <summary> /// This method selects the application object to be be processed. /// </summary> /// <param name="PageCommand">ClientPageCommand object: containing the groupCommand that /// is called on web service</param> /// <returns>ClientApplicationData</returns> // ---------------------------------------------------------------------------------- private AppData getObjectData ( Command PageCommand ) { this.LogMethod ( "getDataObject method. " ); this.LogValue ( "ClientVersion: " + this._ClientVersion ); this.LogValue ( "PageCommand " + PageCommand.getAsString ( false, false ) ); this.LogValue ( "Exit Command: " + this._ExitCommand.getAsString ( false, false ) ); // // Initialise the methods variables and objects. // AppData clientDataObject = new AppData ( ); try { // // Initialise the Evado clinical adapter object. // this._ApplicationAdapter = new Evado.Digital.Adapter.EuAdapter ( this._ClientVersion, this._GlobalObjects, this._ServiceUserProfile, this._ExitCommand, this._ApplicationPath, this._UniForm_BinaryFilePath, this._UniForm_BinaryServiceUrl ); this._ApplicationAdapter.LoggingLevel = this.LoggingLevel; this.LogValue ( "ApplicationAdapter.LoggingLevel: " + this._ApplicationAdapter.LoggingLevel ); this.LogValue ( "PageCommand.Method: " + PageCommand.Method ); // // if the page is a custom groupCommand reset it to the customcommang parameter if it not null // if ( PageCommand.Method == ApplicationMethods.Custom_Method && PageCommand.getCustomMethod ( ) != ApplicationMethods.Null ) { PageCommand.Method = PageCommand.getCustomMethod ( ); this.LogValue ( "ApplicationMethod reset to " + PageCommand.Method.ToString ( ) ); } // // If not found create a new object and add it to the list then return it. // switch ( PageCommand.ApplicationId ) { case Evado.Digital.Adapter.EuAdapter.ADAPTER_ID: { this.LogValue ( "SELECTING APPLICATION AppId: '" + PageCommand.ApplicationId + "'" + " >> CALLING ECLINICAL APPLICATION" ); // // Call the get page method to generate the next page. // clientDataObject = this._ApplicationAdapter.getPageObject ( PageCommand ); if ( this._ErrorMessage != String.Empty ) { clientDataObject.Message = this._ErrorMessage; } this._GlobalObjects = this._ApplicationAdapter.GlobalObjectList; this.LogApplication ( this._ApplicationAdapter.AdapterLog ); this.LogValue ( "IntegrationServices.GlobalObject count: " + this._GlobalObjects.Count ); this.LogValue ( "RETURN APPLICATION DATA OBJECT " ); this.LogValue ( " - ID: " + clientDataObject.Id ); this.LogValue ( " - Title: " + clientDataObject.Title ); if ( clientDataObject.Page.Exit != null ) { this.LogValue ( " - ExitCommand: " + clientDataObject.Page.Exit.getAsString ( false, false ) ); } this.LogValue ( " - Message: " + clientDataObject.Message ); // // Return the instance to the list.initialisation method // return clientDataObject; } default: { this.LogValue ( ">> GETTING DEFAULT PAGE. " ); // // get the default page // return this.getDefaultPage ( PageCommand ); } } } catch ( Exception Ex ) { EvApplicationEvents.LogError ( this._EventLogSource, Evado.Model.EvStatics.getException ( Ex ) ); this._ErrorMessage = "UniFORM service application error."; } return getDefaultPage ( PageCommand ); }//END CallApplicationObject Method
} //END CloseAlert method #endregion #region Static method: Raise alert method. // ===================================================================================== /// <summary> /// This class raises items on the Alert ResultData object. /// </summary> /// <param name="ProjectId">string: A Project identifier</param> /// <param name="OrgId">string: an organization identifier</param> /// <param name="RecordId">string: A Record identifier</param> /// <param name="Message">string: An alert's message</param> /// <param name="FromUserName">string: a user name whose alert is sent from</param> /// <param name="ToUserName">string: a user name whose alert is sent to</param> /// <param name="TypeId">EvAlert.AlertTypes: An alert QueryType</param> /// <returns>EvEventCodes: an event code for raising items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Update the FirstSubject's value based on the RecordTypeId. /// /// 2. Set the Alert object's values and execute the method for adding Alert object's values to database. /// /// 3. Return the event code for raising items. /// </remarks> // ------------------------------------------------------------------------------------- public static EvEventCodes RaiseAlert( String ProjectId, String OrgId, String RecordId, String Message, String FromUserName, String ToUserName, EvAlert.AlertTypes TypeId) { // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; Evado.Dal.Digital.EvAlerts dalProjectAlerts = new Evado.Dal.Digital.EvAlerts( ); EvAlert alert = new EvAlert( ); string subject = String.Empty; // // Update the milestone's values based on the RecordTypeId. // switch (TypeId) { case EvAlert.AlertTypes.Trial_Record: { subject = String.Format( EvLabels.Alert_Data_Record_Alert_Message, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Adverse_Event_Report: { subject = String.Format( EvLabels.Alert_Adverse_Event_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Serious_Adverse_Event_Report: { subject = String.Format( EvLabels.Alert_Serious_Adverse_Event_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Concomitant_Medication: { subject = String.Format( EvLabels.Alert_Concomitant_Medication_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Subject_Record: { subject = String.Format( EvLabels.Alert_Subject_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } } // // Update the Alert object's values. // alert.ProjectId = ProjectId; alert.ToOrgId = OrgId; alert.RecordId = RecordId; alert.Subject = subject; alert.NewMessage = Message; alert.UserCommonName = FromUserName; alert.ToUser = ToUserName; alert.FromUser = FromUserName; alert.Action = EvAlert.AlertSaveActionCodes.Raise_Alert; alert.TypeId = TypeId; // // Add the Alert object's values to the database // iReturn = dalProjectAlerts.addItem(alert); EvApplicationEvent applicationEvent = new EvApplicationEvent( EvApplicationEvent.EventType.Action, EvEventCodes.Ok, "Evado.Bll.Clinical.EvAlerts", dalProjectAlerts.Status, FromUserName); EvApplicationEvents.NewEvent(applicationEvent); return(iReturn); }//END RaiseAlert method