}//End getMilestoneList method. // ===================================================================================== /// <summary> /// This class returns a list of Alert objects based on the passed parameters. /// </summary> /// <param name="ProjectId">string: (Optional) The trial identifier.</param> /// <param name="Notification">Boolean: true, if the notification exists</param> /// <param name="OrgId">string: an organization identifier</param> /// <param name="State">EvAlert.AlertStates: (Optional) The alert state.</param> /// <param name="AlertType">EvAlert.AlertTypes: (Optional) The alert QueryType.</param> /// <returns>List of EvAlert: a list of Alert object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exeute the method for retrieving the selection Alerts list /// /// 2. Return the selection list. /// /// </remarks> // ------------------------------------------------------------------------------------- public List <EvAlert> getView( string ProjectId, Boolean Notification, string OrgId, EvAlert.AlertStates State, EvAlert.AlertTypes AlertType) { this.LogMethod("getView method. "); this.LogDebug("ProjectId: " + ProjectId); this.LogDebug("OrgId: " + OrgId); this.LogDebug("Notification: " + Notification); this.LogDebug("Alert State: " + State); List <EvAlert> view = this._dalProjectAlerts.getView( ProjectId, Notification, OrgId, String.Empty, State, AlertType); this.LogDebug(this._dalProjectAlerts.Status); // // Return selectionList to UI // return(view); }// End getMilestoneList method.
// ===================================================================================== /// <summary> /// This class returns a list of Alert objects based on the passed parameters. /// </summary> /// <param name="Project">Evado.Model.Digital.EvProject: The project identifier.</param> /// <param name="ProjectOrganisation">Evado.Model.Digital.EvOrganisation: The Current User profile.</param> /// <param name="CurrentUser">Evado.Model.Digital.EdUserProfile: The Current User profile.</param> /// <param name="AlertState">EvAlert.AlertStates: (Optional) The alert state.</param> /// <param name="AlertType">EvAlert.AlertTypes: (Optional) The alert QueryType.</param> /// <returns>List of EvAlert: a list of Alert object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exeute the method for retrieving the selection Alerts list /// /// 2. Return the selection list. /// /// </remarks> // ------------------------------------------------------------------------------------- public List <EvAlert> getView( Evado.Model.Digital.EdUserProfile CurrentUser, EvAlert.AlertStates AlertState, EvAlert.AlertTypes AlertType) { this.LogMethod("getView method. "); this.LogDebug("UserName: "******"Alert State: " + AlertState); // // Initialise the methods variables and objects. // String orgId = String.Empty; Boolean bNotification = false; // // Set the bNotification and userCommonName to default values, // if the role is ProjectManager or Monitor or Sponsor. // if (CurrentUser.hasManagementAccess == true) { bNotification = true; orgId = String.Empty; } this.LogDebug("bNotification: " + bNotification); this.LogDebug("orgId: " + orgId); // // Get the list of raised alerts. // List <EvAlert> view = this._dalProjectAlerts.getView( Project.ApplicationId, bNotification, orgId, String.Empty, AlertState, AlertType); this.LogDebug(this._dalProjectAlerts.Status); // // Filter the studies based on user profile. // this.FilterViews(CurrentUser, Project, view); // // Return selectionList to UI // return(view); }//End getMilestoneList method.
}//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
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region class public methods // ===================================================================================== /// <summary> /// This class sets the value according with the field name. /// </summary> /// <param name="fieldname">AlertFieldNames: an alert's field name</param> /// <param name="Value">string: an alert's value</param> /// <returns> Evado.Model.EvEventCodes: an event code</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize the local variables and objects of the method including: date, status and type /// /// 2. Switch the fieldname and update value for the property defined by the alert field names. /// </remarks> // ------------------------------------------------------------------------------------ public Evado.Model.EvEventCodes setValue(EvAlert.AlertFieldNames fieldname, string Value) { // // Initialise the methods local variables and objects. // DateTime date = EvcStatics.CONST_DATE_NULL; EvAlert.AlertStates status = EvAlert.AlertStates.Null; EvAlert.AlertTypes type = EvAlert.AlertTypes.Null; // // The switch determines the item to be updated. // switch (fieldname) { case EvAlert.AlertFieldNames.Alert_Id: { this._AlertId = Value; break; } case EvAlert.AlertFieldNames.Trial_Id: { this._ProjectId = Value; break; } case EvAlert.AlertFieldNames.To_Org_Id: { this._ToOrgId = Value; break; } case EvAlert.AlertFieldNames.To_User: { this._ToUser = Value; break; } case EvAlert.AlertFieldNames.Alert_Subject: { this._Subject = Value; break; } case EvAlert.AlertFieldNames.New_Message: this._NewMessage = Value; break; case EvAlert.AlertFieldNames.Message: this._Message = Value; break; case EvAlert.AlertFieldNames.From_User_UserId: this._FromUserUserId = Value; break; case EvAlert.AlertFieldNames.From_User: this.FromUser = Value; break; case EvAlert.AlertFieldNames.Raised_Date: if (DateTime.TryParse(Value, out date) == true) { this._Raised = date; break; } else { return(Evado.Model.EvEventCodes.Data_Date_Casting_Error); } case EvAlert.AlertFieldNames.Acknowledged_By_UserId: { this._AcknowledgedByUserId = Value; break; } case EvAlert.AlertFieldNames.Acknowledged_By: { this._AcknowledgedBy = Value; break; } case EvAlert.AlertFieldNames.Acknowledged_Date: if (DateTime.TryParse(Value, out date) == true) { this._Acknowledged = date; break; } else { return(Evado.Model.EvEventCodes.Data_Date_Casting_Error); } case EvAlert.AlertFieldNames.Closed_By_UserId: { this._ClosedByUserId.ToString( ); break; } case EvAlert.AlertFieldNames.Closed_By: { this._ClosedBy = Value; break; } case EvAlert.AlertFieldNames.Closed_Date: if (DateTime.TryParse(Value, out date) == true) { this._Closed = date; break; } else { return(Evado.Model.EvEventCodes.Data_Date_Casting_Error); } case EvAlert.AlertFieldNames.Type_Id: { if (Evado.Model.EvStatics.tryParseEnumValue <EvAlert.AlertTypes> (Value, out type) == false) { return(Evado.Model.EvEventCodes.Data_Enumeration_Casting_Error); } this._TypeId = type; break; } case EvAlert.AlertFieldNames.Alert_State: { if (Evado.Model.EvStatics.tryParseEnumValue <EvAlert.AlertStates> (Value, out status) == false) { return(Evado.Model.EvEventCodes.Data_Enumeration_Casting_Error); } this._State = status; break; } default: return(0); }//END Switch return(0); }//END getValue 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