}//END getItem method #endregion #region project alert Save methods // ===================================================================================== /// <summary> /// This class saves items to the Alert ResultData table. /// </summary> /// <param name="Alert">EvAlert: A Project Alert ResultData object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Update the Alert object's state /// /// 2. Execute the method for adding items, if the Alert's Guid is empty /// /// 3. Else, execute the method for updating items. /// /// 4. Return the event code for the execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveAlert(EvAlert Alert) { this.LogMethod("saveItem method "); this.LogDebug("Guid: " + Alert.Guid); this.LogDebug("AlertId: " + Alert.AlertId); this.LogDebug("TypeId: " + Alert.TypeId); this.LogDebug("Action: " + Alert.Action); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Update the _ProjectAlert record state to reflect the requested action. // this.updateState(Alert); // // If the _ProjectAlert FormUid is zero or empty, then create a new alert record. // if (Alert.Guid == Guid.Empty) { iReturn = this._dalProjectAlerts.addItem(Alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); } // // Update the alert record. // iReturn = this._dalProjectAlerts.updateItem(Alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); }//END saveAlert method
}//END createRecord method // ===================================================================================== /// <summary> /// This class saves form records to the database. /// </summary> /// <param name="Entity">EvRForm: The trial form record object</param> /// <param name="HadEditAccess">EvRole: a user role object</param> /// <returns>EvEventCodes: an event code for saving form records</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the form object's identifiers are empty. /// /// 2. If a review query has been raised, process the query. /// /// 3. Execute the method for updating form's state, closing form's alert and processing formfields /// /// 4. Return an event code of method execution. /// </remarks> // ---------------------------------------------------------------------------------- public EvEventCodes UpdateEntity ( EdRecord Entity ) { this.LogMethod ( "UpdateEntity" ); this.LogValue ( "Entity.Guid: " + Entity.Guid ); this.LogValue ( "LayoutGuid: " + Entity.LayoutGuid ); this.LogValue ( "SaveAction: " + Entity.SaveAction ); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Check that the ResultData object has valid identifiers to add it to the database. // if ( Entity.Guid == Guid.Empty ) { this.LogValue ( "Record Guid is empty" ); return EvEventCodes.Identifier_Global_Unique_Identifier_Error; } if ( Entity.LayoutGuid == Guid.Empty ) { this.LogValue ( "Form ID is empty" ); return EvEventCodes.Identifier_Form_Id_Error; } // // Update the state information in the trial Report. // this.updateFormState ( Entity ); this.LogValue ( "Status: " + Entity.State ); // // Update the instrument newField states. // this.processFormFields ( Entity ); // // Update the trial record. // iReturn = this._DalEntities.UpdateItem ( Entity ); this.LogClass ( this._DalEntities.Log ); // // error encountered return eror. // if ( iReturn < EvEventCodes.Ok ) { return iReturn; } // // Return the update status. // this.LogMethodEnd ( "UpdateEntity" ); return iReturn; }//END saveRecord method.
}//END addRecord method. // ===================================================================================== /// <summary> /// This class updates items to FirstSubject record ResultData table. /// </summary> /// <param name="AncillaryRecord">EvSubjectRecord: a subjecyt record object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for updating items to milestone record ResultData table. /// /// 2. Return an event code for updating items. /// </remarks> // ---------------------------------------------------------------------------------- private EvEventCodes updateItem(EvAncillaryRecord AncillaryRecord) { // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; this._DebugLog.AppendLine("Evado.Digital.Bll.AncillaryRecords.UpdateItem method."); // // Update the state information in the trial Report. // this.updateState(AncillaryRecord); // // Update the trial record. // iReturn = this._dalSubjectRecords.updateItem(AncillaryRecord); this._DebugLog.AppendLine(this._dalSubjectRecords.Log); if (iReturn < EvEventCodes.Ok) { return(iReturn); } // // Return the update status. // return(iReturn); }//END updateItem method.
} //END Create web method. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Private Methods. // ===================================================================================== // ------------------------------------------------------------------------------------- // ===================================================================================== /// <summary> /// This method updates the TokenUserProfile object in the database. /// </summary> /// <param name="UserProfile">EusTokenUserProfile object</param> /// <returns>EvEventCodes enumerated value.</returns> // ------------------------------------------------------------------------------------- private EvEventCodes UpdateTokenUserProfile(EusTokenUserProfile UserProfile) { this.LogMethod("UpdateTokenUserProfile"); // // initialise the methods variables and objects. // EvUserProfileBase serviceUserProfile = new EvUserProfileBase( ); serviceUserProfile.UserId = "TokenService"; serviceUserProfile.CommonName = "Token Service"; // // Set the device client service session state. // IntegrationServices integrationServices = new IntegrationServices( Global.ServiceVersion, Global.GlobalObjectList, Global.ApplicationPath, serviceUserProfile, Global.UniForm_BinaryFilePath, Global.UniForm_BinaryServiceUrl); integrationServices.LoggingLevel = 5; integrationServices.EventLogSource = Global.EventLogSource; // // Update the token user profile. // EvEventCodes result = integrationServices.UpdateTokenUserProfile(UserProfile); this.LogClass(integrationServices.Log); this.LogMethodEnd("UpdateTokenUserProfile"); return(result); }
}//END SaveItem class // ===================================================================================== /// <summary> /// This class deletes items from the FormField table. /// </summary> /// <param name="Form">EvForm: a form object</param> /// <returns>EvEventCodes: an event code for deleting items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method to retrieve a list of formfield objects based on the form's Guid /// /// 2. Loop through the formfield list and execute the method for deleting the formfield items. /// /// 3. Return an event code for deleting items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes DeleteFields(EdRecord Form) { this.LogMethod("DeleteFields"); this.LogValue("Guid: " + Form.Guid); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Retrieve the TestReport items // List <EdRecordField> Items = this._DalFormFields.GetFieldList(Form.Guid); // // Iterate through the items deleting them // for (int Count = 0; Count < Items.Count; Count++) { EdRecordField FormItem = (EdRecordField)Items [Count]; iReturn = _DalFormFields.DeleteItem(FormItem); if (iReturn < EvEventCodes.Ok) { this.LogClass(this._DalFormFields.Log); return(iReturn); } } return(iReturn); } // Close DeleteFields method
}//END updateTokenUser method // ===================================================================================== /// <summary> /// This method add an organisation for token generated users. /// </summary> /// <param name="UserProfile">Evado.Digital.Model.EdUserProfile object</param> /// <returns>EvEventCodes: an event code for saving items</returns> // ------------------------------------------------------------------------------------- public EvEventCodes AddTokenOrganisation( EdUserProfile UserProfile) { this.LogMethod("AddTokenOrganisation"); // // Initialise the methods variables and objects. // EvEventCodes result = EvEventCodes.Ok; Evado.Digital.Model.EdOrganisation organisation = new EdOrganisation( ); Evado.Digital.Dal.EdOrganisations dal_Organisations = new Evado.Digital.Dal.EdOrganisations(this.ClassParameters); // // Create the org identifier. // int orgCount = dal_Organisations.getOrganisationCount(String.Empty); String orgId = "T" + orgCount.ToString("0000"); organisation.OrgId = orgId; UserProfile.OrgId = orgId; // // Add organisation object // result = dal_Organisations.addItem(organisation); this.LogDebug(dal_Organisations.Log); this.LogMethodEnd("AddTokenOrganisation"); return(result); }
}//END CopyForm class #endregion #region Revise form methods // =================================================================================== /// <summary> /// This class revises the form objects /// </summary> /// <param name="Form">EvForm: a form object</param> /// <param name="UserCommonName">string: a user common name</param> /// <returns>EvEventCodes: an event code for revising items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the Guid or User common name is empty /// /// 2. Execute the method for revising items /// /// 3. Return an event code for revising items /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes ReviseForm(EdRecord Form) { this.LogMethod("ReviseForm method."); this.LogValue("FormGuid: " + Form.Guid); // // Initialise the local variables // EvEventCodes iReturn = EvEventCodes.Ok; // // Check that the user id is valid // if (Form.Guid == Guid.Empty) { return(EvEventCodes.Identifier_Global_Unique_Identifier_Error); } iReturn = this._Dal_RecordLayouts.CopyLayout(Form, false); this.LogClass(this._Dal_RecordLayouts.Log); // // Return the response. // return(iReturn); }//END ReviseForm class
}//END updateState method. #endregion #region Copy form methods // =================================================================================== /// <summary> /// This class copies items from form object to database. /// </summary> /// <param name="Layout">EdRecord: a layout object</param> /// <returns>EvEventCodes: an event code for copying items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the Guid or UserCommonName is empty /// /// 2. Execute the method for copying items to form ResultData table. /// /// 3. Return an event code for copying items /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes CopyLayout(EdRecord Layout) { this.LogMethod("CopyLayout"); this.LogValue("LayoutGuid: " + Layout.Guid); // // Initialise the local variables // EvEventCodes iReturn = EvEventCodes.Ok; // // Check that the user id is valid // if (Layout.Guid == Guid.Empty) { return(EvEventCodes.Identifier_Global_Unique_Identifier_Error); } iReturn = this._Dal_RecordLayouts.CopyLayout(Layout, true); this.LogClass(this._Dal_RecordLayouts.Log); // // Return the response. // this.LogMethodEnd("CopyLayout"); return(iReturn); }//END CopyForm class
}//END getCommentList method. #endregion #region Class update methods // ===================================================================================== /// <summary> /// This method add mew comments to the form record comments table. /// </summary> /// <param name="CommentList">List of EvFormRecordComment: a list of form record comment objects</param> /// <returns>EvEventCodes: an event code for adding new commetns.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Iterate through the list of comments /// /// 2. Return 'OK' event code if, the comment's content is empty /// /// 3. Exit if the comment's RecordGuid is empty. /// /// 4. Add new comment to the Form Record Comment table /// /// 5. Return the event code for adding new commetns. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes addNewComments(List <EdFormRecordComment> CommentList) { // // Initialzie the method debug log and the return event code. // this.LogMethod("addNewComments Method. "); this.LogDebug("CommentList count: " + CommentList.Count); EvEventCodes eventCode = EvEventCodes.Ok; // // Iterate through the list of comments to add new comments to the database // foreach (EdFormRecordComment comment in CommentList) { this.LogDebug("Content: " + comment.Content + ", NewComment" + comment.NewComment); if (comment.NewComment == false) { this.LogDebug("New content = false"); continue; } if (comment.Content == String.Empty) { this.LogDebug("Comment empty"); continue; } // // if the record guid is empty coment error // if (comment.RecordGuid == Guid.Empty) { this.LogDebug("Record Guid is Empty"); continue; } // // Add comment to database // eventCode = this.addItem(comment); // // exit if an event error. // if (eventCode != EvEventCodes.Ok) { return(eventCode); } //END error exit } //END iteration loop this.LogMethodEnd("addNewComments."); return(EvEventCodes.Ok); }//END addNewComments method
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class public methods // ================================================================================== /// <summary> /// /// This method is executed when the field ResultData is loaded and passess an array of /// fields to the script for initial processing. /// /// </summary> /// <param name="Type">Type object</param> /// <param name="Form">Form object</param> /// <returns>bool : True: SubmittedRecords Successfully, False : script exited permaturally</returns> // --------------------------------------------------------------------------------- public EvEventCodes runScript(EvServerPageScript.ScripEventTypes Type, EdRecord Form) { this._debugLog.AppendLine(Evado.Digital.Model.EvcStatics.CONST_METHOD_START + "Evado.UniForm.Clinical.EvServerPageScript.runScript"); // // Initialise the methods variables and objects. // EvEventCodes iReturn = EvEventCodes.Ok; string stFileName = Form.LayoutId; this._debugLog.AppendLine("Type: " + Type); this._debugLog.AppendLine("FileName: " + stFileName); if (Form.Design.hasCsScript == false) { return(EvEventCodes.CsFormScript_Form_Script_Enabled_False); } // // Select the script be run. // switch (Type) { case EvServerPageScript.ScripEventTypes.OnOpen: { // // Execute the onload script. // iReturn = this.OnOpenPage( stFileName, Form); break; } case EvServerPageScript.ScripEventTypes.OnUpdate: { // // Execute the onload script. // iReturn = this.onUpdatePage( stFileName, Form); break; } }//END Script selection. // // Return the outcome of the script. // return(iReturn); }//END runScript method
// ===================================================================================== /// <summary> /// This class saves new report to database /// </summary> /// <param name="Report">EvReport: a report object</param> /// <returns>EvEventCodes: an event code for saving reports</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for adding report to database /// /// 2. Return an event code for saving new report. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveNewReport(EdReport Report) { this.LogMethod("saveNewReport method."); this.LogDebug("Adding Report."); EvEventCodes iReturn = EvEventCodes.Ok; iReturn = this._dalReportSaved.addReport(Report); this.LogClass(this._dalReportSaved.Log); return(iReturn); }//END saveNewReport class
}//END getItem method #endregion #region Class update methods // ===================================================================================== /// <summary> /// This class retrieves a user profile with a specific connection String. /// </summary> /// <param name="ConnectionStringKey">string: the database connection string config key</param> /// <param name="UserProfile">Evado.Digital.Model.EdUserProfile object</param> /// <returns>EvEventCodes enumeration</returns> // ------------------------------------------------------------------------------------- public EvEventCodes saveItem( string ConnectionStringKey, Evado.Digital.Model.EdUserProfile UserProfile) { this.FlushLog( ); this.LogMethod("saveItem"); Evado.Digital.Bll.EvStaticSetting.ConnectionStringKey = ConnectionStringKey; EvEventCodes userProfile = this.saveItem(UserProfile); Evado.Digital.Bll.EvStaticSetting.ResetConnectionString( ); return(userProfile); }
}//END getItemById class // ===================================================================================== /// <summary> /// This class saves items to SiteProfile ResultData table. /// </summary> /// <param name="Properties">EvSiteProfile: a site profile object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for updating items /// /// 2. Return an event code for updating items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes updateItem(Evado.Digital.Model.EdAdapterSettings Properties) { this.LogMethod("Saving Record method"); EvEventCodes iReturn = EvEventCodes.Ok; // // Update the _SiteProperties record. // iReturn = this._dll_AdapterSettings.updateItem(Properties); this.LogDebugClass(this._dll_AdapterSettings.Log); return(iReturn); }//END updateItem class
}//END GetItem class #endregion #region Update FormField object methods // ===================================================================================== /// <summary> /// This class saves items to formfield ResultData table. /// </summary> /// <param name="FormField">EvFormField: a formfield object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the FormGuid or UserCommonName is empty. /// /// 2. Execute the method for deleting items, if the action code is delete /// /// 3. Execute the method for adding items, if the formfield's Uid is empty. /// /// 4. Else, execute the method for updating items. /// /// 5. Return an event code of the method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes SaveItem(EdRecordField FormField) { this.LogMethod("saveItem Method"); this.LogValue("Guid: " + FormField.Guid); this.LogValue("FormGuid: " + FormField.LayoutGuid); this.LogValue("FieldId: " + FormField.FieldId); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Validate whether the FormGuid and UserCommonName are not empty // if (FormField.LayoutGuid == Guid.Empty) { this.LogValue("Form Guid Error."); return(EvEventCodes.Identifier_Global_Unique_Identifier_Error); } // // If the action is set to delete the object. // if (FormField.Title == String.Empty && FormField.Design.Instructions == String.Empty) { iReturn = _DalFormFields.DeleteItem(FormField); this.LogClass(_DalFormFields.Log); return(iReturn); } // // If the newField FormUid is zero or empty, then create a new newField record. // if (FormField.Guid == Guid.Empty) { this.LogValue("Add New Object. "); iReturn = _DalFormFields.AddItem(FormField); this.LogClass(_DalFormFields.Log); return(iReturn); } // // Update the newField record. // iReturn = _DalFormFields.UpdateItem(FormField); this.LogClass(_DalFormFields.Log); return(iReturn); }//END SaveItem class
// ===================================================================================== /// <summary> /// This class updates the user profile in the database. /// The update and add process are the same as in each execution the currentMonth objects are /// set to superseded and then a new object is inserted to the database. /// </summary> /// <param name="UserProfile">Evado.Digital.Model.EdUserProfile: a userProfile object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the UserId or UserCommonName is empty /// /// 2. Execute the method for deleting items if the commone name is empty. /// /// 3. Execute the method for adding items if the Uid is not defined /// /// 4. Else, execute the method to update items. /// /// 5. Return an event code of method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveItem(Evado.Digital.Model.EdUserProfile UserProfile) { this.FlushLog( ); this.LogMethod("saveItem"); this.LogValue("UserId: " + UserProfile.UserId); this.LogValue("CommonName: " + UserProfile.CommonName); // // Initialise the methods variables and objects. // EvEventCodes iReturn = EvEventCodes.Ok; // // Check that the user id is valid // if (UserProfile.UserId == String.Empty) { this.LogValue("UserId is empty"); return(EvEventCodes.Identifier_User_Id_Error); } // // If CommonName length is null delete the user. // if (UserProfile.CommonName == String.Empty) { this.LogValue("Delete User"); iReturn = this._Dal_UserProfiles.DeleteItem(UserProfile); this.LogDebug(this._Dal_UserProfiles.Log); return(iReturn); } // // Add a new user if the user profile Guid is empty. // if (UserProfile.Guid == Guid.Empty) { this.LogValue("Add User"); iReturn = this._Dal_UserProfiles.AddItem(UserProfile); this.LogDebug(this._Dal_UserProfiles.Log); return(iReturn); } this.LogValue("update User"); iReturn = this._Dal_UserProfiles.UpdateItem(UserProfile); this.LogDebug(this._Dal_UserProfiles.Log); return(iReturn); }//END saveItem method
}//END lockItem method // ===================================================================================== /// <summary> /// This class unlocks items to a single user update /// </summary> /// <param name="AncillaryRecord">EvSubjectRecord: a subjecyt record object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for unlocking items /// /// 2. Return an event code for unlocking items. /// </remarks> // ---------------------------------------------------------------------------------- public EvEventCodes unlockItem(EvAncillaryRecord AncillaryRecord) { // // Initialise method variables // this._DebugLog.AppendLine("Evado.Digital.Bll.AncillaryRecords.unlockItem method. "); EvEventCodes iReturn = EvEventCodes.Ok; // // Update the trial record. // iReturn = this._dalSubjectRecords.UnlockItem(AncillaryRecord); this._DebugLog.AppendLine(this._dalSubjectRecords.Log); return(iReturn); }//END unlockItem method
}//END lockItem method // ===================================================================================== /// <summary> /// This class unlocks the form record for single user update. /// </summary> /// <param name="Record">EvForm: a form object</param> /// <returns>EvEventCodes: an event code for locking items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for unlocking form records. /// /// 2. Return an event code for locking form records. /// </remarks> // ---------------------------------------------------------------------------------- public EvEventCodes unlockItem ( EdRecord Record ) { // // Initialise method variables // this.LogValue ( "<br/>Evado.Digital.Bll.Clinical.EvFormRecords.unlockItem " ); EvEventCodes iReturn = EvEventCodes.Ok; // // Update the trial record. // iReturn = this._DalRecords.unlockRecord ( Record ); this.LogValue ( "" + this._DalRecords.Log ); return iReturn; }//END unlockItem method
}//END lockItem method // ===================================================================================== /// <summary> /// This class unlocks the form record for single user update. /// </summary> /// <param name="Entity">EvForm: a form object</param> /// <returns>EvEventCodes: an event code for locking items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for unlocking form records. /// /// 2. Return an event code for locking form records. /// </remarks> // ---------------------------------------------------------------------------------- public EvEventCodes unlockItem ( EdRecord Entity ) { // // Initialise method variables // this.LogMethod ( "unlockItem method. " ); EvEventCodes iReturn = EvEventCodes.Ok; // // Update the trial record. // iReturn = this._DalEntities.unlockRecord ( Entity ); this.LogDebugClass ( this._DalEntities.Log ); return iReturn; }//END unlockItem method
}//END getItem class // ===================================================================================== /// <summary> /// This class saves items to MenuItem table. /// </summary> /// <param name="MenuItem">EvMenuItem: MenuItem ResultData object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This class consists of the following steps: /// /// 1. If MenuItem's Title is empty, delete the MenuItem records. /// /// 2. If MenuItem's Guid is empty, add new the MenuItem records. /// /// 3. Else, update MenuItem records. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveItem(EvMenuItem MenuItem) { this.LogMethod("saveItem method "); this.LogDebug("Guid: " + MenuItem.Guid); this.LogDebug("Title: " + MenuItem.Title); this.LogDebug("RoleList: " + MenuItem.RoleList); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // If MenuItem's title is empty, delete the Menu Items. // if (MenuItem.Title == String.Empty) { this.LogDebug("DELETING ITEM"); iReturn = this._dalMenus.deleteItem(MenuItem); this.LogClass(this._dalMenus.Log); return(iReturn); } // // If the MenuItem Guid is empty, create a new MenuItem record. // if (MenuItem.Guid == Guid.Empty) { this.LogDebug("ADDING ITEM"); iReturn = this._dalMenus.addItem(MenuItem); this.LogClass(this._dalMenus.Log); return(iReturn); } this.LogDebug("UPDATING ITEM"); // // Update the MenuItem record. // iReturn = this._dalMenus.updateItem(MenuItem); this.LogClass(this._dalMenus.Log); return(iReturn); }//END saveItem class
}//END updateState method. #endregion #region project alert Processing update // ===================================================================================== /// <summary> /// This class acknowledges items from the Alert ResultData table. /// </summary> /// <param name="RecordId">string: (Mandatoy) A record identifier</param> /// <param name="TypeId">EvAlert.AlertTypes: (Mandatoy) An alert QueryType identifier</param> /// <param name="UserCommonName">string: (Mandatoy) User's Common Name</param> /// <returns>EvEventCodes: an event code for acknowleging items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Retrieve a list of alert object. /// /// 2. Exit, if the Alerts list is empty. /// /// 3. Else, extract the first row to the Alert object. /// /// 4. Update the Alert state and execute the method for acknowledging items. /// /// 5. Return an event code for acknowledging items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes AcknowledgeAlert( String RecordId, EvAlert.AlertTypes TypeId, String UserCommonName) { this.LogMethod("AcknowledgeAlert method."); this.LogDebug("RecordId: " + RecordId); this.LogDebug("TypeId: " + TypeId); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Retrieve the Records Alerts. // ArrayList alertList = this._dalProjectAlerts.getViewByRecord(RecordId, TypeId, EvAlert.AlertStates.Raised); // // No alerts to be Acknowledged. // if (alertList.Count == 0) { return(EvEventCodes.Ok); } EvAlert alert = (EvAlert)alertList [0]; alert.State = EvAlert.AlertStates.Acknowledged; alert.Action = EvAlert.AlertSaveActionCodes.Acknowledge_Alert; alert.UserCommonName = UserCommonName; // // Update the _ProjectAlert record state to reflect the requested action. // updateState(alert); // // Update the _ProjectAlert record. // iReturn = this._dalProjectAlerts.updateItem(alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); }//END AcknowledgeAlert method
}//END getReport class //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Report update methods. // ===================================================================================== /// <summary> /// This class saves items to the Report ResultData table. /// The update and add process are the same as in each execution the currentMonth objects are /// set to superseded and then a new object is inserted to the database. /// </summary> /// <param name="Report">EvReport: a report object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for deleting items, if the Guid is not empty. /// /// 2. Else, execute the method for adding items /// /// 3. Else, execute the method for updating items. /// /// 4. Return the event code of the method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveReport(EdReport Report) { this._DebugLog = new System.Text.StringBuilder( ); EvEventCodes iReturn = EvEventCodes.Ok; this.LogMethod("saveReport method."); // // Deletion in the ResultData object consists of setting the currentMonth object to superseded // with the rsult that it is not visible to operational system. // // If none of the properties are selected then delete the user. // if (Report.ReportTitle == String.Empty) { if (Report.Guid != Guid.Empty) { this.LogValue(" Deleting Report."); iReturn = this._dalReportTemplates.deleteItem(Report); this.LogClass(this._dalReportTemplates.Log); } return(iReturn); } // // If the object UID = 0 it is new selection to add a record // if (Report.Guid == Guid.Empty) { this.LogValue(" Adding Report."); iReturn = this._dalReportTemplates.addReport(Report); this.LogClass(this._dalReportTemplates.Log); return(iReturn); } this.LogValue(" Updating Report."); iReturn = this._dalReportTemplates.updateReport(Report); this.LogClass(this._dalReportTemplates.Log); return(iReturn); } // Close saveReport method
}//END GetFormFieldList class #endregion // ================================================ /// <summary> /// This class adds a data change object to the database. /// </summary> /// <param name="DataChange">EvDataChange: a datachange object</param> /// <returns>EvEventCodes: an event code for adding items to data change table.</returns> // ------------------------------------------------------------------------------------- public EvEventCodes AddItem(EvDataChange DataChange) { // // Initialize the method status and a no-items variable // this._DebugLog.AppendLine(Evado.Model.EvStatics.CONST_METHOD_START + " Evado.Digital.Dal.DataChanges.addItem method."); this._DebugLog.AppendLine("ProjectId: " + DataChange.TrialId); this._DebugLog.AppendLine("TypeId: " + DataChange.TableName); this._DebugLog.AppendLine("UserId: " + DataChange.UserId); this._DebugLog.AppendLine("DataChange.Items.Count count: " + DataChange.Items.Count); EvEventCodes result = EvEventCodes.Ok; result = this._dalChanges.AddItem(DataChange); this._DebugLog.AppendLine(this._dalChanges.Log); return(result); }
}//END GetItem method // ===================================================================================== /// <summary> /// This class processes the save items on Organization ResultData table. /// </summary> /// <param name="Organisation">EvOrganisation: an Organisation ResultData object</param> /// <returns>EvEventCodes: an event code for processing save items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the OrgId or UserCommonName is empty /// /// 2. Execute the method for deleting items, if the action code is delete. /// /// 3. Execute the method for adding items, if the Uid is empty. /// /// 4. Else execute the method for updating items /// /// 5. Return an event code of the method execution /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveItem ( EdOrganisation Organisation ) { this.LogMethod ( "saveItem method." ); this.LogDebug( "Guid: " + Organisation.Guid ); this.LogDebug( "OrgId: " + Organisation.OrgId ); this.LogDebug( "Name: " + Organisation.Name ); this.LogDebug( "OrgType: " + Organisation.OrgType ); // // Define the local variables // EvEventCodes iReturn = EvEventCodes.Ok; // // If Faciity Name is null the delete the Organisation ResultData object from the database. // if ( Organisation.Name == String.Empty || Organisation.Action == EdOrganisation.ActionCodes.Delete_Object ) { iReturn = this._DalOrganisations.deleteItem ( Organisation ); this.LogDebugClass ( this._DalOrganisations.Log ); return iReturn; } // // If the Organisation ResultData object unique identifier is null or '0' then // add the Organisation ResultData object to the database. // if ( Organisation.Guid == Guid.Empty ) { iReturn = this._DalOrganisations.addItem ( Organisation ); this.LogDebugClass ( this._DalOrganisations.Log ); return iReturn; } // // Update the Organisation ResultData object in the database. // iReturn = this._DalOrganisations.updateItem ( Organisation ); // Update existing record. this.LogDebugClass ( this._DalOrganisations.Log ); return iReturn; }//END saveItem class
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Select Token User Update methods. // ================================================================================== /// <summary> /// This method gets generates the page object for the UniFORM client. /// </summary> /// <param name="TokenUserProfile">Evado.Model.EusTokenUserProfile object</param> /// <returns>String</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. /// </remarks> // ---------------------------------------------------------------------------------- public EvEventCodes UpdateTokenUserProfile ( Evado.Model.EusTokenUserProfile TokenUserProfile ) { this.LogMethod ( "UpdateTokenUserProfile" ); this.LogValue ( "LoggingLevel: " + this.LoggingLevel ); 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 ); // // Call the adapter token user update method. // EvEventCodes result = this._ApplicationAdapter.UpdateTokenUserProfile ( TokenUserProfile ); this.LogApplication ( this._ApplicationAdapter.AdapterLog ); this.LogMethodEnd ( "UpdateTokenUserProfile" ); return result; } catch ( Exception Ex ) { this.LogException ( Ex ); } this.LogMethodEnd ( "UpdateTokenUserProfile" ); return EvEventCodes.Token_User_Profile_Update_Error; }//END UpdateTokenUserProfile method
}//ENd saveUserProfile method // ================================================================================== /// <summary> /// THis method updates the organisation object. /// </summary> // ---------------------------------------------------------------------------------- private EvEventCodes saveOrganisationValue ( ) { this.LogMethod ( "saveOrganisationValue" ); // // Initialise the methods variables and objecs. // EdOrganisations bll_organisations = new EdOrganisations ( this.ClassParameters ); // // update the object. // EvEventCodes result = bll_organisations.saveItem ( this.Session.Organisation ); // // get the debug ResultData. // this.LogDebugClass ( bll_organisations.Log ); // // if an error state is returned create log the event. // if ( result != EvEventCodes.Ok ) { string StEvent = bll_organisations.Log + " returned error message: " + Evado.Digital.Model.EvcStatics.getEventMessage ( result ); this.LogError ( EvEventCodes.Database_Record_Update_Error, StEvent ); switch ( result ) { default: { this.ErrorMessage = EdLabels.Organisation_Update_Error_Message; break; } } return result; }//END save error returned. this.LogMethodEnd ( "saveOrganisationValue" ); return EvEventCodes.Ok; }//ENd saveOrganisationValue method
}//END getItem class. #endregion #region Save object methods // ===================================================================================== /// <summary> /// This class adds items to the Application event datatable. /// </summary> /// <param name="ApplicationEvent">EvApplicationEvent: an application event ResultData object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This class consists of the following steps: /// /// 1. Add items to the application events table. /// /// 2. Return the event code for adding items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes AddEvent(EvApplicationEvent ApplicationEvent) { this.LogMethod("AddEvent method. "); this.LogDebugValue("EventId: " + ApplicationEvent.EventId); EvEventCodes result = EvEventCodes.Ok; if (ApplicationEvent.UserId == String.Empty) { ApplicationEvent.UserId = "Evado Executive"; } // // If the action is set to delete the object. // result = this._dalApplicationEvents.addEvent(ApplicationEvent); this.LogClass(this._dalApplicationEvents.Log); this.LogDebugValue("result: " + result); return(result); }//END method AddEvent
}//END LogException class // ===================================================================================== /// <summary> /// This class checks whether the event's description, Category and user name are written to the logError /// </summary> /// <param name="EventId">Integer: an event identifier</param> /// <param name="Description">string: an event's description</param> /// <returns>Boolean: true, if the event is logged</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Fill the application event object. /// /// 2. Write the application event log /// /// 3. Adding items to application event table. /// /// 4. Return true, if adding runs successfully. /// /// </remarks> // ------------------------------------------------------------------------------------- public void LogError( EvEventCodes EventId, String Description) { // // Initialise the method variables // EvApplicationEvent applicationEvent = new EvApplicationEvent( EvApplicationEvent.EventType.Error, EventId, this.ClassNameSpace, Description, this.ClassParameters.UserProfile.UserId); this.AddEvent(applicationEvent); if (this._ClassParameters.LoggingLevel >= 0) { this._Log.AppendLine(DateTime.Now.ToString("dd-MM-yy hh:mm:ss") + " EXCEPTION EVENT: "); this._Log.AppendLine(Description); } }//END LogError method
// ===================================================================================== /// <summary> /// This class checks whether the event's description, Category and user name are written to the logError /// </summary> /// <param name="EventId">Integer: an event identifier</param> /// <param name="Description">string: an event's description</param> /// <returns>Boolean: true, if the event is logged</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Fill the application event object. /// /// 2. Write the application event log /// /// 3. Adding items to application event table. /// /// 4. Return true, if adding runs successfully. /// /// </remarks> // ------------------------------------------------------------------------------------- public void LogError ( EvEventCodes EventId ) { // // Initialise the method variables // String stEvent = "EventId: " + EventId; EvApplicationEvent applicationEvent = new EvApplicationEvent ( EvApplicationEvent.EventType.Error, EventId, this.ClassNameSpace, stEvent, this.Session.UserProfile.UserId ); this.AddEvent ( applicationEvent ); this._AdapterLog.AppendLine ( DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " EXCEPTION EVENT: " ); this._AdapterLog.AppendLine ( stEvent ); }//END LogError method
} // Close method saveSubjectRecord // ===================================================================================== /// <summary> /// This class adds new items on FirstSubject record ResultData table. /// </summary> /// <param name="AncillaryRecord">EvSubjectRecord: a subjecyt record object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for adding items to milestone record ResultData table. /// /// 2. Return an event code for adding items. /// </remarks> // ---------------------------------------------------------------------------------- private EvEventCodes addRecord(EvAncillaryRecord AncillaryRecord) { this._DebugLog.AppendLine("Evado.Digital.Bll.AncillaryRecords. AddRecord method"); // // Define local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Update the state information in the trial Report. // this.updateState(AncillaryRecord); // // Add the new trial record to the database. // iReturn = this._dalSubjectRecords.addItem(AncillaryRecord); this._DebugLog.AppendLine(this._dalSubjectRecords.Log); // // Return the update status. // return(iReturn); }//END addRecord method.
}//END LogMethodEnd class // ================================================================================== /// <summary> /// This method appends EVENT to the class log /// a new line at the end of the text. /// </summary> /// <param name="Value">String: debug text.</param> // ---------------------------------------------------------------------------------- protected void LogEvent(String Value) { // // Initialise the method variables // EvEventCodes iReturn = EvEventCodes.Ok; EvApplicationEvent ApplicationEvent = new EvApplicationEvent( EvApplicationEvent.EventType.Warning, EvEventCodes.Ok, this.ClassNameSpace, Value, this.ClassParameters.UserProfile.UserId); if (this._ClassParameters.LoggingLevel >= 0) { this._Log.AppendLine(DateTime.Now.ToString("dd-MM-yy hh:mm:ss") + " EVENT: "); this._Log.AppendLine(Value); } // // If the action is set to delete the object. // iReturn = this.AddEvent(ApplicationEvent); }//END LogEvent class