// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Update User methods // ================================================================================== /// <summary> /// THis method saves the ResultData object updating the field values contained in the /// parameter list. /// </summary> /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectEvado.Model.UniForm.Command object.</param> /// <returns>Application Data object</returns> // ---------------------------------------------------------------------------------- private Evado.Model.UniForm.AppData getDataObject_ExitPage ( Evado.Model.UniForm.Command PageCommand ) { this.LogMethod ( "getDataObject_ExitPage" ); this.LogValue ( "Parameter: " + PageCommand.getAsString ( false, false ) ); // // Initialise the methods variables and objects. // Evado.Model.UniForm.AppData clientDataObject = new Model.UniForm.AppData ( ); EvEventCodes result; // // register the user details. // result = this.RegisterUserDetails ( PageCommand ); // // create the registration exit page. clientDataObject = this.GetUserRegistrationExitPage ( result ); this.LogMethodEnd ( "getDataObject_ExitPage" ); return clientDataObject; }//END getDataObject_ExitPage method
}//END method // ================================================================================== /// <summary> /// THis method saves the ResultData object updating the field values contained in the /// parameter list. /// </summary> /// <param name="PageCommand">Evado.Model.UniForm.Command object.</param> /// <returns>Application Data object</returns> // ---------------------------------------------------------------------------------- private Evado.Model.UniForm.AppData updateObject ( Evado.Model.UniForm.Command PageCommand ) { this.LogMethod ( "updateObject" ); this.LogValue ( "PageEvado.Model.UniForm.Command: " + PageCommand.getAsString ( false, false ) ); this.LogValue ( "Guid: " + this.Session.Trial.Guid ); this.LogValue ( "ProjectId: " + this.Session.Trial.TrialId ); this.LogValue ( "Title: " + this.Session.Trial.Title ); try { // // Initialise the methods variables and objects. // this.Session.AncillaryRecord.Action = EvAncillaryRecords.ACTION_SAVE; // // Log access to page. // this.LogPageAccess ( "Evado.UniForm.Clinical.SubjectRecords.updateObject", this.Session.UserProfile ); // // Delete the object. // if ( PageCommand.Method == Evado.Model.UniForm.ApplicationMethods.Delete_Object ) { return this.Session.LastPage; } // // Initialise the binary file object to retrieve binary files associated with the visit. // EuBinaryFiles binaryFiles = new EuBinaryFiles ( this.ApplicationObjects, this.ServiceUserProfile, this.Session, this.UniForm_BinaryFilePath, this.UniForm_BinaryServiceUrl, this._FileRepositoryPath, this.ClassParameters ); this.LogClass ( binaryFiles.Log ); // // Get the save action value. // String stSaveAction = PageCommand.GetParameter ( Evado.Model.Clinical.EvcStatics.CONST_SAVE_ACTION ); if ( stSaveAction != String.Empty ) { this.Session.AncillaryRecord.Action = stSaveAction; } this.LogValue ( "AncillaryRecord.Action: " + this.Session.AncillaryRecord.Action ); // // if the guid is set to new object reset it to empty to add a new record. // if ( this.Session.AncillaryRecord.Guid == Evado.Model.Clinical.EvcStatics.CONST_NEW_OBJECT_ID ) { this.Session.AncillaryRecord.Guid = Guid.NewGuid ( ); this.Session.AncillaryRecord.SubjectId = this.Session.Subject.SubjectId; this.Session.AncillaryRecord.ProjectId = this.Session.Subject.TrialId; this.Session.AncillaryRecord.Action = EvAncillaryRecords.ACTION_NEW; } if ( this.Session.AncillaryRecord.RecordDate == Evado.Model.Clinical.EvcStatics.CONST_DATE_NULL ) { this.Session.AncillaryRecord.RecordDate = DateTime.Now; } // // Initialise the update variables. // this.Session.AncillaryRecord.UpdatedByUserId = this.Session.UserProfile.UserId; this.Session.AncillaryRecord.UserCommonName = this.Session.UserProfile.CommonName; // // Update the object. // this.updateObjectValue ( PageCommand.Parameters ); // // save the binary files to the file repository. // binaryFiles.addBinaryData ( PageCommand, this.Session.Subject.Guid, this.Session.Subject.SubjectId, this.Session.AncillaryRecord.Guid, this.Session.AncillaryRecord.RecordId, Guid.Empty, String.Empty ); this.LogValue ( "BinaryFiles: " + binaryFiles.Log ); // // update the object. // EvEventCodes result = this._Bll_AncillaryRecords.saveItem ( this.Session.AncillaryRecord ); // // get the debug ResultData. // this.LogValue ( this._Bll_AncillaryRecords.DebugLog ); // // if an error state is returned create log the event. // if ( result != EvEventCodes.Ok ) { string StEvent = this._Bll_AncillaryRecords.Log + " returned error message: " + Evado.Model.Clinical.EvcStatics.getEventMessage ( result ); this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent ); switch ( result ) { case EvEventCodes.Data_Duplicate_Id_Error: { this.ErrorMessage = String.Format ( EvLabels.Activity_Duplicate_Identifier_Error_Message, this.Session.Activity.ActivityId ); break; } case EvEventCodes.Identifier_Project_Id_Error: { this.ErrorMessage = EvLabels.Project_Identifier_Empty_Error_Message; break; } case EvEventCodes.Identifier_Subject_Id_Error: { this.ErrorMessage = EvLabels.Subject_Identifier_Empty_Error_Message; break; } default: { this.ErrorMessage = EvLabels.Ancilliary_Record_Update_Error_Message; break; } } return this.Session.LastPage; } return new Model.UniForm.AppData(); } catch ( Exception Ex ) { // // Create the error message to be displayed to the user. // this.ErrorMessage = EvLabels.Ancilliary_Record_Update_Error_Message; // // Generate the log the error event. // this.LogException ( Ex ); } return this.Session.LastPage; }//END method
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class public methods /// =============================================================================== /// <summary> /// This method gets the application object from the list. /// /// </summary> /// <param name="PageCommand">ClientPateEvado.Model.UniForm.Command object</param> /// <returns>ClientApplicationData</returns> // ---------------------------------------------------------------------------------- public Evado.Model.UniForm.AppData getClientDataObject ( Evado.Model.UniForm.Command PageCommand ) { this.LogMethod ( "getClientDataObject" ); this.LogValue ( "Parameter PageCommand " + PageCommand.getAsString ( false, false ) ); try { // // Initialise the methods variables and objects. // Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( ); String stViewType = PageCommand.GetParameter ( Evado.Model.UniForm.CommandParameters.Page_Id.ToString ( ) ); this.LogValue ( " stViewType: " + stViewType ); // // Determine the method to be called // switch ( PageCommand.Method ) { case Evado.Model.UniForm.ApplicationMethods.List_of_Objects: { clientDataObject = this.getListObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Get_Object: { clientDataObject = this.getObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Create_Object: { clientDataObject = this.createObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Save_Object: case Evado.Model.UniForm.ApplicationMethods.Delete_Object: { this.LogValue ( " Save Object method" ); // // Update the object values // clientDataObject = this.updateObject ( PageCommand ); break; } }//END Switch // // Handle returned exceptions. // if ( clientDataObject == null ) { this.LogValue ( " null application data returned." ); clientDataObject = this.Session.LastPage; } // // If an errot message exist display it. // if ( this.ErrorMessage != String.Empty ) { clientDataObject.Message = this.ErrorMessage; } // // return the client ResultData object. // return clientDataObject; } catch ( Exception Ex ) { this.LogException ( Ex ); } return this.Session.LastPage; }//END getClientDataObject method
}//END method // ================================================================================== /// <summary> /// THis method saves the ResultData object updating the field values contained in the /// parameter list. /// </summary> /// <param name="PageCommand">Evado.UniForm.Model.ClientClientDataObjectCommand object.</param> /// <returns>Application Data object</returns> // ---------------------------------------------------------------------------------- private Evado.Model.UniForm.AppData updateObject ( Evado.Model.UniForm.Command PageCommand ) { try { this.LogMethod ( "updateObject" ); this.LogValue ( "Parameter PageCommand: " + PageCommand.getAsString ( false, true ) ); this.LogDebug ( "Clinical.Alert: " ); this.LogDebug ( "Guid: " + this.Session.Alert.Guid ); this.LogDebug ( "ProjectId: " + this.Session.Alert.ProjectId ); this.LogDebug ( "Title: " + this.Session.Alert.Subject ); EvAlert.AlertSaveActionCodes saveAction = EvAlert.AlertSaveActionCodes.Save_Alert; // // Log access to page. // this.LogPageAccess ( this.ClassNameSpace + "updateObject", this.Session.UserProfile ); // // Initialise the update variables. // this.Session.Alert.UpdatedByUserId = this.Session.UserProfile.UserId; this.Session.Alert.UserCommonName = this.Session.UserProfile.CommonName; // // IF the guid is new object id alue then set the save object for adding to the database. // if ( this.Session.Alert.Guid == Evado.Model.Digital.EvcStatics.CONST_NEW_OBJECT_ID ) { this.Session.Alert.Guid = Guid.Empty; } // // Delete the object. // if ( PageCommand.Method == Evado.Model.UniForm.ApplicationMethods.Delete_Object ) { this.LogMethodEnd ( "updateObject" ); return this.Session.LastPage; } // // Update the object. // this.updateObjectValue ( PageCommand.Parameters ); // // Get the save action message value. // String stSaveAction = PageCommand.GetParameter ( Evado.Model.Digital.EvcStatics.CONST_SAVE_ACTION ); // // Resets the save action to the parameter passed in the page groupCommand. // if ( stSaveAction != String.Empty ) { saveAction = Evado.Model.Digital.EvcStatics.Enumerations.parseEnumValue<EvAlert.AlertSaveActionCodes> ( stSaveAction ); } this.Session.Alert.Action = saveAction; this.Session.Alert.UpdatedByUserId = this.Session.UserProfile.UserId; this.Session.Alert.UserCommonName = this.Session.UserProfile.UserCommonName; // // update the object. // EvEventCodes result = this._Bll_Alerts.saveAlert ( this.Session.Alert ); // // get the debug ResultData. // this.LogValue ( this._Bll_Alerts.Log ); // // if an error state is returned create log the event. // if ( result != EvEventCodes.Ok ) { string StEvent = this._Bll_Alerts.Log + " returned error message: " + Evado.Model.Digital.EvcStatics.getEventMessage ( result ); this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent ); switch ( result ) { case EvEventCodes.Identifier_Project_Id_Error: { this.ErrorMessage = EvLabels.Project_Identifier_Empty_Error_Message; break; } default: { this.ErrorMessage = EvLabels.Alert_Update_Error_Message; break; } } this.LogMethodEnd ( "updateObject" ); return this.Session.LastPage; } this.LogMethodEnd ( "updateObject" ); return new Model.UniForm.AppData(); } catch ( Exception Ex ) { // // Create the error message to be displayed to the user. // this.ErrorMessage = EvLabels.Alert_Update_Error_Message; // // Generate the log the error event. // this.LogException ( Ex ); } this.LogMethodEnd ( "updateObject" ); return this.Session.LastPage; }//END method
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class public methods // ================================================================================== /// <summary> /// This method gets the trial site object. /// /// </summary> /// <param name="PageCommand">Evado.Model.UniForm.Command object</param> /// <returns>Evado.Model.UniForm.AppData</returns> // ---------------------------------------------------------------------------------- public Evado.Model.UniForm.AppData getClientDataObject ( Evado.Model.UniForm.Command PageCommand ) { this.LogMethod ( "getTrialAlertObject" ); this.LogValue ( "UserProfile.CommonName: " + this.Session.UserProfile.CommonName ); this.LogValue ( "PageCommand " + PageCommand.getAsString ( false, false ) ); try { // // Initialise the methods variables and objects. // Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( ); // // Determine the method to be called // switch ( PageCommand.Method ) { case Evado.Model.UniForm.ApplicationMethods.List_of_Objects: { clientDataObject = this.getListObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Get_Object: { clientDataObject = this.getObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Create_Object: { clientDataObject = this.createObject ( PageCommand ); break; } case Evado.Model.UniForm.ApplicationMethods.Save_Object: case Evado.Model.UniForm.ApplicationMethods.Delete_Object: { // // Update the object values // clientDataObject = this.updateObject ( PageCommand ); // // if the alert is acknowledged the user needs to be diverted to the // relevant object. // this.generateRedirection ( clientDataObject ); break; } }//END Switch // // Handle returned exceptions. // if ( clientDataObject == null ) { this.LogValue ( " null application data returned." ); clientDataObject = this.Session.LastPage; } // // If an errot message exist display it. // if ( this.ErrorMessage != String.Empty ) { clientDataObject.Message = this.ErrorMessage; } // // return the client ResultData object. // return clientDataObject; } catch ( Exception Ex ) { this.LogException ( Ex ); } return this.Session.LastPage; }//END getTrialAlertObject method
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class public methods /// <summary> /// This method gets the application object from the list. /// /// </summary> /// <param name="PageCommand">ClientPateEvado.Model.UniForm.Command object</param> /// <returns>ClientApplicationData</returns> // ---------------------------------------------------------------------------------- override public Evado.Model.UniForm.AppData getDataObject ( Evado.Model.UniForm.Command PageCommand ) { this.LogMethod ( "getClientDataObject" ); this.LogValue ( "Parameter PageCommand " + PageCommand.getAsString ( false, false ) ); try { // // Initialise the methods variables and objects. // Evado.Model.UniForm.AppData clientDataObject = new Evado.Model.UniForm.AppData ( ); var pageId = PageCommand.GetPageId<EdStaticPageIds> ( ); this.LogDebug ( "Page Id {0}.", pageId ); // // Load the customer group. // this.getAdsCustomerGroup ( ); // // Determine the method to be called // switch ( PageCommand.Method ) { case Evado.Model.UniForm.ApplicationMethods.List_of_Objects: case Evado.Model.UniForm.ApplicationMethods.Get_Object: case Evado.Model.UniForm.ApplicationMethods.Create_Object: case Evado.Model.UniForm.ApplicationMethods.Save_Object: case Evado.Model.UniForm.ApplicationMethods.Delete_Object: { switch ( pageId ) { case EdStaticPageIds.User_Registration_Page: default: { clientDataObject = this.getDataObject_RegistrationPage ( PageCommand ); break; } case EdStaticPageIds.Demo_User_Exit_Page: { this.LogValue ( " Save Object method" ); clientDataObject = this.getDataObject_ExitPage ( PageCommand ); break; } } break; } }//END Switch // // Handle returned exceptions. // if ( clientDataObject == null ) { clientDataObject = this.Session.LastPage; this.LogDebug ( " null application data returned." ); } if ( this.ErrorMessage != String.Empty ) { this.LogDebug ( "Append error message" ); clientDataObject.Message = this.ErrorMessage; } // // return the client ResultData object. // this.LogMethodEnd ( "getClientDataObject" ); return clientDataObject; } catch ( Exception Ex ) { this.LogException ( Ex ); } this.LogMethodEnd ( "getClientDataObject" ); return this.Session.LastPage; }//END updateObject method